Class FileHandle.Builder

  • All Implemented Interfaces:
    java.lang.AutoCloseable
    Enclosing class:
    FileHandle

    public static class FileHandle.Builder
    extends java.lang.Object
    implements java.lang.AutoCloseable
    Configures how the file will be read (compressed, mmapped, use cache etc.)
    • Constructor Detail

      • Builder

        public Builder​(java.lang.String path)
    • Method Detail

      • withChunkCache

        public FileHandle.Builder withChunkCache​(ChunkCache chunkCache)
        Set ChunkCache to use.
        Parameters:
        chunkCache - ChunkCache object to use for caching
        Returns:
        this object
      • mmapped

        public FileHandle.Builder mmapped​(boolean mmapped)
        Set whether to use mmap for reading
        Parameters:
        mmapped - true if using mmap
        Returns:
        this instance
      • bufferSize

        public FileHandle.Builder bufferSize​(int bufferSize)
        Set the buffer size to use (if appropriate).
        Parameters:
        bufferSize - Buffer size in bytes
        Returns:
        this instance
      • bufferType

        public FileHandle.Builder bufferType​(BufferType bufferType)
        Set the buffer type (on heap or off heap) to use (if appropriate).
        Parameters:
        bufferType - Buffer type to use
        Returns:
        this instance
      • complete

        public FileHandle complete​(long overrideLength)
        Complete building FileHandle with the given length, which overrides the file length.
        Parameters:
        overrideLength - Override file length (in bytes) so that read cannot go further than this value. If the value is less than or equal to 0, then the value is ignored.
        Returns:
        Built file
      • close

        public java.lang.Throwable close​(java.lang.Throwable accumulate)
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable