public static ByteArrayList readAsBytes(InputStream is) throws IOException {
  ByteArrayList buf=new ByteArrayList();
  byte[] b=new byte[8192];
  int nread=-1;
  while ((nread=is.read(b)) >= 0) {
    buf.add(b,0,nread);
  }
  return buf;
}

public static ByteArrayList readAsBytes ( InputStream is ) throws IOException { ByteArrayList buf = new ByteArrayList ( ) ; byte [ ] b = new byte [ 8192 ] ; int nread = - 1 ; while ( ( nread = is . read ( b ) ) >= 0 ) { buf . add ( b , 0 , nread ) ; } return buf ; }
reads an input stream into a list of byte values .
