public static void eachByte(InputStream is,@ClosureParams(value=SimpleType.class,options="byte") Closure closure) throws IOException {
  try {
    while (true) {
      int b=is.read();
      if (b == -1) {
        break;
      }
 else {
        closure.call((byte)b);
      }
    }
    InputStream temp=is;
    is=null;
    temp.close();
  }
  finally {
    closeWithWarning(is);
  }
}

public static void eachByte ( InputStream is , @ ClosureParams ( value = SimpleType . class , options = "byte" ) Closure closure ) throws IOException { try { while ( true ) { int b = is . read ( ) ; if ( b == - 1 ) { break ; } else { closure . call ( ( byte ) b ) ; } } InputStream temp = is ; is = null ; temp . close ( ) ; } finally { closeWithWarning ( is ) ; } }
traverse through each byte of the specified stream . the stream is closed after the closure returns .
