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 classMoreFiles.DeleteOnCloseFileDeprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidappendToFile(Path file, Charset charset, Object content)Deprecated.moved toIOstatic ByteSinkasByteSink(Path path, FileWriteMode... options)Deprecated.static ByteSourceasByteSource(Path path)Deprecated.static CharSinkasCharSink(Path path, Charset charset, FileWriteMode... options)Deprecated.static CharSourceasCharSource(Path path, Charset charset)Deprecated.static voidcheckReadableFile(Path path)Deprecated.moved toIOstatic voidcreateParentDirs(Path path)Deprecated.static MoreFiles.DeleteOnCloseFilecreateTempFile(String prefix, @Nullable String suffix)Deprecated.static PathcreateTempFile(String prefix, @Nullable String suffix, @Nullable String content)Deprecated.UseTempFile.builder().static WriteropenOutputFile(Path file, Charset charset, FileWriteMode... options)Deprecated.moved toIOstatic StringtoString(Path file, Charset charset)Deprecated.useasCharSource(file, charset).read()static voidwriteFile(Path file, Charset charset, Object content)Deprecated.moved toIOstatic voidwriteGZIPFile(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 theprefixargument 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
Pathobject 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 toIOWrites 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 toIOWrites 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 toIOOpen 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 toIOAppends 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 toIOVerifies 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
-
-