toByteArray

open fun toByteArray(input: InputStream): Array<Byte>

Gets the contents of an InputStream as a byte[].

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

Return

the requested byte array

Since

1.5

Parameters

input

the InputStream to read from

Throws

if the input is null

if an I/O error occurs