On Thu, Jan 1, 2009 at 12:09, Caldarale, Charles R <chuck.caldar...@unisys.com> wrote: >> From: Len Popp [mailto:len.p...@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-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@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