Package org.apache.thrift.transport
Class TEndpointTransport
- java.lang.Object
-
- org.apache.thrift.transport.TTransport
-
- org.apache.thrift.transport.TEndpointTransport
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
AutoExpandingBufferReadTransport,AutoExpandingBufferWriteTransport,TByteBuffer,THttpClient,TIOStreamTransport,TMemoryBuffer,TMemoryInputTransport,TMemoryTransport,TNonblockingTransport,TSaslClientTransport,TSaslServerTransport,TSimpleFileTransport
public abstract class TEndpointTransport extends TTransport
-
-
Field Summary
Fields Modifier and Type Field Description protected longknownMessageSizeprotected longremainingMessageSize
-
Constructor Summary
Constructors Constructor Description TEndpointTransport(TConfiguration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckReadBytesAvailable(long numBytes)Throws if there are not enough bytes in the input stream to satisfy a read of numBytes bytes of dataprotected voidcountConsumedMessageBytes(long numBytes)Consumes numBytes from the RemainingMessageSize.TConfigurationgetConfiguration()protected longgetMaxMessageSize()protected voidresetConsumedMessageSize(long newSize)Resets RemainingMessageSize to the configured maximumvoidupdateKnownMessageSize(long size)Updates RemainingMessageSize to reflect then known real message size (e.g. framed transport).-
Methods inherited from class org.apache.thrift.transport.TTransport
close, consumeBuffer, flush, getBuffer, getBufferPosition, getBytesRemainingInBuffer, isOpen, open, peek, read, read, readAll, write, write, write
-
-
-
-
Constructor Detail
-
TEndpointTransport
public TEndpointTransport(TConfiguration config) throws TTransportException
- Throws:
TTransportException
-
-
Method Detail
-
getMaxMessageSize
protected long getMaxMessageSize()
-
getConfiguration
public TConfiguration getConfiguration()
- Specified by:
getConfigurationin classTTransport
-
resetConsumedMessageSize
protected void resetConsumedMessageSize(long newSize) throws TTransportExceptionResets RemainingMessageSize to the configured maximum- Parameters:
newSize-- Throws:
TTransportException
-
updateKnownMessageSize
public void updateKnownMessageSize(long size) throws TTransportExceptionUpdates RemainingMessageSize to reflect then known real message size (e.g. framed transport). Will throw if we already consumed too many bytes or if the new size is larger than allowed.- Specified by:
updateKnownMessageSizein classTTransport- Parameters:
size-- Throws:
TTransportException
-
checkReadBytesAvailable
public void checkReadBytesAvailable(long numBytes) throws TTransportExceptionThrows if there are not enough bytes in the input stream to satisfy a read of numBytes bytes of data- Specified by:
checkReadBytesAvailablein classTTransport- Parameters:
numBytes-- Throws:
TTransportException
-
countConsumedMessageBytes
protected void countConsumedMessageBytes(long numBytes) throws TTransportExceptionConsumes numBytes from the RemainingMessageSize.- Parameters:
numBytes-- Throws:
TTransportException
-
-