Google is committed to advancing racial equity for Black communities. See how.
Added in API level 1

CheckedInputStream

open class CheckedInputStream : FilterInputStream
kotlin.Any
   ↳ java.io.InputStream
   ↳ java.io.FilterInputStream
   ↳ java.util.zip.CheckedInputStream

An input stream that also maintains a checksum of the data being read. The checksum can then be used to verify the integrity of the input data.

Summary

Public constructors

<init>(in: InputStream!, cksum: Checksum!)

Creates an input stream using the specified Checksum.

Public methods

open Checksum!

Returns the Checksum for this input stream.

open Int

Reads a byte.

open Int
read(buf: ByteArray!, off: Int, len: Int)

Reads into an array of bytes.

open Long
skip(n: Long)

Skips specified number of bytes of input.

Inherited functions

Inherited properties

Public constructors

<init>

Added in API level 1
CheckedInputStream(
    in: InputStream!,
    cksum: Checksum!)

Creates an input stream using the specified Checksum.

Parameters
in InputStream!: the input stream
cksum Checksum!: the Checksum

Public methods

getChecksum

Added in API level 1
open fun getChecksum(): Checksum!

Returns the Checksum for this input stream.

Return
Checksum! the Checksum value

read

Added in API level 1
open fun read(): Int

Reads a byte. Will block if no input is available.

Return
Int the byte read, or -1 if the end of the stream is reached.
Exceptions
java.io.IOException if an I/O error has occurred

read

Added in API level 1
open fun read(
    buf: ByteArray!,
    off: Int,
    len: Int
): Int

Reads into an array of bytes. If len is not zero, the method blocks until some input is available; otherwise, no bytes are read and 0 is returned.

Parameters
b the buffer into which the data is read.
off Int: the start offset in the destination array b
len Int: the maximum number of bytes read
buf ByteArray!: the buffer into which the data is read
Return
Int the actual number of bytes read, or -1 if the end of the stream is reached.
Exceptions
java.lang.NullPointerException If buf is null.
java.lang.IndexOutOfBoundsException If off is negative, len is negative, or len is greater than buf.length - off
java.io.IOException if an I/O error has occurred

skip

Added in API level 1
open fun skip(n: Long): Long

Skips specified number of bytes of input.

Parameters
n Long: the number of bytes to skip
Return
Long the actual number of bytes skipped
Exceptions
java.io.IOException if an I/O error has occurred