open static fun toByteArray(input: InputStream!): ByteArray!
Get the contents of an InputStream
as a byte[]
.
This method buffers the input internally, so there is no need to use a BufferedInputStream
.
input
- InputStream!: the InputStream
to read from
NullPointerException
- if the input is null
IOException
- if an I/O error occurs
Return
ByteArray!: the requested byte array
open static fun toByteArray(input: Reader!): ByteArray!
Get the contents of a Reader
as a byte[]
using the default character encoding of the platform.
This method buffers the input internally, so there is no need to use a BufferedReader
.
input
- Reader!: the Reader
to read from
NullPointerException
- if the input is null
IOException
- if an I/O error occurs
Return
ByteArray!: the requested byte array
open static fun toByteArray(input: Reader!, encoding: String!): ByteArray!
Get the contents of a Reader
as a byte[]
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 BufferedReader
.
input
- Reader!: the Reader
to read from
encoding
- String!: the encoding to use, null means platform default
NullPointerException
- if the input is null
IOException
- if an I/O error occurs
Return
ByteArray!: the requested byte array
Since
Commons IO 1.1