本文整理汇总了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;
}