Package 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.AutoCloseableConfigures how the file will be read (compressed, mmapped, use cache etc.)
-
-
Constructor Summary
Constructors Constructor Description Builder(java.lang.String path)Builder(ChannelProxy channel)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileHandle.BuilderbufferSize(int bufferSize)Set the buffer size to use (if appropriate).FileHandle.BuilderbufferType(BufferType bufferType)Set the buffer type (on heap or off heap) to use (if appropriate).voidclose()java.lang.Throwableclose(java.lang.Throwable accumulate)FileHandlecomplete()Complete buildingFileHandlewithout overriding file length.FileHandlecomplete(long overrideLength)Complete buildingFileHandlewith the given length, which overrides the file length.FileHandle.Buildercompressed(boolean compressed)FileHandle.Buildermmapped(boolean mmapped)Set whether to use mmap for readingFileHandle.BuilderwithChunkCache(ChunkCache chunkCache)SetChunkCacheto use.FileHandle.BuilderwithCompressionMetadata(CompressionMetadata metadata)ProvideCompressionMetadatato use when reading compressed file.
-
-
-
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)
SetChunkCacheto use.- Parameters:
chunkCache- ChunkCache object to use for caching- Returns:
- this object
-
withCompressionMetadata
public FileHandle.Builder withCompressionMetadata(CompressionMetadata metadata)
ProvideCompressionMetadatato 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 buildingFileHandlewithout overriding file length.- See Also:
complete(long)
-
complete
public FileHandle complete(long overrideLength)
Complete buildingFileHandlewith 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:
closein interfacejava.lang.AutoCloseable
-
-