public final class LKFileUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static boolean |
isCompressed(java.io.File file)
Deprecated.
Use
CompressionMode or commons-compress facilities instead. |
static java.io.Reader |
openInput(java.io.File file)
Open a reader with automatic compression and the default character set.
|
static java.io.Reader |
openInput(java.io.File file,
java.nio.charset.Charset charset,
CompressionMode compression)
Open a file for input, optionally compressed.
|
static java.io.Reader |
openInput(java.io.File file,
CompressionMode compression)
Open a file for input with the default charset.
|
static java.io.Writer |
openOutput(java.io.File file)
Open a reader with automatic compression inference.
|
static java.io.Writer |
openOutput(java.io.File file,
java.nio.charset.Charset charset,
CompressionMode compression)
Open a file for input, optionally compressed.
|
static java.io.Writer |
openOutput(java.io.File file,
CompressionMode compression)
Open a file for output with the default charset.
|
static LongList |
readIdList(java.io.File file)
Read a list of long IDs from a file, one per line.
|
static java.io.InputStream |
transparentlyDecompress(java.io.InputStream stream)
Auto-detect whether a stream needs decompression.
|
@Deprecated public static boolean isCompressed(java.io.File file)
CompressionMode
or commons-compress facilities instead.file
- The file to query.true
if the file name ends in “.gz”.public static java.io.Reader openInput(java.io.File file, java.nio.charset.Charset charset, CompressionMode compression) throws java.io.IOException
file
- The file to open.charset
- The character set to use.compression
- Whether to compress the file.java.io.IOException
- if there is an error opening the file.public static java.io.Reader openInput(java.io.File file, CompressionMode compression) throws java.io.IOException
file
- The file to open.compression
- The compression mode.java.io.IOException
- if there was an error opening the file.openInput(java.io.File, Charset, CompressionMode)
public static java.io.Reader openInput(java.io.File file) throws java.io.IOException
file
- The file to open.java.io.IOException
- if there is an error opening the file.openInput(File, Charset, CompressionMode)
,
CompressionMode.AUTO
,
Charset.defaultCharset()
public static java.io.Writer openOutput(java.io.File file, java.nio.charset.Charset charset, CompressionMode compression) throws java.io.IOException
file
- The file to open.charset
- The character set to use.compression
- Whether to compress the file.java.io.IOException
- if there is an error opening the file.public static java.io.Writer openOutput(java.io.File file, CompressionMode compression) throws java.io.IOException
file
- The file to open.compression
- The compression mode.java.io.IOException
- if there was an error opening the file.openInput(java.io.File, Charset, CompressionMode)
public static java.io.Writer openOutput(java.io.File file) throws java.io.IOException
file
- The file to open.java.io.IOException
- if there is an error opening the file.public static java.io.InputStream transparentlyDecompress(@WillCloseWhenClosed java.io.InputStream stream) throws java.io.IOException
stream
- The stream to read.stream
, decompressing if needed. It may not be
the same object as stream
, even if no decompression is needed, as the input
stream may be wrapped in a buffered stream for lookahead.java.io.IOException
public static LongList readIdList(java.io.File file) throws java.io.IOException
file
- The file to read.java.io.IOException