Package org.apache.thrift.transport.sasl
Class FrameReader<T extends FrameHeaderReader>
java.lang.Object
org.apache.thrift.transport.sasl.FrameReader<T>
- Type Parameters:
T
- Header type.
- Direct Known Subclasses:
DataFrameReader
,SaslNegotiationFrameReader
Read frames from a transport. Each frame has a header and a payload. A header will indicate the
size of the payload and other informations about how to decode payload. Implementations should
subclass it by providing a header reader implementation.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Reset the state of the reader so that it can be reused to read a new frame.int
byte[]
int
boolean
boolean
read
(TTransport transport) (Nonblocking) Read available bytes out of the transport without blocking to wait for incoming data.
-
Constructor Details
-
FrameReader
-
-
Method Details
-
read
(Nonblocking) Read available bytes out of the transport without blocking to wait for incoming data.- Parameters:
transport
- TTransport- Returns:
- true if current frame is complete after read.
- Throws:
TSaslNegotiationException
- if fail to read back a valid sasl negotiation message.TTransportException
- if io error.
-
getHeader
- Returns:
- header of the frame
-
getHeaderSize
public int getHeaderSize()- Returns:
- number of bytes of the header
-
getPayload
public byte[] getPayload()- Returns:
- byte array of the payload
-
getPayloadSize
public int getPayloadSize()- Returns:
- size of the payload
-
isComplete
public boolean isComplete()- Returns:
- true if the reader has fully read a frame
-
clear
public void clear()Reset the state of the reader so that it can be reused to read a new frame.
-