toString

Get the contents of an InputStream as a String using the default character encoding of the platform.

This method buffers the input internally, so there is no need to use a BufferedInputStream.

Return

the requested String

Parameters

input

the InputStream to read from

open fun toString(input: InputStream): String

Get the contents of an InputStream as a String using the specified character encoding.

Character encoding names can be found at IANA.

This method buffers the input internally, so there is no need to use a BufferedInputStream.

Return

the requested String

Parameters

encoding

the encoding to use, null means platform default

input

the InputStream to read from

open fun toString(input: InputStream, encoding: String): String

Get the contents of a Reader as a String.

This method buffers the input internally, so there is no need to use a BufferedReader.

Return

the requested String

Parameters

input

the Reader to read from

open fun toString(input: Reader): String

Get the contents of a byte[] as a String using the default character encoding of the platform.

Return

the requested String

Deprecated

Use String

Parameters

input

the byte array to read from

open fun toString(input: Array<Byte>): String

Get the contents of a byte[] as a String using the specified character encoding.

Character encoding names can be found at IANA.

Return

the requested String

Deprecated

Use String

Parameters

encoding

the encoding to use, null means platform default

input

the byte array to read from

open fun toString(input: Array<Byte>, encoding: String): String