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, skip
public 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 DataInput
IOException
public int read() throws IOException
read
in class InputStream
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 final void readFully(byte[] b) throws IOException
readFully
in interface DataInput
IOException
public final void readFully(byte[] a, int aoff, int alen) throws IOException
readFully
in interface DataInput
IOException
public final int read(byte[] a, int aoff, int alen) throws IOException
read
in class InputStream
IOException
public int readInt() throws IOException
readInt
in interface DataInput
IOException
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
public String readUTF() throws IOException
readUTF
in interface DataInput
IOException
public String readUTF2()
readUTF()
which wraps the IOException
.public int readUnsignedByte() throws IOException
readUnsignedByte
in interface DataInput
IOException
public int readUnsignedShort() throws IOException
readUnsignedShort
in interface DataInput
IOException
public int skipBytes(int n) throws IOException
skipBytes
in interface DataInput
IOException
public final int unpackInt() throws IOException
Integer.MAX_VALUE
.IOException
public final long unpackLong() throws IOException
IOException
public final short unpackShort() throws IOException
is
- The input stream.IOException
public long position() throws IOException
position
in interface it.unimi.dsi.fastutil.io.RepositionableStream
IOException
public void position(long v) throws IOException
position
in interface it.unimi.dsi.fastutil.io.RepositionableStream
IOException
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.