[ Web Proxy ]
URL:
Viewing: https://developer.android.com/reference/java/util/zip/CheckedInputStream [Back]  [Original]

CheckedInputStream  |  API reference  |  Android Developers Skip to main content
Essentials Design & Plan Develop Google Play Blog
Search:
Android Studio
Android Developers [Android Developers]
Stay organized with collections Save and categorize content based on your preferences.

CheckedInputStream

public class CheckedInputStream
extends FilterInputStream

java.lang.Object
   ↳ 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.

See also:

Summary

Inherited fields

Public constructors

CheckedInputStream(InputStream in, Checksum cksum)

Creates an input stream using the specified Checksum.

Public methods

Checksum getChecksum()

Returns the Checksum for this input stream.

int read()

Reads a byte.

int read(byte[] buf, int off, int len)

Reads into an array of bytes.

long skip(long n)

Skips specified number of bytes of input.

Inherited methods

Public constructors

CheckedInputStream

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

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
public Checksum getChecksum ()

Returns the Checksum for this input stream.

Returns
Checksum the Checksum value

read

Added in API level 1
public int read ()

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

Returns
int the byte read, or -1 if the end of the stream is reached.

Throws
IOException if an I/O error has occurred

read

Added in API level 1
public int read (byte[] buf, 
                int off, 
                int len)

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
buf byte: 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

Returns
int the actual number of bytes read, or -1 if the end of the stream is reached.

Throws
IOException if an I/O error has occurred
IndexOutOfBoundsException If off is negative, len is negative, or len is greater than buf.length - off
NullPointerException If buf is null.

skip

Added in API level 1
public long skip (long n)

Skips specified number of bytes of input.

Parameters
n long: the number of bytes to skip

Returns
long the actual number of bytes skipped

Throws
IOException if an I/O error has occurred

Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.

Last updated 2026-08-03 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-08-03 UTC."],[],[]]

Web Proxy Viewer  |  New URL  |  Original Page