code: 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);
          }
      }
docs: Traverse through each byte of the specified stream. The
  stream is closed after the closure returns.
  
  @param is      stream to iterate over, closed after the method call
  @param closure closure to apply to each byte
  @throws IOException if an IOException occurs.
  @since 1.0