Class FileHandle.Builder

  • Enclosing class:
    FileHandle

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

      • Builder

        public Builder​(File file)
    • Method Detail

      • withChunkCache

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

        public FileHandle.Builder withCompressionMetadata​(CompressionMetadata metadata)
        Provide CompressionMetadata to use when reading compressed file. Upon completion, builder will create a shared copy of this object and that copy will be used in the created instance of FileHandle. Therefore, the caller is responsible for closing the instance of CompressionMetadata passed to this method after builder completion.
        Parameters:
        metadata - CompressionMetadata to use, can be null if no compression is used
        Returns:
        this object
      • withCrcCheckChance

        public FileHandle.Builder withCrcCheckChance​(java.util.function.Supplier<java.lang.Double> crcCheckChanceSupplier)
      • 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
      • withLengthOverride

        public FileHandle.Builder withLengthOverride​(long lengthOverride)
        Override the file length.
        Parameters:
        lengthOverride - 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