IOUtils

class IOUtils

Utility functions

Functions

Link copied to clipboard
open fun closeQuietly(c: Closeable)
Closes the given Closeable and swallows any IOException that may occur.
Link copied to clipboard
open fun copy(input: InputStream, output: OutputStream): Long
Copies the content of a InputStream into an OutputStream.
open fun copy(input: InputStream, output: OutputStream, buffersize: Int): Long
Copies the content of a InputStream into an OutputStream
Link copied to clipboard
open fun copyRange(input: InputStream, len: Long, output: OutputStream): Long
Copies part of the content of a InputStream into an OutputStream.
open fun copyRange(input: InputStream, len: Long, output: OutputStream, buffersize: Int): Long
Copies part of the content of a InputStream into an OutputStream
Link copied to clipboard
open fun readFully(input: InputStream, array: Array<Byte>): Int
Reads as much from input as possible to fill the given array.
open fun readFully(channel: ReadableByteChannel, byteBuffer: ByteBuffer)
Reads b.remaining() bytes from the given channel starting at the current channel's position.
open fun readFully(input: InputStream, array: Array<Byte>, offset: Int, len: Int): Int
Reads as much from input as possible to fill the given array with the given amount of bytes.
Link copied to clipboard
open fun readRange(input: InputStream, len: Int): Array<Byte>
Gets part of the contents of an InputStream as a byte[].
open fun readRange(input: ReadableByteChannel, len: Int): Array<Byte>
Gets part of the contents of an ReadableByteChannel as a byte[].
Link copied to clipboard
open fun skip(input: InputStream, numToSkip: Long): Long
Skips the given number of bytes by repeatedly invoking skip on the given input stream if necessary.
Link copied to clipboard
open fun toByteArray(input: InputStream): Array<Byte>
Gets the contents of an InputStream as a byte[].