org.scijava.io
Class FileHandle

java.lang.Object
  extended by org.scijava.AbstractContextual
      extended by org.scijava.plugin.AbstractRichPlugin
          extended by org.scijava.plugin.AbstractTypedPlugin<D>
              extended by org.scijava.plugin.AbstractWrapperPlugin<L>
                  extended by org.scijava.io.AbstractDataHandle<FileLocation>
                      extended by org.scijava.io.FileHandle
All Implemented Interfaces:
Closeable, DataInput, DataOutput, Comparable<Prioritized>, Contextual, DataHandle<FileLocation>, HasPluginInfo, RichPlugin, SciJavaPlugin, TypedPlugin<FileLocation>, WrapperPlugin<FileLocation>, Prioritized, Typed<FileLocation>

public class FileHandle
extends AbstractDataHandle<FileLocation>

DataHandle for a FileLocation.

Author:
Curtis Rueden

Constructor Summary
FileHandle()
           
 
Method Summary
 void close()
           
 String getMode()
           
 RandomAccessFile getRandomAccessFile()
          Gets the random access file object backing this FileHandle.
 Class<FileLocation> getType()
          Gets the type associated with the object.
 long length()
          Returns the length of the stream.
 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()
           
 char readChar()
           
 double readDouble()
           
 float readFloat()
           
 void readFully(byte[] b)
           
 void readFully(byte[] b, int off, int len)
           
 int readInt()
           
 String readLine()
           
 long readLong()
           
 short readShort()
           
 int readUnsignedByte()
           
 int readUnsignedShort()
           
 String readUTF()
           
 void seek(long pos)
          Sets the stream pointer offset, measured from the beginning of the stream, at which the next read or write occurs.
 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 writeChar(int v)
           
 void writeChars(String s)
           
 void writeDouble(double v)
           
 void writeFloat(float v)
           
 void writeInt(int v)
           
 void writeLong(long v)
           
 void writeShort(int v)
           
 void writeUTF(String str)
           
 
Methods inherited from class org.scijava.io.AbstractDataHandle
findString, findString, findString, findString, getEncoding, getOrder, isLittleEndian, read, read, readCString, readString, readString, setEncoding, setOrder, setOrder, skip, write, write
 
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.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
supports
 

Constructor Detail

FileHandle

public FileHandle()
Method Detail

getRandomAccessFile

public RandomAccessFile getRandomAccessFile()
                                     throws IOException
Gets the random access file object backing this FileHandle.

Throws:
IOException

getMode

public String getMode()

setMode

public void setMode(String mode)

offset

public long offset()
            throws IOException
Description copied from interface: DataHandle
Returns the current offset in the stream.

Throws:
IOException

length

public long length()
            throws IOException
Description copied from interface: DataHandle
Returns the length of the stream.

Throws:
IOException

read

public int read()
         throws IOException
Description copied from interface: DataHandle
Reads the next byte of data from the stream.

Returns:
the next byte of data, or -1 if the end of the stream is reached.
Throws:
IOException - - if an I/O error occurs.

read

public int read(byte[] b)
         throws IOException
Description copied from interface: DataHandle
Reads up to b.length bytes of data from the stream into an array of bytes.

Specified by:
read in interface DataHandle<FileLocation>
Overrides:
read in class AbstractDataHandle<FileLocation>
Returns:
the total number of bytes read into the buffer.
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Description copied from interface: DataHandle
Reads up to len bytes 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 IOException
Description copied from interface: DataHandle
Sets the stream pointer offset, measured from the beginning of the stream, at which the next read or write occurs.

Throws:
IOException

readBoolean

public boolean readBoolean()
                    throws IOException
Throws:
IOException

readByte

public byte readByte()
              throws IOException
Throws:
IOException

readChar

public char readChar()
              throws IOException
Throws:
IOException

readDouble

public double readDouble()
                  throws IOException
Throws:
IOException

readFloat

public float readFloat()
                throws IOException
Throws:
IOException

readFully

public void readFully(byte[] b)
               throws IOException
Throws:
IOException

readFully

public void readFully(byte[] b,
                      int off,
                      int len)
               throws IOException
Throws:
IOException

readInt

public int readInt()
            throws IOException
Throws:
IOException

readLine

public String readLine()
                throws IOException
Throws:
IOException

readLong

public long readLong()
              throws IOException
Throws:
IOException

readShort

public short readShort()
                throws IOException
Throws:
IOException

readUnsignedByte

public int readUnsignedByte()
                     throws IOException
Throws:
IOException

readUnsignedShort

public int readUnsignedShort()
                      throws IOException
Throws:
IOException

readUTF

public String readUTF()
               throws IOException
Throws:
IOException

skipBytes

public int skipBytes(int n)
              throws IOException
Throws:
IOException

write

public void write(byte[] b)
           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

writeBoolean

public void writeBoolean(boolean v)
                  throws IOException
Throws:
IOException

writeByte

public void writeByte(int v)
               throws IOException
Throws:
IOException

writeBytes

public void writeBytes(String s)
                throws IOException
Throws:
IOException

writeChar

public void writeChar(int v)
               throws IOException
Throws:
IOException

writeChars

public void writeChars(String s)
                throws IOException
Throws:
IOException

writeDouble

public void writeDouble(double v)
                 throws IOException
Throws:
IOException

writeFloat

public void writeFloat(float v)
                throws IOException
Throws:
IOException

writeInt

public void writeInt(int v)
              throws IOException
Throws:
IOException

writeLong

public void writeLong(long v)
               throws IOException
Throws:
IOException

writeShort

public void writeShort(int v)
                throws IOException
Throws:
IOException

writeUTF

public void writeUTF(String str)
              throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

getType

public Class<FileLocation> getType()
Description copied from interface: Typed
Gets the type associated with the object.



Copyright © 2009–2015 SciJava. All rights reserved.