code: @Override
      public void writeByteStream(InputStream is)
          throws IOException
      {
          while (true) {
              int len = SIZE - _offset - 3;
  
              if (len < 16) {
                  flushBuffer();
                  len = SIZE - _offset - 3;
              }
  
              len = is.read(_buffer, _offset + 3, len);
  
              if (len <= 0) {
                  _buffer[_offset++] = BC_BINARY_DIRECT;
                  return;
              }
  
              _buffer[_offset + 0] = (byte) BC_BINARY_CHUNK;
              _buffer[_offset + 1] = (byte) (len >> 8);
              _buffer[_offset + 2] = (byte) (len);
  
              _offset += len + 3;
          }
      }
docs: Writes a full output stream.