public class FileHandle extends AbstractDataHandle<FileLocation>
DataHandle
for a FileLocation
.DataHandle.ByteOrder
DEFAULT_BLOCK_SIZE, MAX_SEARCH_SIZE
Constructor and Description |
---|
FileHandle() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
exists()
Tests whether this handle's location actually exists at the source.
|
String |
getMode() |
RandomAccessFile |
getRandomAccessFile()
Gets the random access file object backing this FileHandle.
|
Class<FileLocation> |
getType()
Gets the type associated with the object.
|
boolean |
isReadable()
Gets whether reading from this handle is supported.
|
boolean |
isWritable()
Gets whether writing to this handle is supported.
|
Date |
lastModified()
Gets the last modified timestamp of the location.
|
long |
length()
Returns the length of the data in bytes.
|
long |
offset()
Returns the current offset in the stream.
|
int |
read()
Reads the next byte of data from the stream.
|
int |
read(byte[] b)
Reads up to b.length bytes of data from the stream into an array of bytes.
|
int |
read(byte[] b,
int off,
int len)
Reads up to
len bytes of data from the stream into an array of
bytes. |
boolean |
readBoolean() |
byte |
readByte() |
void |
readFully(byte[] b) |
void |
readFully(byte[] b,
int off,
int len) |
String |
readLine() |
int |
readUnsignedByte() |
String |
readUTF() |
void |
seek(long pos)
Sets the stream offset, measured from the beginning of the stream, at which
the next read or write occurs.
|
void |
set(FileLocation loc)
Associates the given data object with this plugin.
|
void |
setLength(long length)
Sets the new length of the handle.
|
void |
setMode(String mode) |
int |
skipBytes(int n) |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChars(String s) |
void |
writeUTF(String str) |
conversionBuffer, getEncoding, getOrder, setEncoding, setOrder
get
supports
getInfo, getPriority, setInfo, setPriority, toString
context, getContext
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
available, checksum, ensureReadable, ensureWritable, findString, findString, findString, findString, isBigEndian, isLittleEndian, readChar, readCString, readDouble, readFloat, readInt, readLong, readShort, readString, readString, readUnsignedShort, setLittleEndian, skip, writeChar, writeDouble, writeFloat, writeInt, writeLine, writeLong, writeShort
get
getIdentifier, log
context, getContext, setContext
compareTo, getPriority, setPriority
getInfo, setInfo
getLocation
getVersion
public RandomAccessFile getRandomAccessFile() throws IOException
IOException
public String getMode()
public void setMode(String mode)
public boolean isReadable()
DataHandle
public boolean isWritable()
DataHandle
public boolean exists()
DataHandle
public Date lastModified()
DataHandle
public long offset() throws IOException
DataHandle
IOException
public long length() throws IOException
DataHandle
IOException
public void setLength(long length) throws IOException
DataHandle
length
- New length.IOException
- If there is an error changing the handle's length.public int read() throws IOException
DataHandle
IOException
- - if an I/O error occurs.public int read(byte[] b) throws IOException
DataHandle
IOException
public int read(byte[] b, int off, int len) throws IOException
DataHandle
len
bytes of data from the stream into an array of
bytes.IOException
public void seek(long pos) throws IOException
DataHandle
IOException
public boolean readBoolean() throws IOException
IOException
public byte readByte() throws IOException
IOException
public void readFully(byte[] b) throws IOException
IOException
public void readFully(byte[] b, int off, int len) throws IOException
IOException
public String readLine() throws IOException
IOException
public int readUnsignedByte() throws IOException
IOException
public String readUTF() throws IOException
IOException
public int skipBytes(int n) throws IOException
IOException
public void write(byte[] b) throws IOException
IOException
public void write(byte[] b, int off, int len) throws IOException
IOException
public void write(int b) throws IOException
IOException
public void writeBoolean(boolean v) throws IOException
IOException
public void writeByte(int v) throws IOException
IOException
public void writeBytes(String s) throws IOException
IOException
public void writeChars(String s) throws IOException
IOException
public void writeUTF(String str) throws IOException
IOException
public void close() throws IOException
IOException
public void set(FileLocation loc)
WrapperPlugin
Typed.supports(T)
must return true).set
in interface WrapperPlugin<FileLocation>
set
in class AbstractWrapperPlugin<FileLocation>
loc
- The data object to associate with the plugin.public Class<FileLocation> getType()
Typed
Copyright © 2015–2022 SciJava. All rights reserved.