From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6665 invoked by alias); 9 Nov 2004 22:11:09 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 6649 invoked by uid 48); 9 Nov 2004 22:11:08 -0000 Date: Tue, 09 Nov 2004 22:11:00 -0000 Message-ID: <20041109221108.6647.qmail@sourceware.org> From: "tromey at gcc dot gnu dot org" To: java-prs@gcc.gnu.org In-Reply-To: <20041108145729.18376.wayne.gray@coynetextileservices.com> References: <20041108145729.18376.wayne.gray@coynetextileservices.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libgcj/18376] java.io.BufferedWriter outputing extraneous characters? X-Bugzilla-Reason: CC X-SW-Source: 2004-q4/txt/msg00361.txt.bz2 List-Id: ------- Additional Comments From tromey at gcc dot gnu dot org 2004-11-09 22:11 ------- I downloaded the test case and modified it to print the number of characters it read. I can confirm that for me it does in fact loop: opsy. gij TestGcj.IoTest ../demo/buildlog.txt Out.txt fileLength = 2290 x = 2048 x = 242 A few things to note here. First, you're using a BufferedReader, so you aren't guaranteed to fill your request array. You might pick up buffered data instead. Second, using characters here is incorrect, as File.length() returns the size in bytes. This seems to be the cause of the problem we're seeing with the test case, since it still operates in the same way if I remove the buffering. I think the internal character set converters have their own buffers and as a result we don't get a full file read. If I change the loop in this test program to use the actual read result as the length argument to write, it works properly. So, even though libgcj is perhaps a little odd here, I still think it is correct. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18376