public abstract class NioByteStoreAccess extends java.lang.Object implements ByteStoreAccess
Constructor and Description |
---|
NioByteStoreAccess() |
Modifier and Type | Method and Description |
---|---|
static java.nio.ByteBuffer[] |
copyBuffers(java.nio.ByteBuffer[] bufs)
Utility method to make a deep copy of an array of ByteBuffers.
|
static ByteStoreAccess |
createAccess(java.nio.ByteBuffer[] bbufs)
Returns a reader implementation for an array of ByteBuffers.
|
protected abstract java.nio.ByteBuffer |
getBuffer(int nbyte)
Returns a buffer with at least the requested number of bytes
between the current position and the limit.
|
byte |
readByte()
Reads a byte from the current position.
|
void |
readBytes(byte[] b,
int offset,
int length)
Reads bytes into a buffer from the current position.
|
char |
readChar()
Reads a char from the current position.
|
double |
readDouble()
Reads a double from the current position.
|
float |
readFloat()
Reads a float from the current position.
|
int |
readInt()
Reads an int from the current position.
|
long |
readLong()
Reads a long from the current position.
|
short |
readShort()
Reads a short from the current position.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
seek, skip
protected abstract java.nio.ByteBuffer getBuffer(int nbyte) throws java.io.IOException
nbyte
bytes have been read from the returned
buffer, the current position of this ByteStoreAccess will have
advanced by nbyte
bytes. The position in the case
that this call is made with no corresponding read is undefined,
so it's important that the read is actually done (don't call
this method speculatively).
If no such buffer is available (the end of the storage has been reached), then an IOException will be thrown.
nbyte
- number of bytes requirednbyte
bytes can be readjava.io.IOException
public byte readByte() throws java.io.IOException
ByteStoreAccess
readByte
in interface ByteStoreAccess
java.io.IOException
public short readShort() throws java.io.IOException
ByteStoreAccess
readShort
in interface ByteStoreAccess
java.io.IOException
public char readChar() throws java.io.IOException
ByteStoreAccess
readChar
in interface ByteStoreAccess
java.io.IOException
public int readInt() throws java.io.IOException
ByteStoreAccess
readInt
in interface ByteStoreAccess
java.io.IOException
public long readLong() throws java.io.IOException
ByteStoreAccess
readLong
in interface ByteStoreAccess
java.io.IOException
public float readFloat() throws java.io.IOException
ByteStoreAccess
readFloat
in interface ByteStoreAccess
java.io.IOException
public double readDouble() throws java.io.IOException
ByteStoreAccess
readDouble
in interface ByteStoreAccess
java.io.IOException
public void readBytes(byte[] b, int offset, int length) throws java.io.IOException
ByteStoreAccess
readBytes
in interface ByteStoreAccess
b
- buffer to receive bytesoffset
- offset into b
for first bytelength
- number of bytes to readjava.io.IOException
public static java.nio.ByteBuffer[] copyBuffers(java.nio.ByteBuffer[] bufs)
bufs
- input bufferspublic static ByteStoreAccess createAccess(java.nio.ByteBuffer[] bbufs)
bbufs
- buffer array