public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "tromey at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug libgcj/18376] java.io.BufferedWriter outputing  extraneous characters?
Date: Tue, 09 Nov 2004 22:11:00 -0000	[thread overview]
Message-ID: <20041109221108.6647.qmail@sourceware.org> (raw)
In-Reply-To: <20041108145729.18376.wayne.gray@coynetextileservices.com>


------- 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


  parent reply	other threads:[~2004-11-09 22:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-08 14:57 [Bug java/18376] New: " wayne dot gray at coynetextileservices dot com
2004-11-08 15:00 ` [Bug libgcj/18376] " pinskia at gcc dot gnu dot org
2004-11-08 15:02 ` wayne dot gray at coynetextileservices dot com
2004-11-08 18:34 ` pinskia at gcc dot gnu dot org
2004-11-08 22:17 ` tromey at gcc dot gnu dot org
2004-11-09 13:37 ` wayne dot gray at coynetextileservices dot com
2004-11-09 22:11 ` tromey at gcc dot gnu dot org [this message]
2004-11-10 18:23 ` wayne dot gray at coynetextileservices dot com
2005-04-28 21:52 ` pinskia at gcc dot gnu dot org
2005-04-28 22:38 ` greenrd at greenrd dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20041109221108.6647.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).