FileHandle.Builder (apache-cassandra API)
Date: 2018-02-14

org.apache.cassandra.io.util

## Class FileHandle.Builder

- java.lang.Object
- - org.apache.cassandra.io.util.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 Summary

    Constructors
    Constructor and Description
    `Builder(ChannelProxy channel)`
    `Builder(java.lang.String path)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `FileHandle.Builder` | `bufferSize(int bufferSize)` Set the buffer size to use (if appropriate).
    `FileHandle.Builder` | `bufferType(BufferType bufferType)` Set the buffer type (on heap or off heap) to use (if appropriate).
    `void` | `close()`
    `java.lang.Throwable` | `close(java.lang.Throwable accumulate)`
    `FileHandle` | `complete()` Complete building `FileHandle` without overriding file length.
    `FileHandle` | `complete(long overrideLength)` Complete building `FileHandle` with the given length, which overrides the file length.
    `FileHandle.Builder` | `compressed(boolean compressed)`
    `FileHandle.Builder` | `mmapped(boolean mmapped)` Set whether to use mmap for reading
    `FileHandle.Builder` | `withChunkCache(ChunkCache chunkCache)` Set `ChunkCache` to use.
    `FileHandle.Builder` | `withCompressionMetadata(CompressionMetadata metadata)` Provide `CompressionMetadata` to use when reading compressed file.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Builder

          public Builder(java.lang.String path)

    - #### Builder

          public Builder(ChannelProxy channel)

  - ### Method Detail

    - #### compressed

          public FileHandle.Builder compressed(boolean compressed)

    - #### 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.
      Parameters:
        `metadata` - CompressionMetadata to use
      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()

      Complete building `FileHandle` without overriding file length.
      See Also:
        `complete(long)`

    - #### 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`

Copyright © 2018 The Apache Software Foundation