@Override
 public void write(int b) throws IOException {
   checkIfClosed();
   Preconditions.checkState(mWrittenBytes + 1 <= mBlockSize, PreconditionMessage.ERR_END_OF_BLOCK);
   if (mBuffer.position() >= mBuffer.limit()) {
     flush();
   }
   BufferUtils.putIntByteBuffer(mBuffer, b);
   mWrittenBytes++;
 }