W3cubDocs

/Kotlin

Extensions for java.io.InputStream

Platform and version requirements: JVM (1.0)

buffered

Creates a buffered input stream wrapping this stream.

fun InputStream.buffered(
    bufferSize: Int = DEFAULT_BUFFER_SIZE
): BufferedInputStream
Platform and version requirements: JVM (1.0)

bufferedReader

Creates a buffered reader on this input stream using UTF-8 or the specified charset.

fun InputStream.bufferedReader(
    charset: Charset = Charsets.UTF_8
): BufferedReader
Platform and version requirements: JVM (1.0)

copyTo

Copies this stream to the given output stream, returning the number of bytes copied

fun InputStream.copyTo(
    out: OutputStream, 
    bufferSize: Int = DEFAULT_BUFFER_SIZE
): Long
Platform and version requirements: JVM (1.0)

readBytes

Reads this stream completely into a byte array.

fun InputStream.readBytes(
    estimatedSize: Int = DEFAULT_BUFFER_SIZE
): ByteArray
fun InputStream.readBytes(): ByteArray
Platform and version requirements: JVM (1.0)

reader

Creates a reader on this input stream using UTF-8 or the specified charset.

fun InputStream.reader(
    charset: Charset = Charsets.UTF_8
): InputStreamReader

© 2010–2020 JetBrains s.r.o. and Kotlin Programming Language contributors
Licensed under the Apache License, Version 2.0.
https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.io/java.io.-input-stream/index.html