• Post Reply Bookmark Topic Watch Topic
  • New Topic

BufferedWriter->readLine()  RSS feed

 
Lakshmi Manikantan
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i read a line of text using readLine...it displays a string with null characters in between each character...does anybody know why it is so and how can i get the original string back...the length of the string is doubled+1 ???
------------------
lakshmi
 
Jimi Rock
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lakshmi, I dont know why this happened with you, I have tried to create a BufferedReader that reads a textual file line by line using ReadLine method. I could retreive the original line as a string without problems. as follows:

FileReader in = new FileReader(MyInputFile);
BufferedReader br = new BufferedReader(in);
while ((s = br.readLine()) != null)
System.out.println(s);

just a note, many string problems could be solved using StringTokenizer class methods.
Regards,
mac.
 
Ganesh Ram
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This could be an encoding issue also...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!