public class DataInputDeserializer extends Object implements DataInputView, Serializable
DataInput
interface.Constructor and Description |
---|
DataInputDeserializer() |
DataInputDeserializer(byte[] buffer) |
DataInputDeserializer(byte[] buffer,
int start,
int len) |
DataInputDeserializer(ByteBuffer buffer) |
Modifier and Type | Method and Description |
---|---|
int |
available() |
int |
getPosition() |
int |
read(byte[] b)
Tries to fill the given byte array
b . |
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of memory and stores it into b starting at offset
off . |
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
String |
readLine() |
long |
readLong() |
String |
readLongUTF()
Similar to
readUTF() . |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
String |
readUTF() |
void |
releaseArrays() |
void |
setBuffer(byte[] buffer) |
void |
setBuffer(byte[] buffer,
int start,
int len) |
void |
setBuffer(ByteBuffer buffer) |
int |
skipBytes(int n) |
void |
skipBytesToRead(int numBytes)
Skips
numBytes bytes of memory. |
public DataInputDeserializer()
public DataInputDeserializer(@Nonnull byte[] buffer)
public DataInputDeserializer(@Nonnull byte[] buffer, int start, int len)
public DataInputDeserializer(@Nonnull ByteBuffer buffer)
public void setBuffer(@Nonnull ByteBuffer buffer)
public void setBuffer(@Nonnull byte[] buffer, int start, int len)
public void setBuffer(@Nonnull byte[] buffer)
public void releaseArrays()
public int available()
public boolean readBoolean() throws IOException
readBoolean
in interface DataInput
IOException
public byte readByte() throws IOException
readByte
in interface DataInput
IOException
public char readChar() throws IOException
readChar
in interface DataInput
IOException
public double readDouble() throws IOException
readDouble
in interface DataInput
IOException
public float readFloat() throws IOException
readFloat
in interface DataInput
IOException
public void readFully(@Nonnull byte[] b) throws IOException
readFully
in interface DataInput
IOException
public void readFully(@Nonnull byte[] b, int off, int len) throws IOException
readFully
in interface DataInput
IOException
public int readInt() throws IOException
readInt
in interface DataInput
IOException
@Nullable public String readLine() throws IOException
readLine
in interface DataInput
IOException
public long readLong() throws IOException
readLong
in interface DataInput
IOException
public short readShort() throws IOException
readShort
in interface DataInput
IOException
@Nonnull public String readUTF() throws IOException
readUTF
in interface DataInput
IOException
public String readLongUTF() throws IOException
readUTF()
. The size is stored in the manner of the readInt()
method, the character conversion is the same.EOFException
- – if this stream reaches the end before reading all the bytes.IOException
- – if an I/O error occurs.UTFDataFormatException
- – if the bytes do not represent a valid modified UTF-8
encoding of a string.public int readUnsignedByte() throws IOException
readUnsignedByte
in interface DataInput
IOException
public int readUnsignedShort() throws IOException
readUnsignedShort
in interface DataInput
IOException
public void skipBytesToRead(int numBytes) throws IOException
DataInputView
numBytes
bytes of memory. In contrast to the DataInput.skipBytes(int)
method,
this method always skips the desired number of bytes or throws an EOFException
.skipBytesToRead
in interface DataInputView
numBytes
- The number of bytes to skip.IOException
- Thrown, if any I/O related problem occurred such that the input could not
be advanced to the desired position.public int read(@Nonnull byte[] b, int off, int len) throws IOException
DataInputView
len
bytes of memory and stores it into b
starting at offset
off
.
If len
is zero, then no bytes are read and 0
is returned;
otherwise, there is an attempt to read at least one byte. If there is no more data left, the
value -1
is returned; otherwise, at least one byte is read and stored into
b
.
read
in interface DataInputView
b
- byte array to store the data tooff
- offset into byte arraylen
- byte length to readIOException
public int read(@Nonnull byte[] b) throws IOException
DataInputView
b
. Returns the actually number of read bytes or -1
if there is no more data.read
in interface DataInputView
b
- byte array to store the data toIOException
public int getPosition()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.