public TProtocol getProtocol(TTransport trans) { return new TBinaryProtocolDirect(trans, this.useDirectBuffers); } }
/** * {@inheritDoc} */ @Override public void writeBinary(ByteBuffer buffer) throws TException { int length = buffer.remaining(); writeI32(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); }
/** * {@inheritDoc} */ @Override public ByteBuffer readDirectBinary() throws TException { if (this.useDirectBuffers && this.nonBlockingTransport != null) { int length = readI32(); if (length < 0) { throw new TProtocolException(TProtocolException.NEGATIVE_SIZE, "Negative length: " + length); } return ThriftUtils.readByteBuffer(this.nonBlockingTransport, length); } else { return super.readBinary(); } }
inProtocol = new TBinaryProtocolDirect(inTransport, this.useDirectBuffers); outProtocol = new TBinaryProtocolDirect(outTransport, this.useDirectBuffers); } else {