code: void padAndWriteBlock(boolean writeEmptyBlockIfFull) throws IOException {
      int remaining = writeBuffer.remaining();
      if (writeEmptyBlockIfFull || remaining < blockSize) {
        writeBlanksToBuffer(remaining);
        writeBuffer.flip();
        delegate.write(writeBuffer);
        writeBuffer.clear();
        numBlocksWritten++;
      }
    }
docs: Adds padding to the stream until to the end of the block.
  
  @throws IOException