public class DataInputBuffer extends InputStream implements DataInput, it.unimi.dsi.fastutil.io.RepositionableStream
DataOutputBuffer,
DataInputStream| Constructor and Description |
|---|
DataInputBuffer(byte[] buf)
Prepare for reading from the byte[].
|
DataInputBuffer(byte[] buf,
int off,
int len)
Prepare for reading from the byte[].
|
DataInputBuffer(ByteArrayBuffer buf)
Prepare for reading from the buffer.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getBuffer()
Return the backing buffer.
|
int |
getOrigin()
The origin (original offset) associated with the backing buffer.
|
long |
position()
Report the position of the stream within its slice (relative to the
original offset for the backing buffer)
|
void |
position(long v)
Reposition the stream within its slice (relative to the original offset
for the backing buffer).
|
int |
read() |
int |
read(byte[] a,
int aoff,
int alen)
Overridden for more efficiency.
|
boolean |
readBoolean() |
byte |
readByte() |
char |
readChar() |
double |
readDouble() |
float |
readFloat() |
void |
readFully(byte[] b) |
void |
readFully(byte[] a,
int aoff,
int alen) |
int |
readInt() |
String |
readLine() |
long |
readLong() |
short |
readShort() |
int |
readUnsignedByte() |
int |
readUnsignedShort() |
String |
readUTF() |
String |
readUTF2()
Variant of
readUTF() which wraps the IOException. |
void |
setBuffer(byte[] buf)
Replaces the buffer and resets the offset to zero (0).
|
void |
setBuffer(byte[] buf,
int off,
int len)
Replaces the buffer and reset the offset and length to the specified
values.
|
void |
setBuffer(ByteArrayBuffer buf)
Replaces the buffer reference with
ByteArrayBuffer.array() and
resets the offset and length to the ByteArrayBuffer.pos() and the
ByteArrayBuffer.limit() respectively. |
int |
skipBytes(int n) |
int |
unpackInt()
Convenience method unpacks long and throws an exception if the value
exceeds
Integer.MAX_VALUE. |
long |
unpackLong()
Unpack a long value from the current buffer position.
|
short |
unpackShort()
Unpack a non-negative short value from the input stream.
|
available, close, mark, markSupported, read, reset, skippublic DataInputBuffer(byte[] buf)
buf - The source data.public DataInputBuffer(byte[] buf,
int off,
int len)
buf - The source data.off - The offset of the first byte to be read.len - The #of bytes available.public DataInputBuffer(ByteArrayBuffer buf)
ByteArrayBuffer.pos() and the ByteArrayBuffer.limit()
will be read.buf - The buffer.public void setBuffer(byte[] buf)
buf - The new buffer.public byte[] getBuffer()
public void setBuffer(byte[] buf,
int off,
int len)
buf - The new buffer.off - len - public void setBuffer(ByteArrayBuffer buf)
ByteArrayBuffer.array() and
resets the offset and length to the ByteArrayBuffer.pos() and the
ByteArrayBuffer.limit() respectively.buf - The buffer.public int getOrigin()
public boolean readBoolean()
throws IOException
readBoolean in interface DataInputIOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic byte readByte()
throws IOException
readByte in interface DataInputIOExceptionpublic char readChar()
throws IOException
readChar in interface DataInputIOExceptionpublic double readDouble()
throws IOException
readDouble in interface DataInputIOExceptionpublic float readFloat()
throws IOException
readFloat in interface DataInputIOExceptionpublic final void readFully(byte[] b)
throws IOException
readFully in interface DataInputIOExceptionpublic final void readFully(byte[] a,
int aoff,
int alen)
throws IOException
readFully in interface DataInputIOExceptionpublic final int read(byte[] a,
int aoff,
int alen)
throws IOException
read in class InputStreamIOExceptionpublic int readInt()
throws IOException
readInt in interface DataInputIOExceptionpublic String readLine() throws IOException
readLine in interface DataInputIOExceptionpublic long readLong()
throws IOException
readLong in interface DataInputIOExceptionpublic short readShort()
throws IOException
readShort in interface DataInputIOExceptionpublic String readUTF() throws IOException
readUTF in interface DataInputIOExceptionpublic String readUTF2()
readUTF() which wraps the IOException.public int readUnsignedByte()
throws IOException
readUnsignedByte in interface DataInputIOExceptionpublic int readUnsignedShort()
throws IOException
readUnsignedShort in interface DataInputIOExceptionpublic int skipBytes(int n)
throws IOException
skipBytes in interface DataInputIOExceptionpublic final int unpackInt()
throws IOException
Integer.MAX_VALUE.IOExceptionpublic final long unpackLong()
throws IOException
IOExceptionpublic final short unpackShort()
throws IOException
is - The input stream.IOExceptionpublic long position()
throws IOException
position in interface it.unimi.dsi.fastutil.io.RepositionableStreamIOExceptionpublic void position(long v)
throws IOException
position in interface it.unimi.dsi.fastutil.io.RepositionableStreamIOExceptionCopyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.