public static void readBytes(InputStream is,byte[] b,int offset,int len){
  if (len == 0)   return;
  try {
    int read=0;
    while (read < len) {
      int n=is.read(b,offset + read,len - read);
      if (n < 1)       throw new PngjInputException("error reading bytes, " + n + " !="+ len);
      read+=n;
    }
  }
 catch (  IOException e) {
    throw new PngjInputException("error reading",e);
  }
}

public static void readBytes ( InputStream is , byte [ ] b , int offset , int len ) { if ( len == 0 ) return ; try { int read = 0 ; while ( read < len ) { int n = is . read ( b , offset + read , len - read ) ; if ( n < 1 ) throw new PngjInputException ( "error reading bytes, " + n + " !=" + len ) ; read += n ; } } catch ( IOException e ) { throw new PngjInputException ( "error reading" , e ) ; } }
guaranteed to read exactly len bytes . throws error if it can ' t
