
public class SimpleDataInput extends ByteInputStream implements java.io.DataInput
DataInput which wraps a ByteInput. This implementation maintains
an internal buffer.| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
buffer
The internal buffer.
|
protected int |
limit
The buffer limit.
|
protected int |
position
The buffer position.
|
byteInput| Constructor and Description |
|---|
SimpleDataInput(ByteInput byteInput)
Construct a new instance.
|
SimpleDataInput(int bufferSize)
Construct a new instance which wraps nothing.
|
SimpleDataInput(int bufferSize,
ByteInput byteInput)
Construct a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available()
Returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without
blocking by the next invocation of a method for this input stream.
|
void |
close() |
protected void |
finish()
Finish reading from the current input.
|
int |
read()
Reads the next byte of data from the input stream.
|
int |
read(byte[] b)
Read some bytes from the input stream into the given array.
|
int |
read(byte[] b,
int off,
int len)
Read some bytes from the input stream into the given array.
|
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
int |
readInt() |
protected int |
readIntDirect()
Read an int value.
|
java.lang.String |
readLine() |
long |
readLong() |
protected long |
readLongDirect() |
short |
readShort() |
int |
readUnsignedByte() |
protected int |
readUnsignedByteDirect()
Read an unsigned byte directly.
|
int |
readUnsignedShort() |
java.lang.String |
readUTF() |
long |
skip(long n)
Skips over and discards up to
n bytes of data from this input stream. |
int |
skipBytes(int n) |
protected void |
start(ByteInput byteInput)
Start reading from the given input.
|
protected final byte[] buffer
protected int position
protected int limit
public SimpleDataInput(int bufferSize)
bufferSize - the internal buffer size to usepublic SimpleDataInput(int bufferSize,
ByteInput byteInput)
bufferSize - the internal buffer size to usebyteInput - the byte input to initially wrappublic SimpleDataInput(ByteInput byteInput)
byteInput - the byte input to initially wrappublic int read()
throws java.io.IOException
read in interface ByteInputread in class ByteInputStreamjava.io.IOException - if an error occurspublic int read(byte[] b)
throws java.io.IOException
read in interface ByteInputread in class ByteInputStreamb - the destination arrayjava.io.IOException - if an error occurspublic int read(byte[] b,
int off,
int len)
throws java.io.IOException
read in interface ByteInputread in class ByteInputStreamb - the destination arrayoff - the offset into the array into which data should be readlen - the number of bytes to attempt to fill in the destination arrayjava.io.IOException - if an error occurspublic long skip(long n)
throws java.io.IOException
n bytes of data from this input stream. If the end of stream is reached,
this method returns 0 in order to be consistent with InputStream.skip(long).skip in interface ByteInputskip in class ByteInputStreamn - the number of bytes to attempt to skipjava.io.IOException - if an error occurspublic int available()
throws java.io.IOException
available in interface ByteInputavailable in class ByteInputStreamjava.io.IOException - if an error occurspublic void readFully(byte[] b)
throws java.io.IOException
readFully in interface java.io.DataInputjava.io.IOExceptionpublic void readFully(byte[] b,
int off,
int len)
throws java.io.IOException
readFully in interface java.io.DataInputjava.io.IOExceptionpublic int skipBytes(int n)
throws java.io.IOException
skipBytes in interface java.io.DataInputjava.io.IOExceptionpublic boolean readBoolean()
throws java.io.IOException
readBoolean in interface java.io.DataInputjava.io.IOExceptionpublic byte readByte()
throws java.io.IOException
readByte in interface java.io.DataInputjava.io.IOExceptionpublic int readUnsignedByte()
throws java.io.IOException
readUnsignedByte in interface java.io.DataInputjava.io.IOExceptionpublic short readShort()
throws java.io.IOException
readShort in interface java.io.DataInputjava.io.IOExceptionpublic int readUnsignedShort()
throws java.io.IOException
readUnsignedShort in interface java.io.DataInputjava.io.IOExceptionprotected int readUnsignedByteDirect()
throws java.io.IOException
java.io.IOException - if an error occurspublic char readChar()
throws java.io.IOException
readChar in interface java.io.DataInputjava.io.IOExceptionpublic int readInt()
throws java.io.IOException
readInt in interface java.io.DataInputjava.io.IOExceptionpublic long readLong()
throws java.io.IOException
readLong in interface java.io.DataInputjava.io.IOExceptionprotected long readLongDirect()
throws java.io.IOException
java.io.IOExceptionpublic float readFloat()
throws java.io.IOException
readFloat in interface java.io.DataInputjava.io.IOExceptionprotected int readIntDirect()
throws java.io.IOException
java.io.IOException - if an error occurspublic double readDouble()
throws java.io.IOException
readDouble in interface java.io.DataInputjava.io.IOExceptionpublic java.lang.String readLine()
throws java.io.IOException
readLine in interface java.io.DataInputjava.io.IOExceptionpublic java.lang.String readUTF()
throws java.io.IOException
readUTF in interface java.io.DataInputjava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class ByteInputStreamjava.io.IOExceptionprotected void start(ByteInput byteInput) throws java.io.IOException
byteInput - the new input from which to readjava.io.IOException - not thrown by this implementation, but may be overridden to be thrown if a problem occursprotected void finish()
throws java.io.IOException
java.io.IOException - not thrown by this implementation, but may be overridden to be thrown if a problem occursCopyright © 2011 JBoss, a division of Red Hat, Inc.