本文整理匯總了Java中org.apache.thrift.transport.TFramedTransport.encodeFrameSize方法的典型用法代碼示例。如果您正苦於以下問題:Java TFramedTransport.encodeFrameSize方法的具體用法?Java TFramedTransport.encodeFrameSize怎麽用?Java TFramedTransport.encodeFrameSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.thrift.transport.TFramedTransport
的用法示例。
在下文中一共展示了TFramedTransport.encodeFrameSize方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: completeFrame
import org.apache.thrift.transport.TFramedTransport; //導入方法依賴的package包/類
/**
* Write the frame at the current state, and reset the buffer to be able to
* generate a new frame.
*
* @throws IOException On failed write.
*/
public void completeFrame() throws IOException {
int frameSize = buffer.position();
if (frameSize > 0) {
TFramedTransport.encodeFrameSize(frameSize, frameSizeBuffer);
buffer.flip();
synchronized (out) {
out.write(ByteBuffer.wrap(frameSizeBuffer));
while (buffer.hasRemaining()) {
out.write(buffer);
}
}
buffer.rewind();
buffer.limit(buffer.capacity());
}
}
示例2: prepareMethodCall
import org.apache.thrift.transport.TFramedTransport; //導入方法依賴的package包/類
/**
* Initialize buffers.
* @throws TException if buffer initialization fails
*/
protected void prepareMethodCall() throws TException {
TMemoryBuffer memoryBuffer = new TMemoryBuffer(INITIAL_MEMORY_BUFFER_SIZE);
TProtocol protocol = protocolFactory.getProtocol(memoryBuffer);
write_args(protocol);
int length = memoryBuffer.length();
frameBuffer = ByteBuffer.wrap(memoryBuffer.getArray(), 0, length);
TFramedTransport.encodeFrameSize(length, sizeBufferArray);
sizeBuffer = ByteBuffer.wrap(sizeBufferArray);
}
示例3: encodeFrame
import org.apache.thrift.transport.TFramedTransport; //導入方法依賴的package包/類
static byte[] encodeFrame( byte[] content ) {
byte[] result = new byte[4+content.length];
TFramedTransport.encodeFrameSize( content.length, result );
System.arraycopy( content, 0, result, 4, content.length );
return result;
}
示例4: encodeFrame
import org.apache.thrift.transport.TFramedTransport; //導入方法依賴的package包/類
static byte[] encodeFrame(byte[] content) {
byte[] result = new byte[4 + content.length];
TFramedTransport.encodeFrameSize(content.length, result);
System.arraycopy(content, 0, result, 4, content.length);
return result;
}