public static byte[] readInputStream(InputStream i) throws IOException {
  ByteArrayOutputStream b=new ByteArrayOutputStream();
  copy(i,b);
  return b.toByteArray();
}

public static byte [ ] readInputStream ( InputStream i ) throws IOException { ByteArrayOutputStream b = new ByteArrayOutputStream ( ) ; copy ( i , b ) ; return b . toByteArray ( ) ; }
converts a small input stream to a byte array
