Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java - InputStream - Weird Characters in the Output!

807580Oct 4 2009 — edited Oct 21 2009
Hi,

I have a software which outputs lines of numbers one by one. In another java program, I use BufferedReader as follows:

BufferedReader input = new BufferedReader(new InputStreamReader(pr.getInputStream(),"US-ASCII"));

where pr is the process which runs the software. For each line in the output stream, I try to check whether the first number in the line is greater than a certain value and if it is, I write to another file.

The problem is, when I run the software repeatedly (in a linux cluster) like 10 simulations simultaneously, one of them have got @^@^.... characters followed by some huge numbers. So, I tried eliminating that line alone by using String.matches command but now, it seems even after that I get the error - so, I think it might mean that it is actually during the writing process that the problem occurs. I use BufferedWriter like the following to write it: (I do flush it after writing.)

BufferedWriter out=new BufferedWriter(new FileWriter(tmp_file));

I would greatly appreciate if someone can help. This thing really seems to be a huge bottleneck!

Thanks,
Senthil
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 18 2009
Added on Oct 4 2009
14 comments
2,894 views