Package org.pipecraft.infra.io
Class FileWriteOptions
- java.lang.Object
-
- org.pipecraft.infra.io.FileWriteOptions
-
public class FileWriteOptions extends Object
Encapsulates file writing settings, with defaults.- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Constructor Description FileWriteOptions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FileWriteOptionsappend()Sets the append flag (by default it's false)FileWriteOptionsbuffer(int bufferSize)Sets the buffer size (default = 8192)intgetBufferSize()CompressiongetCompression()intgetCompressionLevel()booleanisAppend()booleanisTemp()FileWriteOptionssetCompression(Compression compression)Sets the compression of the fileFileWriteOptionssetCompression(Compression compression, int compressionLevel)Sets the compression of the fileFileWriteOptionstemp()Sets the file to be temporary, meaning that it will be deleted once the JVM exits gracefully (by default it's false)FileWriteOptionstemp(boolean temp)if true, sets compression the flag on file write options.
-
-
-
Method Detail
-
append
public FileWriteOptions append()
Sets the append flag (by default it's false)- Returns:
- this instance
-
getCompression
public Compression getCompression()
- Returns:
- The compression
-
getCompressionLevel
public int getCompressionLevel()
- Returns:
- The compression level to use, if compression is set. Specific to the selected compression algorithm.
-
setCompression
public FileWriteOptions setCompression(Compression compression)
Sets the compression of the file- Parameters:
compression- the compression of the file- Returns:
- the file write options
-
setCompression
public FileWriteOptions setCompression(Compression compression, int compressionLevel)
Sets the compression of the file- Parameters:
compression- the compression of the file- Returns:
- the file write options
-
buffer
public FileWriteOptions buffer(int bufferSize)
Sets the buffer size (default = 8192)- Parameters:
bufferSize- The write buffer size, in bytes- Returns:
- this instance
-
temp
public FileWriteOptions temp()
Sets the file to be temporary, meaning that it will be deleted once the JVM exits gracefully (by default it's false)- Returns:
- this instance
-
temp
public FileWriteOptions temp(boolean temp)
if true, sets compression the flag on file write options.- Parameters:
temp- True for temporary file, false for otherwise. Temporary files are deleted at graceful JVM shutdown.- Returns:
- the file write options
-
isAppend
public boolean isAppend()
- Returns:
- True for appending to an existing file, false for overriding
-
getBufferSize
public int getBufferSize()
- Returns:
- The write buffer size, in bytes
-
isTemp
public boolean isTemp()
- Returns:
- True for temporary file, false for otherwise. Temporary files are deleted at graceful JVM shutdown.
-
-