code: private void writeBuffer() throws IOException {
          bufferedWriter.flip(); // position is set to zero in dataFile.write
          dataFile.write(writeOffset, bufferedWriter);
          writeOffset += bufferedWriter.limit();
          bufferedWriter.clear();
          readNextChunkFromFile(); // before overwriting the next bucket. Read it.
      }
docs: writes the remaining bytes in bufferedWriter to the given FileChannel
  
  @param FileChannel
  @throws IOException