commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel F. Savarese" <...@savarese.org>
Subject Re: commons/net whois fails with whois.opensrs.net
Date Tue, 29 Jul 2003 15:21:33 GMT

In message <25233796.1059490382@[192.168.0.40]>, Mark Himsley writes:
>Ug - I guess attachments don't get through the list server... And I don't 
>even know if you want to see this on this list at all. Sorry in advance if 
>I've committed a faux par.

I guess technically they're supposed to go to commons-dev, but I'm not
going to complain :)  I want to apply your patch, but I can't for two
reasons.  The first is that PrintStream converts strings to bytes
using the platform's default character encoding.  We can fix that with

output = new PrintStream(_output_, false, "US-ASCII");

but then there's the problem that PrintStream methods don't throw
IOException and hide the real cause of an error, only leaving you
with checkError() to see if something went wrong.  Will wrapping
the output stream with a BufferedOutputStream using a sufficiently
large buffer also work for you?  Unfortunately, there's still the
issue of turning the string into straight ASCII bytes over
the wire without touching backward incompatible CharsetEncoder.
How about either:

output = new DataOutputStream(new BufferedOutputStream(_output_, someSize));

or

BufferedWriter writer =
   new BufferedWriter(new OutputStreamWriter(_output_, "US-ASCII"), someSize);

daniel



Mime
View raw message