The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

use byte buffer instead of char buffer

Posted by Nathan Cho on January 12, 2001 at 8:58 PM

Hi, I've just looked at this problem. I wonder this late response would be any help, but I want to share my idea.
If you find better way, let's share it too.
I think you should use byte buffer instead of char buffer.
For instance, instead of the following:
br2 = new BufferedReader(new InputStreamReader(p.getInputStream()));
use this:
BufferedInputStream br2 = new BufferedInputStream(p.getInputStream());
and use this:
int c;
while ((c = brs.read()) != -1) {
System.out.print((char) c);
}




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us