Class RemoteRandomAccessFile

    • Field Detail

      • defaultMaxReadCacheSize

        protected static final long defaultMaxReadCacheSize
        See Also:
        Constant Field Values
      • defaultRemoteFileBufferSize

        protected static final int defaultRemoteFileBufferSize
        See Also:
        Constant Field Values
      • defaultRemoteFileTimeout

        protected static final int defaultRemoteFileTimeout
        See Also:
        Constant Field Values
      • url

        protected final String url
    • Constructor Detail

      • RemoteRandomAccessFile

        protected RemoteRandomAccessFile​(String url,
                                         int bufferSize,
                                         long maxRemoteCacheSize)
    • Method Detail

      • read_

        protected int read_​(long pos,
                            byte[] buff,
                            int offset,
                            int len)
                     throws IOException
        Read data into the buffer, and return number of bytes read. If the read cache is enabled, the cache will be checked for data first. If not in the cache, data will be read directly from the remote service and placed in the cache. All reading goes through here or readToByteChannel;
        Overrides:
        read_ in class RandomAccessFile
        Parameters:
        pos - start here in the file
        buff - put data into this buffer
        offset - buffer offset
        len - this number of bytes
        Returns:
        actual number of bytes read
        Throws:
        IOException - on io error
      • 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.