🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.api
Article #868

Byte-Char Conversion

#868
From: Owen Green
Date: Sun, 13 Oct 2002 16:51
20 lines
1772 bytes
Hi,

Is there a standard idiom for situations where one wants to read both
byte and character data from the same stream?

AFAICS, InputStreamReader is the only officially mandated method of
safely converting from one to the other*, but this will read more data
than it actually needs from the underlying stream, which isn't
desireable.

Any (easy) home grown solutions look like they'd suffer from the same
frailties as all the old deprecated JDK1.x conversion methods, as they'd
rely on assumptions about the character encoding.

Any wisom greatly appreciated,
Owen

*The biggy for this is getting a readLine() method that won't interfere
with the integrity of an underlying buffer - creating a new String for
each interation seems, um, expensive :)
Technical Details
Message-ID: <3da9a473$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!small.news.tele.dk!212.43.194.69!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 1089d0,c3655063af01f787,start
X-Google-Attributes: gid1089d0,public
X-Google-ArrivalTime: 2002-10-13 10:14:02 PST
From: "Owen Green" <owen@begonefoulmachine.kennulz.demon.co.uk>
Newsgroups: borland.public.jbuilder.java.api
Subject: Byte-Char Conversion
Date: Sun, 13 Oct 2002 17:51:10 +0100
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
NNTP-Posting-Host: 62.253.133.165
Message-ID: <3da9a473$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1034527859 62.253.133.165 (13 Oct 2002 09:50:59 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-04!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!news.tele.dk!small.news.tele.dk!212.43.194.69!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail