code: public InputStream readInputStream()
          throws IOException
      {
          int tag = read();
  
          switch (tag) {
              case 'N':
                  return null;
  
              case 'B':
              case 'b':
                  _isLastChunk = tag == 'B';
                  _chunkLength = (read() << 8) + read();
                  break;
  
              default:
                  throw expect("inputStream", tag);
          }
  
          return new InputStream() {
              boolean _isClosed = false;
  
              public int read()
                  throws IOException
              {
                  if (_isClosed || _is == null)
                      return -1;
  
                  int ch = parseByte();
                  if (ch < 0)
                      _isClosed = true;
  
                  return ch;
              }
  
              public int read(byte[] buffer, int offset, int length)
                  throws IOException
              {
                  if (_isClosed || _is == null)
                      return -1;
  
                  int len = HessianInput.this.read(buffer, offset, length);
                  if (len < 0)
                      _isClosed = true;
  
                  return len;
              }
  
              public void close()
                  throws IOException
              {
                  while (read() >= 0) {
                  }
  
                  _isClosed = true;
              }
          };
      }
docs: Reads bytes based on an input stream.