/** * {@inheritDoc} */ @Override public void writeBinary(ByteBuffer buffer) throws TException { int length = buffer.remaining(); writeVarInt32(length); // call this in blocking transport case also to correctly deal with // case when ByteBuffer is not a heap one ThriftUtils.writeByteBuffer(buffer, trans_, nonBlockingTransport, length); }