public final class ReadWriteUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static void |
clear(java.io.File file)
Clears the specified existing file.
|
static java.lang.String |
getParentDirName(java.lang.String filePath)
Returns the base name of parent directory for the file is described in the specified path.
|
static java.io.BufferedReader |
newBufferedReader(java.io.InputStream stream)
Returns reader for the specified stream object.
|
static java.io.BufferedReader |
newBufferedReader(java.nio.file.Path path)
Returns reader for the specified path object.
|
static java.io.BufferedReader |
newBufferedReader(java.lang.String fileName)
Returns reader for the file with the specified full name.
|
static java.io.BufferedWriter |
newBufferedWriter(java.io.File file)
Returns writer to the specified file object.
|
static java.io.BufferedWriter |
newBufferedWriter(java.io.OutputStream stream)
Returns writer to the specified stream object.
|
static java.io.BufferedWriter |
newBufferedWriter(java.nio.file.Path path)
Returns writer to the specified path object.
|
static java.io.PrintWriter |
newPrintWriter(java.io.File file)
Returns writer to the specified file object.
|
public static java.io.BufferedReader newBufferedReader(java.lang.String fileName)
fileName
- The name of the file to be read.public static java.io.BufferedReader newBufferedReader(java.io.InputStream stream)
Default charset is used for reading.
stream
- Stream to be read.java.lang.IllegalArgumentException
- when argument is null
.public static java.io.BufferedReader newBufferedReader(java.nio.file.Path path)
Default charset is used for reading.
path
- Path from which data to be read.java.lang.IllegalArgumentException
- when argument is null
.RetrascopeRuntimeException
- when I/O error occurred.public static java.io.BufferedWriter newBufferedWriter(java.io.OutputStream stream)
Default charset is used for writing.
stream
- Stream to write to.java.lang.IllegalArgumentException
- when argument is null
.public static java.io.BufferedWriter newBufferedWriter(java.io.File file)
Default charset is used for writing.
file
- File to write to.java.lang.IllegalArgumentException
- when argument is null
.RetrascopeRuntimeException
- when the specified file already contains data
or when I/O error occurred.public static java.io.BufferedWriter newBufferedWriter(java.nio.file.Path path)
path
- Path to write to.java.lang.IllegalArgumentException
- is null
.RetrascopeRuntimeException
- when the specified file already exists
or when an I/O error occurred.public static java.io.PrintWriter newPrintWriter(java.io.File file)
Default charset is used for writing.
file
- File to write to.java.lang.IllegalArgumentException
- when argument is null
.public static java.lang.String getParentDirName(java.lang.String filePath)
filePath
- The path to file.public static void clear(java.io.File file)
file
- The existing file to be cleared.