public interface StreamHandle<L extends Location> extends DataHandle<L>
DataHandle.ByteOrderDEFAULT_BLOCK_SIZE, MAX_SEARCH_SIZE| Modifier and Type | Method and Description |
|---|---|
default void |
advance(long bytes)
Increments the handle's offset by the given amount.
|
default void |
close() |
default void |
ensureReadable(long count)
Ensures that the handle has sufficient bytes available to read.
|
default boolean |
ensureWritable(long count)
Ensures that the handle has the correct length to be written to, and
extends it as required.
|
InputStream |
in()
Gets an input stream for reading data, positioned at the current offset.
|
default void |
jump(long n) |
OutputStream |
out()
Gets an output stream for writing data, positioned at the current offset.
|
default int |
read()
Reads the next byte of data from the stream.
|
default int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the stream into an array of
bytes. |
default byte |
readByte() |
void |
resetStream()
Resets the stream to its start.
|
default void |
seek(long pos)
Sets the stream offset, measured from the beginning of the stream, at which
the next read or write occurs.
|
void |
setOffset(long offset)
Sets the offset of the handle to the given position.
|
default void |
write(byte[] b,
int off,
int len) |
default void |
write(int v) |
default void |
writeByte(int v) |
available, checksum, conversionBuffer, exists, findString, findString, findString, findString, getEncoding, getOrder, isBigEndian, isLittleEndian, isReadable, isWritable, lastModified, length, offset, read, readBoolean, readChar, readCString, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readString, readString, readUnsignedByte, readUnsignedShort, readUTF, setEncoding, setLength, setLittleEndian, setOrder, skip, skipBytes, write, writeBoolean, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLine, writeLong, writeShort, writeUTFget, setgetIdentifier, logcontext, getContext, setContextcompareTo, getPriority, setPrioritygetInfo, setInfogetLocationgetVersionInputStream in() throws IOException
IOExceptionOutputStream out() throws IOException
IOExceptionvoid setOffset(long offset)
This method is intended to be called only in conjunction with reading from the input stream, or writing to the output stream. Otherwise, the contents may get out of sync.
default void advance(long bytes)
throws IOException
This method is intended to be called only in conjunction with reading from the input stream, or writing to the output stream. Otherwise, the contents may get out of sync.
IOExceptiondefault void seek(long pos)
throws IOException
DataHandleseek in interface DataHandle<L extends Location>IOExceptionvoid resetStream()
throws IOException
IOException - If something goes wrong with the resetdefault void jump(long n)
throws IOException,
EOFException
IOExceptionEOFExceptiondefault void ensureReadable(long count)
throws IOException
DataHandleensureReadable in interface DataHandle<L extends Location>count - Number of bytes to read.EOFException - If there are insufficient bytes available.IOException - If the handle is write-only, or something goes wrong
with the check.DataHandle.available(long)default boolean ensureWritable(long count)
throws IOException
DataHandleensureWritable in interface DataHandle<L extends Location>count - Number of bytes to write.true if the handle's length was sufficient, or
false if the handle's length required an extension.IOException - If the handle is read-only, or something goes wrong
with the check, or there is an error changing the handle's
length.default int read()
throws IOException
DataHandleread in interface DataHandle<L extends Location>IOException - - if an I/O error occurs.default byte readByte()
throws IOException
readByte in interface DataInputIOExceptiondefault int read(byte[] b,
int off,
int len)
throws IOException
DataHandlelen bytes of data from the stream into an array of
bytes.read in interface DataHandle<L extends Location>IOExceptiondefault void write(int v)
throws IOException
write in interface DataOutputIOExceptiondefault void writeByte(int v)
throws IOException
writeByte in interface DataHandle<L extends Location>writeByte in interface DataOutputIOExceptiondefault void write(byte[] b,
int off,
int len)
throws IOException
write in interface DataOutputIOExceptiondefault void close()
throws IOException
close in interface AutoCloseableclose in interface CloseableIOExceptionCopyright © 2015–2022 SciJava. All rights reserved.