Package org.scijava.io.handle
Class BytesHandle
-
- All Implemented Interfaces:
Closeable,DataInput,DataOutput,AutoCloseable,Comparable<Prioritized>,Contextual,Identifiable,DataHandle<BytesLocation>,Locatable,Logged,HasPluginInfo,RichPlugin,SciJavaPlugin,TypedPlugin<BytesLocation>,WrapperPlugin<BytesLocation>,Prioritized,Typed<BytesLocation>,Versioned
public class BytesHandle extends AbstractDataHandle<BytesLocation>
DataHandlefor aBytesLocation.- Author:
- Curtis Rueden, Melissa Linkert, Gabriel Einsdorf
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.scijava.io.handle.DataHandle
DataHandle.ByteOrder
-
-
Field Summary
-
Fields inherited from interface org.scijava.io.handle.DataHandle
DEFAULT_BLOCK_SIZE, MAX_SEARCH_SIZE
-
-
Constructor Summary
Constructors Constructor Description BytesHandle()BytesHandle(BytesLocation location)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()booleanexists()Tests whether this handle's location actually exists at the source.Class<BytesLocation>getType()Gets the type associated with the object.booleanisReadable()Gets whether reading from this handle is supported.booleanisWritable()Gets whether writing to this handle is supported.longlength()Returns the length of the data in bytes.longoffset()Returns the current offset in the stream.intread(byte[] b, int off, int len)Reads up tolenbytes of data from the stream into an array of bytes.bytereadByte()voidreadFully(byte[] b, int off, int len)voidseek(long pos)Sets the stream offset, measured from the beginning of the stream, at which the next read or write occurs.voidsetLength(long length)Sets the new length of the handle.voidwrite(byte[] b, int off, int len)voidwrite(int b)-
Methods inherited from class org.scijava.io.handle.AbstractDataHandle
conversionBuffer, getEncoding, getOrder, setEncoding, setOrder
-
Methods inherited from class org.scijava.plugin.AbstractWrapperPlugin
get, set
-
Methods inherited from class org.scijava.plugin.AbstractTypedPlugin
supports
-
Methods inherited from class org.scijava.plugin.AbstractRichPlugin
getInfo, getPriority, setInfo, setPriority, toString
-
Methods inherited from class org.scijava.AbstractContextual
context, getContext
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.scijava.Contextual
context, getContext, setContext
-
Methods inherited from interface org.scijava.io.handle.DataHandle
available, checksum, ensureReadable, ensureWritable, findString, findString, findString, findString, isBigEndian, isLittleEndian, lastModified, read, read, readBoolean, readChar, readCString, readDouble, readFloat, readFully, readInt, readLine, readLong, readShort, readString, readString, readUnsignedByte, readUnsignedShort, readUTF, setLittleEndian, skip, skipBytes, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLine, writeLong, writeShort, writeUTF
-
Methods inherited from interface org.scijava.plugin.HasPluginInfo
getInfo, setInfo
-
Methods inherited from interface org.scijava.Locatable
getLocation
-
Methods inherited from interface org.scijava.Prioritized
compareTo, getPriority, setPriority
-
Methods inherited from interface org.scijava.plugin.RichPlugin
getIdentifier, log
-
Methods inherited from interface org.scijava.Versioned
getVersion
-
Methods inherited from interface org.scijava.plugin.WrapperPlugin
get, set
-
-
-
-
Constructor Detail
-
BytesHandle
public BytesHandle()
-
BytesHandle
public BytesHandle(BytesLocation location)
-
-
Method Detail
-
isReadable
public boolean isReadable()
Description copied from interface:DataHandleGets whether reading from this handle is supported.
-
isWritable
public boolean isWritable()
Description copied from interface:DataHandleGets whether writing to this handle is supported.
-
exists
public boolean exists()
Description copied from interface:DataHandleTests whether this handle's location actually exists at the source.- Returns:
- True if the location exists; false if not.
-
offset
public long offset()
Description copied from interface:DataHandleReturns the current offset in the stream.
-
length
public long length()
Description copied from interface:DataHandleReturns the length of the data in bytes.- Returns:
- The length, or -1 if the length is unknown.
-
setLength
public void setLength(long length) throws IOExceptionDescription copied from interface:DataHandleSets the new length of the handle.- Parameters:
length- New length.- Throws:
IOException- If there is an error changing the handle's length.
-
read
public int read(byte[] b, int off, int len) throws IOExceptionDescription copied from interface:DataHandleReads up tolenbytes of data from the stream into an array of bytes.- Returns:
- the total number of bytes read into the buffer.
- Throws:
IOException
-
seek
public void seek(long pos) throws IOExceptionDescription copied from interface:DataHandleSets the stream offset, measured from the beginning of the stream, at which the next read or write occurs.- Throws:
IOException
-
readByte
public byte readByte() throws IOException- Throws:
IOException
-
readFully
public void readFully(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
write
public void write(int b) throws IOException- Throws:
IOException
-
close
public void close()
-
getType
public Class<BytesLocation> getType()
Description copied from interface:TypedGets the type associated with the object.
-
-