Class ConfigurableTByteBuffer

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable

    public class ConfigurableTByteBuffer
    extends org.apache.thrift.transport.TEndpointTransport
    Source code of this class is a copy of TByteBuffer. However, TByteBuffer is a final class and has only one construction method which uses the default TConfiguration. In some cases, the capacity of our ByteBuffer could be so large that it reaches the MaxMessageSize of thrift. We need to customize the TConfiguration and that is why we use this class.
    • Field Summary

      • Fields inherited from class org.apache.thrift.transport.TEndpointTransport

        knownMessageSize, remainingMessageSize
    • Constructor Summary

      Constructors 
      Constructor Description
      ConfigurableTByteBuffer​(java.nio.ByteBuffer byteBuffer)  
      ConfigurableTByteBuffer​(java.nio.ByteBuffer byteBuffer, org.apache.thrift.TConfiguration configuration)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ConfigurableTByteBuffer clear()  
      void close()  
      ConfigurableTByteBuffer flip()  
      java.nio.ByteBuffer getByteBuffer()  
      boolean isOpen()  
      void open()  
      int read​(byte[] buf, int off, int len)  
      byte[] toByteArray()  
      void write​(byte[] buf, int off, int len)  
      • Methods inherited from class org.apache.thrift.transport.TEndpointTransport

        checkReadBytesAvailable, countConsumedMessageBytes, getConfiguration, getMaxMessageSize, resetConsumedMessageSize, updateKnownMessageSize
      • Methods inherited from class org.apache.thrift.transport.TTransport

        consumeBuffer, flush, getBuffer, getBufferPosition, getBytesRemainingInBuffer, peek, read, readAll, write, write
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConfigurableTByteBuffer

        public ConfigurableTByteBuffer​(java.nio.ByteBuffer byteBuffer)
                                throws org.apache.thrift.transport.TTransportException
        Throws:
        org.apache.thrift.transport.TTransportException
      • ConfigurableTByteBuffer

        public ConfigurableTByteBuffer​(java.nio.ByteBuffer byteBuffer,
                                       org.apache.thrift.TConfiguration configuration)
                                throws org.apache.thrift.transport.TTransportException
        Throws:
        org.apache.thrift.transport.TTransportException
    • Method Detail

      • isOpen

        public boolean isOpen()
        Specified by:
        isOpen in class org.apache.thrift.transport.TTransport
      • open

        public void open()
        Specified by:
        open in class org.apache.thrift.transport.TTransport
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Specified by:
        close in class org.apache.thrift.transport.TTransport
      • read

        public int read​(byte[] buf,
                        int off,
                        int len)
                 throws org.apache.thrift.transport.TTransportException
        Specified by:
        read in class org.apache.thrift.transport.TTransport
        Throws:
        org.apache.thrift.transport.TTransportException
      • write

        public void write​(byte[] buf,
                          int off,
                          int len)
                   throws org.apache.thrift.transport.TTransportException
        Specified by:
        write in class org.apache.thrift.transport.TTransport
        Throws:
        org.apache.thrift.transport.TTransportException
      • getByteBuffer

        public java.nio.ByteBuffer getByteBuffer()
      • toByteArray

        public byte[] toByteArray()