Class FileHandle

    • Constructor Detail

      • FileHandle

        public FileHandle()
    • Method Detail

      • getRandomAccessFile

        public RandomAccessFile getRandomAccessFile()
                                             throws IOException
        Gets the random access file object backing this FileHandle. If the underlying file does not exist yet, it will be created.
        Throws:
        IOException
      • getMode

        public String getMode()
      • setMode

        public void setMode​(String mode)
      • isReadable

        public boolean isReadable()
        Description copied from interface: DataHandle
        Gets whether reading from this handle is supported.
      • isWritable

        public boolean isWritable()
        Description copied from interface: DataHandle
        Gets whether writing to this handle is supported.
      • exists

        public boolean exists()
        Description copied from interface: DataHandle
        Tests whether this handle's location actually exists at the source.
        Returns:
        True if the location exists; false if not.
      • lastModified

        public Date lastModified()
        Description copied from interface: DataHandle
        Gets 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.
      • length

        public long length()
                    throws IOException
        Description copied from interface: DataHandle
        Returns 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 IOException
        Description copied from interface: DataHandle
        Sets 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()
                 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.
        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 offset, measured from the beginning of the stream, at which the next read or write occurs.
        Throws:
        IOException
      • getType

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