class IOUtils
General IO stream manipulation utilities.
This class provides static utility methods for input/output operations.
The byte-to-char methods and char-to-byte methods involve a conversion step. Two methods are provided in each case, one that uses the platform default encoding and the other which allows you to specify an encoding. You are encouraged to always specify an encoding because relying on the platform default can lead to unexpected results, for example when moving from development to production.
All the methods in this class that read a stream are buffered internally. This means that there is no cause to use a BufferedInputStream
or BufferedReader
. The default buffer size of 4K has been shown to be efficient in tests.
Wherever possible, the methods in this class do not flush or close the stream. This is to avoid making non-portable assumptions about the streams' origin and further use. Thus the caller is still responsible for closing streams after use.
Origin of code: Excalibur.
Author
Peter Donald
Author
Jeff Turner
Author
Matthew Hawthorne
Author
Stephen Colebourne
Author
Gareth Davis
Author
Ian Springer
Author
Niall Pemberton
Author
Sandy McArthur
Version
$Id: IOUtils.java 481854 2006-12-03 18:30:07Z scolebourne $
IOUtils()
Instances should NOT be constructed in standard programming. |
static fun closeQuietly(input: java.io.InputStream): void
Unconditionally close an static fun closeQuietly(output: java.io.OutputStream): void
Unconditionally close an |
|
static fun copy(input: java.io.InputStream, output: java.io.OutputStream): int
Copy bytes from an static fun copy(input: java.io.InputStream, output: java.io.Writer): void
Copy bytes from an static fun copy(input: java.io.InputStream, output: java.io.Writer, encoding: java.lang.String): void
Copy bytes from an static fun copy(input: java.io.Reader, output: java.io.Writer): int
Copy chars from a static fun copy(input: java.io.Reader, output: java.io.OutputStream): void
Copy chars from a static fun copy(input: java.io.Reader, output: java.io.OutputStream, encoding: java.lang.String): void
Copy chars from a |
|
static fun copyLarge(input: java.io.InputStream, output: java.io.OutputStream): long
Copy bytes from a large (over 2GB) static fun copyLarge(input: java.io.Reader, output: java.io.Writer): long
Copy chars from a large (over 2GB) |
|
static fun toString(input: java.io.InputStream): java.lang.String
Get the contents of an static fun toString(input: java.io.InputStream, encoding: java.lang.String): java.lang.String
Get the contents of an static fun toString(input: java.io.Reader): java.lang.String
Get the contents of a static fun
Get the contents of a static fun
Get the contents of a |
|
static fun write(data: kotlin.Array<byte>, output: java.io.OutputStream): void
Writes bytes from a static fun write(data: kotlin.Array<byte>, output: java.io.Writer): void
Writes bytes from a static fun write(data: kotlin.Array<byte>, output: java.io.Writer, encoding: java.lang.String): void
Writes bytes from a static fun write(data: kotlin.Array<char>, output: java.io.Writer): void
Writes chars from a static fun write(data: kotlin.Array<char>, output: java.io.OutputStream): void
Writes chars from a static fun write(data: kotlin.Array<char>, output: java.io.OutputStream, encoding: java.lang.String): void
Writes chars from a static fun write(data: java.lang.String, output: java.io.Writer): void
Writes chars from a static fun write(data: java.lang.String, output: java.io.OutputStream): void
Writes chars from a static fun write(data: java.lang.String, output: java.io.OutputStream, encoding: java.lang.String): void
Writes chars from a static fun write(data: java.lang.StringBuffer, output: java.io.Writer): void
Writes chars from a static fun write(data: java.lang.StringBuffer, output: java.io.OutputStream): void
Writes chars from a static fun write(data: java.lang.StringBuffer, output: java.io.OutputStream, encoding: java.lang.String): void
Writes chars from a |
DIR_SEPARATOR
The system directory separator character. |
|
DIR_SEPARATOR_UNIX
The Unix directory separator character. |
|
DIR_SEPARATOR_WINDOWS
The Windows directory separator character. |
|
LINE_SEPARATOR
The system line separator string. |
|
LINE_SEPARATOR_UNIX
The Unix line separator string. |
|
LINE_SEPARATOR_WINDOWS
The Windows line separator string. |