public static final boolean readFromStream(InputStream in,byte[] buf,int offset,int len) throws IOException {
  int totalBytesRead=0;
  while (totalBytesRead < len) {
    int bytesRead=in.read(buf,offset + totalBytesRead,len - totalBytesRead);
    if (bytesRead < 0) {
      return false;
    }
    totalBytesRead+=bytesRead;
  }
  return true;
}

public static final boolean readFromStream ( InputStream in , byte [ ] buf , int offset , int len ) throws IOException { int totalBytesRead = 0 ; while ( totalBytesRead < len ) { int bytesRead = in . read ( buf , offset + totalBytesRead , len - totalBytesRead ) ; if ( bytesRead < 0 ) { return false ; } totalBytesRead += bytesRead ; } return true ; }
read from input stream and fill the given buffer from the given offset up to length len .
