Package org.sosy_lab.common.io
Class MoreFiles
- java.lang.Object
-
- org.sosy_lab.common.io.MoreFiles
-
@Deprecated public final class MoreFiles extends Object
Deprecated.Provides helper functions for file access.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MoreFiles.DeleteOnCloseFile
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
appendToFile(Path file, Charset charset, Object content)
Deprecated.moved toIO
static ByteSink
asByteSink(Path path, FileWriteMode... options)
Deprecated.static ByteSource
asByteSource(Path path)
Deprecated.static CharSink
asCharSink(Path path, Charset charset, FileWriteMode... options)
Deprecated.static CharSource
asCharSource(Path path, Charset charset)
Deprecated.static void
checkReadableFile(Path path)
Deprecated.moved toIO
static void
createParentDirs(Path path)
Deprecated.static MoreFiles.DeleteOnCloseFile
createTempFile(String prefix, @Nullable String suffix)
Deprecated.static Path
createTempFile(String prefix, @Nullable String suffix, @Nullable String content)
Deprecated.UseTempFile.builder()
.static Writer
openOutputFile(Path file, Charset charset, FileWriteMode... options)
Deprecated.moved toIO
static String
toString(Path file, Charset charset)
Deprecated.useasCharSource(file, charset).read()
static void
writeFile(Path file, Charset charset, Object content)
Deprecated.moved toIO
static void
writeGZIPFile(Path file, Charset charset, Object content)
Deprecated.moved toIO
-
-
-
Method Detail
-
asByteSink
@Deprecated public static ByteSink asByteSink(Path path, FileWriteMode... options)
Deprecated.
-
asByteSource
@Deprecated @InlineMe(replacement="com.google.common.io.MoreFiles.asByteSource(path)") public static ByteSource asByteSource(Path path)
Deprecated.
-
asCharSink
@Deprecated public static CharSink asCharSink(Path path, Charset charset, FileWriteMode... options)
Deprecated.
-
asCharSource
@Deprecated @InlineMe(replacement="com.google.common.io.MoreFiles.asCharSource(path, charset)") public static CharSource asCharSource(Path path, Charset charset)
Deprecated.
-
createTempFile
@Deprecated public static Path createTempFile(String prefix, @Nullable String suffix, @Nullable String content) throws IOException
Deprecated.UseTempFile.builder()
.Creates a temporary file with an optional content. The file is marked for deletion when the Java VM exits.- Parameters:
prefix
- The prefix string to be used in generating the file's name; must be at least three characters longsuffix
- The suffix string to be used in generating the file's name; may benull
, in which case the suffix".tmp"
will be usedcontent
- The content to write (may be null). Will be written with default charset.- Throws:
IllegalArgumentException
- If theprefix
argument contains fewer than three charactersIOException
- If a file could not be created
-
createTempFile
@Deprecated public static MoreFiles.DeleteOnCloseFile createTempFile(String prefix, @Nullable String suffix) throws IOException
Deprecated.Create a temporary file similar toFile.createTempFile(String, String)
.The resulting
Path
object is wrapped in aMoreFiles.DeleteOnCloseFile
, which deletes the file as soon asMoreFiles.DeleteOnCloseFile.close()
is called.It is recommended to use the following pattern:
try (DeleteOnCloseFile tempFile = Files.createTempFile(...)) { // use tempFile.toPath() for writing and reading of the temporary file }
The file can be opened and closed multiple times, potentially from different processes.- Throws:
IOException
-
toString
@Deprecated @InlineMe(replacement="com.google.common.io.MoreFiles.asCharSource(file, charset).read()") public static String toString(Path file, Charset charset) throws IOException
Deprecated.useasCharSource(file, charset).read()
Read the full content of a file.- Parameters:
file
- The file.- Throws:
IOException
-
writeFile
@Deprecated @InlineMe(replacement="IO.writeFile(file, charset, content)", imports="org.sosy_lab.common.io.IO") public static void writeFile(Path file, Charset charset, Object content) throws IOException
Deprecated.moved toIO
Writes content to a file.- Parameters:
file
- The file.content
- The content which shall be written.- Throws:
IOException
-
writeGZIPFile
@Deprecated @InlineMe(replacement="IO.writeGZIPFile(file, charset, content)", imports="org.sosy_lab.common.io.IO") public static void writeGZIPFile(Path file, Charset charset, Object content) throws IOException
Deprecated.moved toIO
Writes content to a file compressed in GZIP format.- Parameters:
file
- The file.content
- The content which shall be written.- Throws:
IOException
-
openOutputFile
@Deprecated public static Writer openOutputFile(Path file, Charset charset, FileWriteMode... options) throws IOException
Deprecated.moved toIO
Open a buffered Writer to a file. This method creates necessary parent directories beforehand.- Throws:
IOException
-
appendToFile
@Deprecated @InlineMe(replacement="IO.appendToFile(file, charset, content)", imports="org.sosy_lab.common.io.IO") public static void appendToFile(Path file, Charset charset, Object content) throws IOException
Deprecated.moved toIO
Appends content to a file (without overwriting the file, but creating it if necessary).- Parameters:
file
- The file.content
- The content which will be written to the end of the file.- Throws:
IOException
-
checkReadableFile
@Deprecated @InlineMe(replacement="IO.checkReadableFile(path)", imports="org.sosy_lab.common.io.IO") public static void checkReadableFile(Path path) throws FileNotFoundException
Deprecated.moved toIO
Verifies if a file exists, is a normal file and is readable. If this is not the case, a FileNotFoundException with a nice message is thrown.- Parameters:
path
- The file to check.- Throws:
FileNotFoundException
- If one of the conditions is not true.
-
createParentDirs
@Deprecated @InlineMe(replacement="com.google.common.io.MoreFiles.createParentDirectories(path)") public static void createParentDirs(Path path) throws IOException
Deprecated.- Throws:
IOException
-
-