public class IOUtils
extends java.lang.Object
Modifier and Type | Method and Description |
---|---|
static java.io.Reader |
fileReader(java.lang.String path)
Returns the UTF-8 reader for the given file.
|
static java.io.Reader |
fileReader(java.lang.String path,
java.nio.charset.Charset charset)
Returns the reader for the given file that uses the specified encoding.
|
static java.io.Reader |
fileReader(java.lang.String path,
java.lang.String encoding)
Returns the reader for the given file that uses the specified encoding.
|
static java.io.Writer |
fileWriter(java.lang.String path)
Returns the UTF-8 writer for the given file.
|
static java.io.Writer |
fileWriter(java.lang.String path,
java.nio.charset.Charset charset)
Returns the writer for the given file that uses the specified encoding.
|
static java.io.Writer |
fileWriter(java.lang.String path,
java.lang.String encoding)
Returns the writer for the given file that uses the specified encoding.
|
static java.io.Writer |
stderrWriter()
Returns the UTF-8 writer for standard error.
|
static java.io.Writer |
stderrWriter(java.nio.charset.Charset charset)
Returns the writer for standard error that uses the specified encoding.
|
static java.io.Writer |
stderrWriter(java.lang.String encoding)
Returns the writer for standard error that uses the specified encoding.
|
static java.io.Reader |
stdinReader()
Returns the UTF-8 reader for standard input.
|
static java.io.Reader |
stdinReader(java.nio.charset.Charset charset)
Return the reader for standard input that uses the specified encoding.
|
static java.io.Reader |
stdinReader(java.lang.String encoding)
Returns the reader for standard input that uses the specified encoding.
|
static java.io.Writer |
stdoutWriter()
Returns the UTF-8 writer for standard output.
|
static java.io.Writer |
stdoutWriter(java.nio.charset.Charset charset)
Returns the writer for standard output that uses the specified encoding.
|
static java.io.Writer |
stdoutWriter(java.lang.String encoding)
Returns the writer for standard output that uses the specified encoding.
|
public static java.io.Reader stdinReader()
java.lang.RuntimeException
- if attempting to create a stdin reader for a second time with a different charset.public static java.io.Reader stdinReader(java.lang.String encoding)
encoding
- the encoding to use.java.lang.RuntimeException
- if attempting to create a stdin reader for a second time with a different charset.public static java.io.Reader stdinReader(java.nio.charset.Charset charset)
charset
- the encoding to use.java.lang.RuntimeException
- if attempting to create a stdin reader for a second time with a different charset.public static java.io.Writer stdoutWriter() throws java.io.IOException
java.io.IOException
- if an I/O error occurs (such as failing to flush a previous standard output writer with a different encoding).public static java.io.Writer stdoutWriter(java.lang.String encoding) throws java.io.IOException
encoding
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as failing to flush a previous standard output writer with a different encoding).public static java.io.Writer stdoutWriter(java.nio.charset.Charset charset) throws java.io.IOException
charset
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as failing to flush a previous standard output writer with a different encoding).public static java.io.Writer stderrWriter() throws java.io.IOException
java.io.IOException
- if an I/O error occurs (such as failing to flush a previous standard error writer with a different encoding).public static java.io.Writer stderrWriter(java.lang.String encoding) throws java.io.IOException
encoding
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as failing to flush a previous standard error writer with a different encoding).public static java.io.Writer stderrWriter(java.nio.charset.Charset charset) throws java.io.IOException
charset
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as failing to flush a previous standard error writer with a different encoding).public static java.io.Writer fileWriter(java.lang.String path) throws java.io.IOException
path
- the path of the file to write to.java.io.IOException
- if an I/O error occurs (such as failing to create the file).public static java.io.Writer fileWriter(java.lang.String path, java.lang.String encoding) throws java.io.IOException
path
- the path of the file to write to.encoding
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as failing to create the file).public static java.io.Writer fileWriter(java.lang.String path, java.nio.charset.Charset charset) throws java.io.IOException
path
- the path of the file to write to.charset
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as failing to create the file).public static java.io.Reader fileReader(java.lang.String path) throws java.io.IOException
path
- the path of the file to read from.java.io.IOException
- if an I/O error occurs (such as not finding the file).public static java.io.Reader fileReader(java.lang.String path, java.lang.String encoding) throws java.io.IOException
path
- the path of the file to read from.encoding
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as not finding the file).public static java.io.Reader fileReader(java.lang.String path, java.nio.charset.Charset charset) throws java.io.IOException
path
- the path of the file to read from.charset
- the encoding to use.java.io.IOException
- if an I/O error occurs (such as not finding the file).