Package com.clickhouse.client
Class ClickHouseFile
- java.lang.Object
-
- com.clickhouse.client.ClickHouseFile
-
- All Implemented Interfaces:
Serializable
public class ClickHouseFile extends Object implements Serializable
Wrapper ofFilewith additional information like compression and format.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static ClickHouseFileNULLNull file which has no compression and format.
-
Constructor Summary
Constructors Modifier Constructor Description protectedClickHouseFile(File file, ClickHouseCompression compress, int compressLevel, ClickHouseFormat format)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ClickHouseInputStreamasInputStream()Creates an input stream for reading the file.ClickHouseOutputStreamasOutputStream()Creates an output stream for writing data into the file.ClickHouseCompressiongetCompressionAlgorithm()Gets compression algorithm.intgetCompressionLevel()Gets compression level.FilegetFile()Gets file, which only works whenisAvailable()returnstrue.ClickHouseFormatgetFormat()Gets file format, which could be null.booleanhasFormat()Checks if the file format is defined or not.booleanisAvailable()Checks if the file is available or not.booleanisCompressed()Checks if the file is compressed or not.static ClickHouseFileof(File file)static ClickHouseFileof(File file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format)static ClickHouseFileof(String file)static ClickHouseFileof(String file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format)static ClickHouseFileof(Path path)
-
-
-
Field Detail
-
NULL
public static final ClickHouseFile NULL
Null file which has no compression and format.
-
-
Constructor Detail
-
ClickHouseFile
protected ClickHouseFile(File file, ClickHouseCompression compress, int compressLevel, ClickHouseFormat format)
-
-
Method Detail
-
of
public static ClickHouseFile of(File file)
-
of
public static ClickHouseFile of(Path path)
-
of
public static ClickHouseFile of(String file)
-
of
public static ClickHouseFile of(String file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format)
-
of
public static ClickHouseFile of(File file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format)
-
asInputStream
public ClickHouseInputStream asInputStream()
Creates an input stream for reading the file.- Returns:
- non-null input stream for reading the file
-
asOutputStream
public ClickHouseOutputStream asOutputStream()
Creates an output stream for writing data into the file.- Returns:
- non-null input stream for writing data into the file
-
getFile
public File getFile()
Gets file, which only works whenisAvailable()returnstrue.- Returns:
- non-null file, except
nullforNULL
-
getFormat
public ClickHouseFormat getFormat()
Gets file format, which could be null. UsehasFormat()to check first.- Returns:
- file format, could be null
-
getCompressionAlgorithm
public ClickHouseCompression getCompressionAlgorithm()
Gets compression algorithm.- Returns:
- non-null compression algorithm
-
getCompressionLevel
public int getCompressionLevel()
Gets compression level.- Returns:
- compression level, which is always greater than or equal to zero
-
hasFormat
public boolean hasFormat()
Checks if the file format is defined or not.- Returns:
- true if the file format is defined; false otherwise
-
isAvailable
public boolean isAvailable()
Checks if the file is available or not.- Returns:
- true if the file is available; false otherwise
-
isCompressed
public boolean isCompressed()
Checks if the file is compressed or not.- Returns:
- true if the file is compressed; false otherwise
-
-