Class RandomAccessDirectory

    • Method Detail

      • getFileAtPos

        public RandomAccessDirectoryItem getFileAtPos​(int pos)
        Return the directory item containing the specified position
        Parameters:
        pos -
        Returns:
        Directory item containing bytes at `pos`
      • setFileToPos

        protected void setFileToPos​(long pos)
                             throws IOException
        sets current RandomAccessFile to that containing pos saves start position on current RAF
        Parameters:
        pos -
        Throws:
        IOException
      • getLastModified

        public long getLastModified()
        Description copied from interface: FileCacheable
        Returns the time that the underlying file(s) were last modified. If they've changed since they were stored in the cache, they will be closed and reopened with FileFactory.
        Specified by:
        getLastModified in interface FileCacheable
        Overrides:
        getLastModified in class RandomAccessFile
        Returns:
        a long value representing the time the file(s) were last modified or 0L if the last-modified time couldn't be determined for any reason.
      • length

        public long length()
        Description copied from class: RandomAccessFile
        Get the length of the file. The data in the buffer (which may not have been written the disk yet) is taken into account.
        Overrides:
        length in class RandomAccessFile
        Returns:
        the length of the file in bytes.
      • readToByteChannel

        public long readToByteChannel​(WritableByteChannel dest,
                                      long offset,
                                      long nbytes)
                               throws IOException
        Description copied from class: RandomAccessFile
        Read nbytes bytes, at the specified file offset, send to a WritableByteChannel. This will block until all bytes are read. This uses the underlying file channel directly, bypassing all user buffers.
        Overrides:
        readToByteChannel in class RandomAccessFile
        Parameters:
        dest - write to this WritableByteChannel.
        offset - the offset in the file where copying will start.
        nbytes - the number of bytes to read.
        Returns:
        the actual number of bytes read and transfered
        Throws:
        IOException - if an I/O error occurs.
      • read_

        protected int read_​(long pos,
                            byte[] b,
                            int offset,
                            int len)
                     throws IOException
        Description copied from class: RandomAccessFile
        Read directly from file, without going through the buffer. All reading goes through here or readToByteChannel;
        Overrides:
        read_ in class RandomAccessFile
        Parameters:
        pos - start here in the file
        b - put data into this buffer
        offset - buffer offset
        len - this number of bytes
        Returns:
        actual number of bytes read, -1 if underlying random access file was closed
        Throws:
        IOException - on io error
      • write

        public void write​(int b)
        Not implemented - use write methods on the leaf RandomAccessFile e.g. getCurrentFile().write()
        Specified by:
        write in interface DataOutput
        Overrides:
        write in class RandomAccessFile
        Parameters:
        b - write this byte
      • writeBytes

        public void writeBytes​(byte[] b,
                               int off,
                               int len)
        Not implemented - use write methods on the leaf RandomAccessFile e.g. getCurrentFile().write()
        Overrides:
        writeBytes in class RandomAccessFile
        Parameters:
        b - the array containing the data.
        off - the offset in the array to the data.
        len - the length of the data.