當前位置: 首頁>>代碼示例>>Java>>正文


Java TFramedTransport.encodeFrameSize方法代碼示例

本文整理匯總了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());
    }
}
 
開發者ID:morimekta,項目名稱:providence,代碼行數:24,代碼來源:FramedBufferOutputStream.java

示例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);
}
 
開發者ID:adityayadav76,項目名稱:internet_of_things_simulator,代碼行數:16,代碼來源:TAsyncMethodCall.java

示例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;
}
 
開發者ID:dachengxi,項目名稱:EatDubbo,代碼行數:7,代碼來源:ThriftCodecTest.java

示例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;
}
 
開發者ID:hufeng,項目名稱:dubbo2.js,代碼行數:7,代碼來源:ThriftCodecTest.java


注:本文中的org.apache.thrift.transport.TFramedTransport.encodeFrameSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。