public static byte[] readAllLimited(InputStream inStr,int limit) throws IOException {
  ByteArrayOutputStream buf=new ByteArrayOutputStream();
  pipeAllLimited(inStr,limit,buf);
  return buf.toByteArray();
}

public static byte [ ] readAllLimited ( InputStream inStr , int limit ) throws IOException { ByteArrayOutputStream buf = new ByteArrayOutputStream ( ) ; pipeAllLimited ( inStr , limit , buf ) ; return buf . toByteArray ( ) ; }
read from instr up to a maximum number of bytes , throwing an exception if more the maximum amount of requested data is available .
