|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.scijava.AbstractContextual
org.scijava.plugin.AbstractRichPlugin
org.scijava.plugin.AbstractTypedPlugin<D>
org.scijava.plugin.AbstractWrapperPlugin<L>
org.scijava.io.AbstractDataHandle<L>
public abstract class AbstractDataHandle<L extends Location>
Abstract base class for DataHandle
plugins.
Constructor Summary | |
---|---|
AbstractDataHandle()
|
Method Summary | |
---|---|
String |
findString(boolean saveString,
int blockSize,
String... terminators)
Reads or skips a string ending with one of the given terminating substrings, using the specified block size for buffering. |
String |
findString(boolean saveString,
String... terminators)
Reads or skips a string ending with one of the given terminating substrings. |
String |
findString(int blockSize,
String... terminators)
Reads a string ending with one of the given terminating substrings, using the specified block size for buffering. |
String |
findString(String... terminators)
Reads a string ending with one of the given terminating substrings. |
String |
getEncoding()
Gets the native encoding of the stream. |
ByteOrder |
getOrder()
Returns the current order of the stream. |
boolean |
isLittleEndian()
Gets the endianness of the stream. |
int |
read(byte[] b)
Reads up to b.length bytes of data from the stream into an array of bytes. |
int |
read(ByteBuffer buf)
Reads up to buf.remaining() bytes of data from the stream into a
ByteBuffer . |
int |
read(ByteBuffer buf,
int len)
Reads up to len bytes of data from the stream into a
ByteBuffer . |
String |
readCString()
Reads a string of arbitrary length, terminated by a null char. |
String |
readString(int n)
Reads a string of up to length n. |
String |
readString(String lastChars)
Reads a string ending with one of the characters in the given string. |
void |
setEncoding(String encoding)
Sets the native encoding of the stream. |
void |
setOrder(boolean little)
Sets the endianness of the stream. |
void |
setOrder(ByteOrder order)
Sets the byte order of the stream. |
long |
skip(long n)
Skips over and discards n bytes of data from the stream. |
void |
write(ByteBuffer buf)
Writes up to buf.remaining() bytes of data from the given
ByteBuffer to the stream. |
void |
write(ByteBuffer buf,
int len)
Writes up to len bytes of data from the given ByteBuffer to the stream. |
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 |
---|
compareTo, getInfo, getPriority, setInfo, setPriority, toString |
Methods inherited from class org.scijava.AbstractContextual |
---|
context, getContext, setContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.scijava.io.DataHandle |
---|
length, offset, read, read, seek |
Methods inherited from interface org.scijava.plugin.WrapperPlugin |
---|
get, set |
Methods inherited from interface org.scijava.Contextual |
---|
context, getContext, setContext |
Methods inherited from interface org.scijava.Prioritized |
---|
getPriority, setPriority |
Methods inherited from interface java.lang.Comparable |
---|
compareTo |
Methods inherited from interface org.scijava.plugin.HasPluginInfo |
---|
getInfo, setInfo |
Methods inherited from interface org.scijava.Typed |
---|
getType, supports |
Methods inherited from interface java.io.DataInput |
---|
readBoolean, readByte, readChar, readDouble, readFloat, readFully, readFully, readInt, readLine, readLong, readShort, readUnsignedByte, readUnsignedShort, readUTF, skipBytes |
Methods inherited from interface java.io.DataOutput |
---|
write, write, write, writeBoolean, writeByte, writeBytes, writeChar, writeChars, writeDouble, writeFloat, writeInt, writeLong, writeShort, writeUTF |
Methods inherited from interface java.io.Closeable |
---|
close |
Constructor Detail |
---|
public AbstractDataHandle()
Method Detail |
---|
public ByteOrder getOrder()
DataHandle
getOrder
in interface DataHandle<L extends Location>
public boolean isLittleEndian()
DataHandle
isLittleEndian
in interface DataHandle<L extends Location>
public void setOrder(ByteOrder order)
DataHandle
setOrder
in interface DataHandle<L extends Location>
order
- Order to set.public void setOrder(boolean little)
DataHandle
setOrder
in interface DataHandle<L extends Location>
public String getEncoding()
DataHandle
getEncoding
in interface DataHandle<L extends Location>
public void setEncoding(String encoding)
DataHandle
setEncoding
in interface DataHandle<L extends Location>
public int read(ByteBuffer buf) throws IOException
DataHandle
buf.remaining()
bytes of data from the stream into a
ByteBuffer
.
read
in interface DataHandle<L extends Location>
IOException
public int read(ByteBuffer buf, int len) throws IOException
DataHandle
len
bytes of data from the stream into a
ByteBuffer
.
read
in interface DataHandle<L extends Location>
IOException
public void write(ByteBuffer buf) throws IOException
DataHandle
buf.remaining()
bytes of data from the given
ByteBuffer
to the stream.
write
in interface DataHandle<L extends Location>
IOException
public void write(ByteBuffer buf, int len) throws IOException
DataHandle
write
in interface DataHandle<L extends Location>
IOException
public String readCString() throws IOException
DataHandle
readCString
in interface DataHandle<L extends Location>
IOException
public String readString(int n) throws IOException
DataHandle
readString
in interface DataHandle<L extends Location>
IOException
public String readString(String lastChars) throws IOException
DataHandle
readString
in interface DataHandle<L extends Location>
IOException
DataHandle.findString(String...)
public String findString(String... terminators) throws IOException
DataHandle
findString
in interface DataHandle<L extends Location>
terminators
- The strings for which to search.
IOException
public String findString(boolean saveString, String... terminators) throws IOException
DataHandle
findString
in interface DataHandle<L extends Location>
saveString
- Whether to collect the string from the current file
pointer to the terminating bytes, and return it. If false, returns
null.terminators
- The strings for which to search.
IOException
- If saveString flag is set and the maximum search length
(512 MB) is exceeded.public String findString(int blockSize, String... terminators) throws IOException
DataHandle
findString
in interface DataHandle<L extends Location>
blockSize
- The block size to use when reading bytes in chunks.terminators
- The strings for which to search.
IOException
public String findString(boolean saveString, int blockSize, String... terminators) throws IOException
DataHandle
findString
in interface DataHandle<L extends Location>
saveString
- Whether to collect the string from the current file
pointer to the terminating bytes, and return it. If false, returns
null.blockSize
- The block size to use when reading bytes in chunks.terminators
- The strings for which to search.
IOException
- If saveString flag is set and the maximum search length
(512 MB) is exceeded.public int read(byte[] b) throws IOException
DataHandle
read
in interface DataHandle<L extends Location>
IOException
public long skip(long n) throws IOException
DataHandle
n
bytes of data from the stream. The
skip
method may, for a variety of reasons, end up skipping over
some smaller number of bytes, possibly 0
. This may result from any
of a number of conditions; reaching end of file before n
bytes have
been skipped is only one possibility. The actual number of bytes skipped is
returned. If n
is negative, no bytes are skipped.
skip
in interface DataHandle<L extends Location>
n
- - the number of bytes to be skipped.
IOException
- - if an I/O error occurs.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |