public class ReadPacketFetcher extends Object
Modifier and Type | Field and Description |
---|---|
static int |
AVOID_CREATE_BUFFER_LENGTH |
Constructor and Description |
---|
ReadPacketFetcher(InputStream is) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
InputStream |
getInputStream() |
int |
getLastPacketSeq() |
Buffer |
getPacket()
Get buffer packet.
|
int |
getPacketLength()
Get next packet length.
|
Buffer |
getReusableBuffer()
Get buffer with shared array.
|
Buffer |
getReusableBuffer(int length,
byte[] lastReusableArray)
Get buffer with shared array of designated length.
|
byte[] |
readLength(int length)
Read buffer without reading the length packet first.
|
public static final int AVOID_CREATE_BUFFER_LENGTH
public ReadPacketFetcher(InputStream is)
public int getPacketLength() throws IOException
IOException
- if anypublic Buffer getPacket() throws IOException
IOException
- if anypublic Buffer getReusableBuffer(int length, byte[] lastReusableArray) throws IOException
length
- length to readlastReusableArray
- (optional) lastReusableArray to avoid create new array if possibleIOException
- if anypublic Buffer getReusableBuffer() throws IOException
IOException
- if anypublic int getLastPacketSeq()
public void close() throws IOException
IOException
public InputStream getInputStream()
public byte[] readLength(int length) throws IOException
length
- data to readIOException
- if any error occurCopyright © 2016. All rights reserved.