Package org.scijava.download
Class MultiWriteHandle
- java.lang.Object
-
- org.scijava.AbstractContextual
-
- org.scijava.plugin.AbstractRichPlugin
-
- org.scijava.plugin.AbstractTypedPlugin<D>
-
- org.scijava.plugin.AbstractWrapperPlugin<L>
-
- org.scijava.io.handle.AbstractDataHandle<Location>
-
- org.scijava.download.MultiWriteHandle
-
- All Implemented Interfaces:
Closeable,DataInput,DataOutput,AutoCloseable,Comparable<Prioritized>,Contextual,Identifiable,DataHandle<Location>,Locatable,Logged,HasPluginInfo,RichPlugin,SciJavaPlugin,TypedPlugin<Location>,WrapperPlugin<Location>,Prioritized,Typed<Location>,Versioned
public class MultiWriteHandle extends AbstractDataHandle<Location>
DataHandleplugin for writing to multipleDataHandles.- Author:
- Curtis Rueden
-
-
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 MultiWriteHandle(DataHandle<?>... handles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringchecksum()Gets a "fast" checksum which succinctly represents the contents of the data stream.voidclose()booleanexists()Tests whether this handle's location actually exists at the source.Class<Location>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.DatelastModified()Gets the last modified timestamp of the location.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()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, ensureReadable, ensureWritable, findString, findString, findString, findString, isBigEndian, isLittleEndian, read, read, readBoolean, readChar, readCString, readDouble, readFloat, readFully, 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
-
MultiWriteHandle
public MultiWriteHandle(DataHandle<?>... handles)
-
-
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() throws IOExceptionDescription copied from interface:DataHandleTests whether this handle's location actually exists at the source.- Returns:
- True if the location exists; false if not.
- Throws:
IOException- If something goes wrong with the existence check.
-
lastModified
public Date lastModified() throws IOException
Description copied from interface:DataHandleGets the last modified timestamp of the location.- Returns:
- The last modified timestamp, or null if the handle does not support this feature or if the location does not exist.
- Throws:
IOException- If something goes wrong with the last modified check.
-
checksum
public String checksum() throws IOException
Description copied from interface:DataHandleGets a "fast" checksum which succinctly represents the contents of the data stream. The term "fast" here refers to the idea that the checksum be retrievable quickly, without actually performing a thorough computation across the entire data stream. Typically, such a thing is feasible because the checksum was calculated a priori; e.g., artifacts deployed to remote Maven repositories are always deployed with corresponding checksum files.No guarantee is made about the exact nature of the checksum (e.g., SHA-1 or MD5), only that the value is deterministic for this particular location with its current contents. In other words: if a checksum differs from a previous inquiry, you can be sure the contents have changed; conversely, if the checksum is still the same, the contents are highly likely to be unchanged.
- Returns:
- The checksum, or null if the handle does not support this feature.
- Throws:
IOException- If something goes wrong when accessing the checksum.
-
offset
public long offset() throws IOExceptionDescription copied from interface:DataHandleReturns the current offset in the stream.- 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
-
length
public long length() throws IOExceptionDescription copied from interface:DataHandleReturns the length of the data in bytes.- Returns:
- The length, or -1 if the length is unknown.
- Throws:
IOException
-
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
-
getType
public Class<Location> getType()
Description copied from interface:TypedGets the type associated with the object.
-
readByte
public byte readByte() throws IOException- Throws:
IOException
-
write
public void write(int b) throws IOException- Throws:
IOException
-
write
public void write(byte[] b, int off, int len) throws IOException- Throws:
IOException
-
close
public void close() throws IOException- Throws:
IOException
-
-