public static void eachByte(InputStream is,int bufferLen,@ClosureParams(value=FromString.class,options="byte[],Integer") Closure closure) throws IOException {
  byte[] buffer=new byte[bufferLen];
  int bytesRead;
  try {
    while ((bytesRead=is.read(buffer,0,bufferLen)) > 0) {
      closure.call(buffer,bytesRead);
    }
    InputStream temp=is;
    is=null;
    temp.close();
  }
  finally {
    closeWithWarning(is);
  }
}

public static void eachByte ( InputStream is , int bufferLen , @ ClosureParams ( value = FromString . class , options = "byte[],Integer" ) Closure closure ) throws IOException { byte [ ] buffer = new byte [ bufferLen ] ; int bytesRead ; try { while ( ( bytesRead = is . read ( buffer , 0 , bufferLen ) ) > 0 ) { closure . call ( buffer , bytesRead ) ; } InputStream temp = is ; is = null ; temp . close ( ) ; } finally { closeWithWarning ( is ) ; } }
traverse through each the specified stream reading bytes into a buffer and calling the 2 parameter closure with this buffer and the number of bytes .
