classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches] FYI: Adding read/write to javax/swing/text/JTextCompone


From: Meskauskas Audrius
Subject: Re: [cp-patches] FYI: Adding read/write to javax/swing/text/JTextComponent.java (fixing bug #13640)
Date: Wed, 06 Jul 2005 10:28:52 +0200
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

reading in bigger chunks?


Hello, Tom

This depends on from where we read. I thought the user will use our BufferedReader to cover the multiple components being read. The optimal buffer size should be larger than the size of the text, stored in the typical Swing component (labels, buttons, menu items and so on, I think, normally contain 16-20 characters at most, but more frequently 6-8 or about).

Cheers
Audrius

Tom Tromey wrote:

"Audrius" == Meskauskas Audrius <address@hidden> writes:

Audrius> +    StringBuffer b = new StringBuffer();
Audrius> +    int c;
Audrius> +
Audrius> +    // Read till -1 (EOF).
Audrius> +    while ((c = input.read()) >= 0)
Audrius> +      b.append((char) c);

Ouch.  How about reading in bigger chunks?

Tom







reply via email to

[Prev in Thread] Current Thread [Next in Thread]