public class NonSyncDataInputBuffer extends FilterInputStream implements DataInput
in
Constructor and Description |
---|
NonSyncDataInputBuffer()
Constructs a new empty buffer.
|
Modifier and Type | Method and Description |
---|---|
static String |
convertUTF8WithBuf(byte[] buf,
char[] out,
int offset,
int utfSize) |
int |
getLength()
Returns the length of the input.
|
int |
getPosition()
Returns the current position in the input.
|
int |
read(byte[] buffer)
Reads bytes from the source stream into the byte array
buffer . |
int |
read(byte[] buffer,
int offset,
int length)
Read at most
length bytes from this DataInputStream and stores
them in byte array buffer starting at offset . |
boolean |
readBoolean()
Reads a boolean from this stream.
|
byte |
readByte()
Reads an 8-bit byte value from this stream.
|
char |
readChar() |
double |
readDouble()
Reads a 64-bit
double value from this stream. |
float |
readFloat()
Reads a 32-bit
float value from this stream. |
void |
readFully(byte[] buffer)
Reads bytes from this stream into the byte array
buffer . |
void |
readFully(byte[] buffer,
int offset,
int length)
Reads bytes from this stream and stores them in the byte array
buffer starting at the position offset . |
int |
readInt()
Reads a 32-bit integer value from this stream.
|
String |
readLine()
Deprecated.
Use BufferedReader
|
long |
readLong()
Reads a 64-bit
long value from this stream. |
short |
readShort()
Reads a 16-bit
short value from this stream. |
int |
readUnsignedByte()
Reads an unsigned 8-bit
byte value from this stream and
returns it as an int. |
int |
readUnsignedShort()
Reads a 16-bit unsigned
short value from this stream and
returns it as an int. |
String |
readUTF()
Reads a UTF format String from this Stream.
|
static String |
readUTF(DataInput in)
Reads a UTF format String from the DataInput Stream
in . |
void |
reset(byte[] input,
int length)
Resets the data that the buffer reads.
|
void |
reset(byte[] input,
int start,
int length)
Resets the data that the buffer reads.
|
int |
skipBytes(int count)
Skips
count number of bytes in this stream. |
available, close, mark, markSupported, read, reset, skip
public NonSyncDataInputBuffer()
public void reset(byte[] input, int length)
public void reset(byte[] input, int start, int length)
public int getPosition()
public int getLength()
public final int read(byte[] buffer) throws IOException
buffer
.
The number of bytes actually read is returned.read
in class FilterInputStream
buffer
- the buffer to read bytes intoIOException
- If a problem occurs reading from this DataInputStream.public final int read(byte[] buffer, int offset, int length) throws IOException
length
bytes from this DataInputStream and stores
them in byte array buffer
starting at offset
.
Answer the number of bytes actually read or -1 if no bytes were read and
end of stream was encountered.read
in class FilterInputStream
buffer
- the byte array in which to store the read bytes.offset
- the offset in buffer
to store the read bytes.length
- the maximum number of bytes to store in buffer
.IOException
- If a problem occurs reading from this DataInputStream.public final boolean readBoolean() throws IOException
readBoolean
in interface DataInput
IOException
- If a problem occurs reading from this DataInputStream.public final byte readByte() throws IOException
readByte
in interface DataInput
IOException
- If a problem occurs reading from this DataInputStream.public final char readChar() throws IOException
readChar
in interface DataInput
IOException
public final double readDouble() throws IOException
double
value from this stream.readDouble
in interface DataInput
double
value from the source stream.IOException
- If a problem occurs reading from this DataInputStream.public final float readFloat() throws IOException
float
value from this stream.readFloat
in interface DataInput
float
value from the source stream.IOException
- If a problem occurs reading from this DataInputStream.public final void readFully(byte[] buffer) throws IOException
buffer
. This
method will block until buffer.length
number of bytes have
been read.readFully
in interface DataInput
buffer
- to read bytes intoIOException
- If a problem occurs reading from this DataInputStream.public final void readFully(byte[] buffer, int offset, int length) throws IOException
buffer
starting at the position offset
. This
method blocks until count
bytes have been read.readFully
in interface DataInput
buffer
- the byte array into which the data is readoffset
- the offset the operation start atlength
- the maximum number of bytes to readIOException
- if a problem occurs while reading from this streamEOFException
- if reaches the end of the stream before enough bytes have been
readpublic final int readInt() throws IOException
readInt
in interface DataInput
int
value from the source stream.IOException
- If a problem occurs reading from this DataInputStream.@Deprecated public final String readLine() throws IOException
String
representing the next line of text available
in this BufferedReader. A line is represented by 0 or more characters
followed by '\n'
, '\r'
, "\n\r"
or
end of stream. The String
does not include the newline
sequence.readLine
in interface DataInput
IOException
- If the DataInputStream is already closed or some other IO error
occurs.public final long readLong() throws IOException
long
value from this stream.readLong
in interface DataInput
long
value from the source stream.IOException
- If a problem occurs reading from this DataInputStream.public final short readShort() throws IOException
short
value from this stream.readShort
in interface DataInput
short
value from the source stream.IOException
- If a problem occurs reading from this DataInputStream.public final int readUnsignedByte() throws IOException
byte
value from this stream and
returns it as an int.readUnsignedByte
in interface DataInput
IOException
- If a problem occurs reading from this DataInputStream.public final int readUnsignedShort() throws IOException
short
value from this stream and
returns it as an int.readUnsignedShort
in interface DataInput
short
value from the source stream.IOException
- If a problem occurs reading from this DataInputStream.public final String readUTF() throws IOException
readUTF
in interface DataInput
IOException
- If a problem occurs reading from this DataInputStream.public static final String readUTF(DataInput in) throws IOException
in
.in
- the input stream to read fromIOException
- If a problem occurs reading from this DataInputStream.public final int skipBytes(int count) throws IOException
count
number of bytes in this stream. Subsequent
read()
's will not return these bytes unless
reset()
is used.skipBytes
in interface DataInput
count
- the number of bytes to skip.IOException
- If the stream is already closed or another IOException occurs.public static String convertUTF8WithBuf(byte[] buf, char[] out, int offset, int utfSize) throws UTFDataFormatException
UTFDataFormatException
Copyright © 2017 The Apache Software Foundation. All rights reserved.