public static byte[] readBytes(InputStream in) throws IOException {
  ByteArrayOutputStream out=new ByteArrayOutputStream(4096);
  transfer(in,out);
  return out.toByteArray();
}

public static byte [ ] readBytes ( InputStream in ) throws IOException { ByteArrayOutputStream out = new ByteArrayOutputStream ( 4096 ) ; transfer ( in , out ) ; return out . toByteArray ( ) ; }
reads all bytes from the supplied input stream and returns them as a byte array .
