code: private void flushBuffer()
              throws IOException
      {
          if (buffer.position() > 0) {
              buffer.flip();
              writeCompressed(buffer);
              buffer.clear();
          }
      }
docs: Compresses and writes out any buffered data. This does nothing if there
  is no currently buffered data.
  
  @throws IOException