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.AutoCloseable
Configures 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.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 buildingFileHandle
without overriding file length.FileHandle
complete(long overrideLength)
Complete buildingFileHandle
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 readingFileHandle.Builder
withChunkCache(ChunkCache chunkCache)
SetChunkCache
to use.FileHandle.Builder
withCompressionMetadata(CompressionMetadata metadata)
ProvideCompressionMetadata
to 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)
SetChunkCache
to use.- Parameters:
chunkCache
- ChunkCache object to use for caching- Returns:
- this object
-
withCompressionMetadata
public FileHandle.Builder withCompressionMetadata(CompressionMetadata metadata)
ProvideCompressionMetadata
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 buildingFileHandle
without overriding file length.- See Also:
complete(long)
-
complete
public FileHandle complete(long overrideLength)
Complete buildingFileHandle
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 interfacejava.lang.AutoCloseable
-
-