tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Len Popp" <len.p...@gmail.com>
Subject Re: [OT] Basic int/char conversion question
Date Thu, 01 Jan 2009 17:28:58 GMT
On Thu, Jan 1, 2009 at 12:09, Caldarale, Charles R
<Chuck.Caldarale@unisys.com> wrote:
>> From: Len Popp [mailto:len.popp@gmail.com]
>> Subject: Re: [OT] Basic int/char conversion question
>>
>> Another option: Read the bytes into a ByteBuffer, then convert
>> the bytes into a string. You can tell the String constructor
>> which charset to use.
>
> That would seem to violate one of the specified constraints:
>
>> > I cannot change the InputStream into something else,
>> > because there are a zillion other places where this
>> > webapp tests on the read byte's value, numerically.
>
> whereas using an InputStreamReader would not since its read() method is compatible with
that of a plain InputStream.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and
is thus for use only by the intended recipient. If you received this in error, please contact
the sender and delete the e-mail and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>

I didn't mean to change the input stream at all, just change "buf"
from a StringBuffer to a ByteBuffer, then create a String with the
correct byte-to-character conversion after all the bytes are read.

Maybe ByteBuffer isn't the right class, maybe it shoudl be  byte[] or
ArrayList<Byte>? Or am I misunderstanding what André is trying to do?
-- 
Len
Mime
View raw message