public interface IRandomAccess extends DataInput, DataOutput
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes this random access stream and releases
any system resources associated with the stream.
|
boolean |
exists()
Returns whether this refers to a valid object
|
long |
getFilePointer()
Returns the current offset in this stream.
|
ByteOrder |
getOrder()
Returns the current order (endianness) of the stream.
|
long |
length()
Returns the length of this stream.
|
int |
read(byte[] b)
Reads up to b.length bytes of data
from this stream into an array of bytes.
|
int |
read(byte[] b,
int off,
int len)
Reads up to len bytes of data from this stream into an array of bytes.
|
int |
read(ByteBuffer buffer)
Reads up to buffer.capacity() bytes of data
from this stream into a ByteBuffer.
|
int |
read(ByteBuffer buffer,
int offset,
int len)
Reads up to len bytes of data from this stream into a ByteBuffer.
|
void |
seek(long pos)
Sets the stream pointer offset, measured from the beginning
of this stream, at which the next read or write occurs.
|
void |
setOrder(ByteOrder order)
Sets the byte order (endianness) of the stream.
|
long |
skipBytes(long n)
A
long variant of DataInput.skipBytes(int) . |
void |
write(ByteBuffer buf)
Writes up to buffer.capacity() bytes of data from the given
ByteBuffer to this stream.
|
void |
write(ByteBuffer buf,
int off,
int len)
Writes up to len bytes of data from the given ByteBuffer to this
stream.
|
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF
void close() throws IOException
IOException
- if the underlying stream(s) could not be closedlong getFilePointer() throws IOException
IOException
- if the offset cannot be retrievedboolean exists() throws IOException
IOException
- if unable to determine whether the object is validlong length() throws IOException
IOException
- if the length cannot be retrievedByteOrder getOrder()
void setOrder(ByteOrder order)
order
- Order to set.int read(byte[] b) throws IOException
b
- the array to fill from this streamIOException
- if reading is not possibleint read(byte[] b, int off, int len) throws IOException
b
- the array to fill from this streamoff
- the offset in b
from which to start filling;
expected to be non-negative and no greater than
b.length - len
len
- the number of bytes to read; expected to be positive and
no greater than b.length - offset
IOException
- if reading is not possibleint read(ByteBuffer buffer) throws IOException
buffer
- the ByteBuffer to fill from this streamIOException
- if reading is not possibleint read(ByteBuffer buffer, int offset, int len) throws IOException
buffer
- the ByteBuffer to fill from this streamoffset
- the offset in b
from which to start filling;
expected to be non-negative and no greater than
buffer.capacity() - len
len
- the number of bytes to read; expected to be positive and
no greater than buffer.capacity() - offset
IOException
- if reading is not possiblevoid seek(long pos) throws IOException
pos
- new byte offset (pointer) in the current stream.
Unless otherwise noted, may be larger or smaller than the
current pointer, but must be non-negative and less than the
value of #length()IOException
- if pos
is invalid or the seek failsgetFilePointer()
long skipBytes(long n) throws IOException
long
variant of DataInput.skipBytes(int)
.n
- the number of bytes to skipIOException
- if the operation failedvoid write(ByteBuffer buf) throws IOException
buf
- the ByteBuffer containing bytes to write to this streamIOException
- if writing is not possiblevoid write(ByteBuffer buf, int off, int len) throws IOException
buf
- the ByteBuffer containing bytes to write to this streamoff
- the offset in b
from which to start writing;
expected to be non-negative and no greater than
buf.capacity() - len
len
- the number of bytes to write; expected to be positive and
no greater than buf.capacity() - offset
IOException
- if writing is not possibleCopyright © 2005–2019 Open Microscopy Environment. All rights reserved.