open 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 val DIR_SEPARATOR: CharThe system directory separator character. | |
| static val DIR_SEPARATOR_UNIX: CharThe Unix directory separator character. | |
| static val DIR_SEPARATOR_WINDOWS: CharThe Windows directory separator character. | |
| static val LINE_SEPARATOR: String!The system line separator string. | |
| static val LINE_SEPARATOR_UNIX: StringThe Unix line separator string. | |
| static val LINE_SEPARATOR_WINDOWS: StringThe Windows line separator string. | 
| open static fun closeQuietly(input: Reader!): UnitUnconditionally close an  open static fun closeQuietly(output: Writer!): UnitUnconditionally close a  open static fun closeQuietly(input: InputStream!): UnitUnconditionally close an  open static fun closeQuietly(output: OutputStream!): UnitUnconditionally close an  | |
| open static fun contentEquals(input1: InputStream!, input2: InputStream!): BooleanCompare the contents of two Streams to determine if they are equal or not. open static fun contentEquals(input1: Reader!, input2: Reader!): BooleanCompare the contents of two Readers to determine if they are equal or not. | |
| open static fun copy(input: InputStream!, output: OutputStream!): IntCopy bytes from an  open static fun copy(input: InputStream!, output: Writer!): UnitCopy bytes from an  open static fun copy(input: InputStream!, output: Writer!, encoding: String!): UnitCopy bytes from an  open static fun copy(input: Reader!, output: Writer!): IntCopy chars from a  open static fun copy(input: Reader!, output: OutputStream!): UnitCopy chars from a  open static fun copy(input: Reader!, output: OutputStream!, encoding: String!): UnitCopy chars from a  | |
| open static fun copyLarge(input: InputStream!, output: OutputStream!): LongCopy bytes from a large (over 2GB)  open static fun copyLarge(input: Reader!, output: Writer!): LongCopy chars from a large (over 2GB)  | |
| open static fun lineIterator(reader: Reader!): LineIterator!Return an Iterator for the lines in a  open static fun lineIterator(input: InputStream!, encoding: String!): LineIterator!Return an Iterator for the lines in an  | |
| open static fun readLines(input: InputStream!): MutableList<Any?>!Get the contents of an  open static fun readLines(input: InputStream!, encoding: String!): MutableList<Any?>!Get the contents of an  open static fun readLines(input: Reader!): MutableList<Any?>!Get the contents of a  | |
| open static fun toByteArray(input: InputStream!): ByteArray!Get the contents of an  open static fun toByteArray(input: Reader!): ByteArray!Get the contents of a  open static fun toByteArray(input: Reader!, encoding: String!): ByteArray!Get the contents of a  | |
| open static fun toCharArray(is: InputStream!): CharArray!Get the contents of an  open static fun toCharArray(is: InputStream!, encoding: String!): CharArray!Get the contents of an  open static fun toCharArray(input: Reader!): CharArray!Get the contents of a  | |
| open static fun toInputStream(input: String!): InputStream!Convert the specified string to an input stream, encoded as bytes using the default character encoding of the platform. open static fun toInputStream(input: String!, encoding: String!): InputStream!Convert the specified string to an input stream, encoded as bytes using the specified character encoding. | |
| open static fun toString(input: InputStream!): String!Get the contents of an  open static fun toString(input: InputStream!, encoding: String!): String!Get the contents of an  open static fun toString(input: Reader!): String!Get the contents of a  | |
| open static fun write(data: ByteArray!, output: OutputStream!): UnitWrites bytes from a  open static fun write(data: ByteArray!, output: Writer!): UnitWrites bytes from a  open static fun write(data: ByteArray!, output: Writer!, encoding: String!): UnitWrites bytes from a  open static fun write(data: CharArray!, output: Writer!): UnitWrites chars from a  open static fun write(data: CharArray!, output: OutputStream!): UnitWrites chars from a  open static fun write(data: CharArray!, output: OutputStream!, encoding: String!): UnitWrites chars from a  open static fun write(data: String!, output: Writer!): UnitWrites chars from a  open static fun write(data: String!, output: OutputStream!): UnitWrites chars from a  open static fun write(data: String!, output: OutputStream!, encoding: String!): UnitWrites chars from a  open static fun write(data: StringBuffer!, output: Writer!): UnitWrites chars from a  open static fun write(data: StringBuffer!, output: OutputStream!): UnitWrites chars from a  open static fun write(data: StringBuffer!, output: OutputStream!, encoding: String!): UnitWrites chars from a  | |
| open static fun writeLines(lines: MutableCollection<Any?>!, lineEnding: String!, output: OutputStream!): UnitWrites the  open static fun writeLines(lines: MutableCollection<Any?>!, lineEnding: String!, output: OutputStream!, encoding: String!): UnitWrites the  open static fun writeLines(lines: MutableCollection<Any?>!, lineEnding: String!, writer: Writer!): UnitWrites the  |