Here's my candidate for the fastest stream reader. My interest and testing is with file input streams, but it's nice to support any stream.
public static String readStream(InputStream is) throws IOException{
int i, length = 0;
StringBuffer s = null;
char[] c = null;
InputStreamReader isr = new InputStreamReader(is);
while(length != -1){
length = is.available();
if(c == null) c = new char[length];
isr.read(c, 0 , length);
i = isr.read();
if(i == -1){
if(s == null) return String.copyValueOf(c);
else break;
}else{
if(s == null) s = new StringBuffer();
s.append(c, 0, length);
s.append((char)i);
}
}
return s.toString();
}