Package org.apache.thrift.transport.sasl
Class FixedSizeHeaderReader
- java.lang.Object
-
- org.apache.thrift.transport.sasl.FixedSizeHeaderReader
-
- All Implemented Interfaces:
FrameHeaderReader
- Direct Known Subclasses:
DataFrameHeaderReader,SaslNegotiationHeaderReader
public abstract class FixedSizeHeaderReader extends java.lang.Object implements FrameHeaderReader
Headers' size should be predefined.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.nio.ByteBufferbyteBuffer
-
Constructor Summary
Constructors Constructor Description FixedSizeHeaderReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclear()Clear the header and make it available to read a new header.protected abstract intheaderSize()booleanisComplete()protected abstract voidonComplete()Actions (e.g. validation) to carry out when the header is complete.booleanread(TTransport transport)(Nonblocking) Read fields from underlying transport layer.byte[]toBytes()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.thrift.transport.sasl.FrameHeaderReader
payloadSize
-
-
-
-
Method Detail
-
isComplete
public boolean isComplete()
- Specified by:
isCompletein interfaceFrameHeaderReader- Returns:
- true if this header has all its fields set.
-
clear
public void clear()
Description copied from interface:FrameHeaderReaderClear the header and make it available to read a new header.- Specified by:
clearin interfaceFrameHeaderReader
-
toBytes
public byte[] toBytes()
- Specified by:
toBytesin interfaceFrameHeaderReader- Returns:
- The received bytes for the header.
-
read
public boolean read(TTransport transport) throws TTransportException
Description copied from interface:FrameHeaderReader(Nonblocking) Read fields from underlying transport layer.- Specified by:
readin interfaceFrameHeaderReader- Parameters:
transport- underlying transport.- Returns:
- true if header is complete after read.
- Throws:
TSaslNegotiationException- if fail to read a valid header of a sasl negotiation message.TTransportException- if io error.
-
headerSize
protected abstract int headerSize()
- Returns:
- Size of the header.
-
onComplete
protected abstract void onComplete() throws TTransportExceptionActions (e.g. validation) to carry out when the header is complete.- Throws:
TTransportException
-
-