The Artima Developer Community
Sponsored Link

Java Answers Forum
FileOutput

2 replies on 1 page. Most recent reply: Dec 17, 2003 8:51 AM by Devika

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Devika

Posts: 2
Nickname: devika64
Registered: Dec, 2003

FileOutput Posted: Dec 17, 2003 7:47 AM
Reply to this message Reply
Advertisement
Hi, I am trying to output lines of data from one txt file to another but i want to print each line in reverse order. I am able to output the file in reverse order except that the lines do not output line after line, instead the output is in one long line across. Help, how can i fix this problem??


Kishori Sharan

Posts: 211
Nickname: kishori
Registered: Feb, 2002

Re: FileOutput Posted: Dec 17, 2003 8:37 AM
Reply to this message Reply
I think you are not writing a new line when you write the text in reverse order in your file. When you are reading your source file then maybe you are using readLine() method. This method doesn't read the line terminator. So, when you are writing it to new file you need to add a new line. If you are using a buffered writer then you can add a new line using its newLine() method after every line you write.

Devika

Posts: 2
Nickname: devika64
Registered: Dec, 2003

Re: FileOutput Posted: Dec 17, 2003 8:51 AM
Reply to this message Reply
hey kishori,
I was using the readLine() method so i guess that was the problem. I'll try the newLine() method now. thanks for the info

devika

Flat View: This topic has 2 replies on 1 page
Topic: a servlet error under linux Previous Topic   Next Topic Topic: Java Web Services

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use