public final class ReadUtil extends Object
Modifier and Type | Method and Description |
---|---|
static boolean |
eofIsNext(ByteBuffer byteBuffer)
Checks whether the next stream is EOF.
|
static boolean |
isErrorPacket(ByteBuffer byteBuffer) |
static void |
readFully(InputStream stream,
byte[] bytes) |
static void |
readFully(InputStream stream,
byte[] bytes,
int off,
int len)
Read a number of bytes from the stream and store it in the buffer, and fix the problem with "incomplete" reads by
doing another read if we don't have all of the data yet.
|
public static void readFully(InputStream stream, byte[] bytes, int off, int len) throws IOException
stream
- the input stream to read frombytes
- buffer where to store the dataoff
- offset in the bufferlen
- bytes to readIOException
- if an error occurs while reading the stream.
java.io.EOFException of end of stream is hit.public static void readFully(InputStream stream, byte[] bytes) throws IOException
IOException
public static boolean eofIsNext(ByteBuffer byteBuffer)
byteBuffer
- the raw streampublic static boolean isErrorPacket(ByteBuffer byteBuffer)
Copyright © 2016. All rights reserved.