This is the mail archive of the
java-prs@gcc.gnu.org
mailing list for the Java project.
[Bug libgcj/18376] java.io.BufferedWriter outputing extraneous characters?
- From: "wayne dot gray at coynetextileservices dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: java-prs at gcc dot gnu dot org
- Date: 9 Nov 2004 13:37:03 -0000
- Subject: [Bug libgcj/18376] java.io.BufferedWriter outputing extraneous characters?
- References: <20041108145729.18376.wayne.gray@coynetextileservices.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From wayne dot gray at coynetextileservices dot com 2004-11-09 13:36 -------
(In reply to comment #3)
> The code says:
>
> while (br.read(charBuff,0,fileLength) != -1)
> bw.write(charBuff,0,fileLength);
>
> There is no guarantee that read() will fill the buffer.
> If you see a partial read, you will then write a full buffer,
> meaning that the remainder of the buffer will be zero
> (or leftovers from an earlier read).
>
> So, I think this is not a libgcj bug.
>
I see what you're saying. But if that were true then the while loop would have
multiple iterations. No?
The read and write methods are only being called once in this method for this
file. Just confirmed with another test.
This is true because I'm sizing the buffer to the length of the file and...
br.read(charBuff,0,fileLength)
...reads the entire file length in the first shot.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18376