Package com.clickhouse.data
Class ClickHouseFile
java.lang.Object
com.clickhouse.data.ClickHousePassThruStream
com.clickhouse.data.ClickHouseFile
- All Implemented Interfaces:
Serializable
Wrapper of
File with additional information like compression
and format.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ClickHouseFileNull file which has no compression and format.Fields inherited from class com.clickhouse.data.ClickHousePassThruStream
ERROR_NO_INPUT, ERROR_NO_OUTPUT, TYPE_NAME -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedClickHouseFile(File file, ClickHouseCompression compress, int compressLevel, ClickHouseFormat format) -
Method Summary
Modifier and TypeMethodDescriptiongetFile()Gets file.Gets the input stream for reading.Gets the output stream for writing.booleanhasInput()Checks if input stream is available or not.booleanChecks if output stream is available or not.booleanChecks if the given file is recogonized or not.newInputStream(int bufferSize, Runnable postCloseAction) Creates a wrapped input stream for reading.newOutputStream(int bufferSize, Runnable postCloseAction) Creates a wrapped output stream for writing.static ClickHouseFileof(ClickHouseInputStream input, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) static ClickHouseFileof(ClickHousePassThruStream stream) static ClickHouseFilestatic ClickHouseFileof(File file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) static ClickHouseFileof(File file, ClickHouseCompression compression, ClickHouseFormat format) static ClickHouseFileof(InputStream input, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) static ClickHouseFilestatic ClickHouseFileof(String file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) static ClickHouseFileof(String file, ClickHouseCompression compression, ClickHouseFormat format) static ClickHouseFileMethods inherited from class com.clickhouse.data.ClickHousePassThruStream
getCompressionAlgorithm, getCompressionLevel, getFormat, hasCompression, hasFormat, isCompressed, of, of, of, of, of, of
-
Field Details
-
NULL
Null file which has no compression and format.
-
-
Constructor Details
-
ClickHouseFile
protected ClickHouseFile(File file, ClickHouseCompression compress, int compressLevel, ClickHouseFormat format)
-
-
Method Details
-
of
-
of
-
of
-
of
public static ClickHouseFile of(String file, ClickHouseCompression compression, ClickHouseFormat format) -
of
public static ClickHouseFile of(String file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
of
public static ClickHouseFile of(File file, ClickHouseCompression compression, ClickHouseFormat format) -
of
public static ClickHouseFile of(File file, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
of
-
of
public static ClickHouseFile of(ClickHouseInputStream input, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
of
public static ClickHouseFile of(InputStream input, ClickHouseCompression compression, int compressionLevel, ClickHouseFormat format) -
getInputStream
Description copied from class:ClickHousePassThruStreamGets the input stream for reading. Please pay attention that the returned input stream has nothing to do with this pass-thru stream, asgetInputStream().getUnderlyingStream()is alwaysClickHousePassThruStream.NULL.- Overrides:
getInputStreamin classClickHousePassThruStream- Returns:
- non-null input stream
-
newInputStream
Description copied from class:ClickHousePassThruStreamCreates a wrapped input stream for reading. Calling this method multiple times will generate multipleClickHouseInputStreaminstances pointing to the same input stream, so it does not make sense to call this more than once. UnlikeClickHousePassThruStream.getInputStream(), the returned input stream is associated with this pass-thru stream, sonewInputStream(...).getUnderlyingStream()simply returns the current pass-thru stream.- Overrides:
newInputStreamin classClickHousePassThruStream- Parameters:
bufferSize- buffer size which is always greater than zero(usually 4096 or larger)postCloseAction- custom action will be performed right after closing the input stream- Returns:
- non-null wrapped input stream
-
getOutputStream
Description copied from class:ClickHousePassThruStreamGets the output stream for writing. Please pay attention that the returned output stream has nothing to do with this pass-thru stream, asgetOutputStream().getUnderlyingStream()is alwaysClickHousePassThruStream.NULL.- Overrides:
getOutputStreamin classClickHousePassThruStream- Returns:
- non-null output stream
-
newOutputStream
Description copied from class:ClickHousePassThruStreamCreates a wrapped output stream for writing. Calling this method multiple times will generate multipleClickHouseOutputStreaminstances, so it does not make sense to call this more than once. UnlikeClickHousePassThruStream.getOutputStream(), the returned output stream is associated with this pass-thru stream, sonewOutputStream(...).getUnderlyingStream()simply returns the current pass-thru stream.- Overrides:
newOutputStreamin classClickHousePassThruStream- Parameters:
bufferSize- buffer size which is always greater than zero(usually 4096 or larger)postCloseAction- custom action will be performed right after closing the output stream- Returns:
- non-null wrapped output stream
-
getFile
Gets file. Use#hasInput()or#hasOutput()to check file availability first.- Returns:
- file, could be null
-
isRecognized
public boolean isRecognized()Checks if the given file is recogonized or not. Same ashasCompression() || hasFormat().- Returns:
- true if the file is recogonized
-
hasInput
public boolean hasInput()Description copied from class:ClickHousePassThruStreamChecks if input stream is available or not.- Overrides:
hasInputin classClickHousePassThruStream- Returns:
- true if input stream is available; false otherwise
-
hasOutput
public boolean hasOutput()Description copied from class:ClickHousePassThruStreamChecks if output stream is available or not.- Overrides:
hasOutputin classClickHousePassThruStream- Returns:
- true if output stream is available; false otherwise
-