public class NonSyncDataInputBuffer
extends java.io.FilterInputStream
implements java.io.DataInput
Constructor and Description |
---|
NonSyncDataInputBuffer()
Constructs a new empty buffer.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.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.
|
java.lang.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. |
java.lang.String |
readUTF()
Reads a UTF format String from this Stream.
|
static java.lang.String |
readUTF(java.io.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. |
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 java.io.IOException
buffer
.
The number of bytes actually read is returned.read
in class java.io.FilterInputStream
buffer
- the buffer to read bytes intojava.io.IOException
- If a problem occurs reading from this DataInputStream.public final int read(byte[] buffer, int offset, int length) throws java.io.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 java.io.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
.java.io.IOException
- If a problem occurs reading from this DataInputStream.public final boolean readBoolean() throws java.io.IOException
readBoolean
in interface java.io.DataInput
java.io.IOException
- If a problem occurs reading from this DataInputStream.public final byte readByte() throws java.io.IOException
readByte
in interface java.io.DataInput
java.io.IOException
- If a problem occurs reading from this DataInputStream.public final char readChar() throws java.io.IOException
readChar
in interface java.io.DataInput
java.io.IOException
public final double readDouble() throws java.io.IOException
double
value from this stream.readDouble
in interface java.io.DataInput
double
value from the source stream.java.io.IOException
- If a problem occurs reading from this DataInputStream.public final float readFloat() throws java.io.IOException
float
value from this stream.readFloat
in interface java.io.DataInput
float
value from the source stream.java.io.IOException
- If a problem occurs reading from this DataInputStream.public final void readFully(byte[] buffer) throws java.io.IOException
buffer
. This
method will block until buffer.length
number of bytes have
been read.readFully
in interface java.io.DataInput
buffer
- to read bytes intojava.io.IOException
- If a problem occurs reading from this DataInputStream.public final void readFully(byte[] buffer, int offset, int length) throws java.io.IOException
buffer
starting at the position offset
. This
method blocks until count
bytes have been read.readFully
in interface java.io.DataInput
buffer
- the byte array into which the data is readoffset
- the offset the operation start atlength
- the maximum number of bytes to readjava.io.IOException
- if a problem occurs while reading from this streamjava.io.EOFException
- if reaches the end of the stream before enough bytes have been
readpublic final int readInt() throws java.io.IOException
readInt
in interface java.io.DataInput
int
value from the source stream.java.io.IOException
- If a problem occurs reading from this DataInputStream.@Deprecated public final java.lang.String readLine() throws java.io.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 java.io.DataInput
java.io.IOException
- If the DataInputStream is already closed or some other IO error
occurs.public final long readLong() throws java.io.IOException
long
value from this stream.readLong
in interface java.io.DataInput
long
value from the source stream.java.io.IOException
- If a problem occurs reading from this DataInputStream.public final short readShort() throws java.io.IOException
short
value from this stream.readShort
in interface java.io.DataInput
short
value from the source stream.java.io.IOException
- If a problem occurs reading from this DataInputStream.public final int readUnsignedByte() throws java.io.IOException
byte
value from this stream and
returns it as an int.readUnsignedByte
in interface java.io.DataInput
java.io.IOException
- If a problem occurs reading from this DataInputStream.public final int readUnsignedShort() throws java.io.IOException
short
value from this stream and
returns it as an int.readUnsignedShort
in interface java.io.DataInput
short
value from the source stream.java.io.IOException
- If a problem occurs reading from this DataInputStream.public final java.lang.String readUTF() throws java.io.IOException
readUTF
in interface java.io.DataInput
java.io.IOException
- If a problem occurs reading from this DataInputStream.public static final java.lang.String readUTF(java.io.DataInput in) throws java.io.IOException
in
.in
- the input stream to read fromjava.io.IOException
- If a problem occurs reading from this DataInputStream.public final int skipBytes(int count) throws java.io.IOException
count
number of bytes in this stream. Subsequent
read()
's will not return these bytes unless
reset()
is used.skipBytes
in interface java.io.DataInput
count
- the number of bytes to skip.java.io.IOException
- If the stream is already closed or another IOException occurs.public static java.lang.String convertUTF8WithBuf(byte[] buf, char[] out, int offset, int utfSize) throws java.io.UTFDataFormatException
java.io.UTFDataFormatException
Copyright © 2012 The Apache Software Foundation