# CRC32C

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Ctors](https://developer.android.com/reference/java/util/zip/CRC32C#pubctors)\|[Methods](https://developer.android.com/reference/java/util/zip/CRC32C#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/java/util/zip/CRC32C#inhmethods)  

# CRC32C

`
public

final

class
CRC32C
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Checksum](https://developer.android.com/reference/java/util/zip/Checksum)`


`

|---|----------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | java.util.zip.CRC32C |

<br />

*** ** * ** ***

A class that can be used to compute the CRC-32C of a data stream.

CRC-32C is defined in[RFC 3720](http://www.ietf.org/rfc/rfc3720.txt): Internet Small Computer Systems Interface (iSCSI).

Passing a`null`argument to a method in this class will cause a[NullPointerException](https://developer.android.com/reference/java/lang/NullPointerException)to be thrown.

<br />

## Summary

|                                                 ### Public constructors                                                 ||
|----------------------------------------------------------------------------------------------------------------------|---|
| ` `[CRC32C](https://developer.android.com/reference/java/util/zip/CRC32C#CRC32C())`() ` Creates a new CRC32C object. |

|                                                                                                                              ### Public methods                                                                                                                              ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` long` | ` `[getValue](https://developer.android.com/reference/java/util/zip/CRC32C#getValue())`() ` Returns CRC-32C value.                                                                                                                                                  |
| ` void` | ` `[reset](https://developer.android.com/reference/java/util/zip/CRC32C#reset())`() ` Resets CRC-32C to initial value.                                                                                                                                              |
| ` void` | ` `[update](https://developer.android.com/reference/java/util/zip/CRC32C#update(java.nio.ByteBuffer))`(`[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` buffer) ` Updates the CRC-32C checksum with the bytes from the specified buffer. |
| ` void` | ` `[update](https://developer.android.com/reference/java/util/zip/CRC32C#update(byte[],%20int,%20int))`(byte[] b, int off, int len) ` Updates the CRC-32C checksum with the specified array of bytes.                                                               |
| ` void` | ` `[update](https://developer.android.com/reference/java/util/zip/CRC32C#update(int))`(int b) ` Updates the CRC-32C checksum with the specified byte (the low eight bits of the argument b).                                                                        |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||
| From interface` `[java.util.zip.Checksum](https://developer.android.com/reference/java/util/zip/Checksum)` ` |------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract long` | ` `[getValue](https://developer.android.com/reference/java/util/zip/Checksum#getValue())`() ` Returns the current checksum value.                                                                                                                                     | | ` abstract void` | ` `[reset](https://developer.android.com/reference/java/util/zip/Checksum#reset())`() ` Resets the checksum to its initial value.                                                                                                                                     | | ` default void`  | ` `[update](https://developer.android.com/reference/java/util/zip/Checksum#update(byte[]))`(byte[] b) ` Updates the current checksum with the specified array of bytes.                                                                                               | | ` default void`  | ` `[update](https://developer.android.com/reference/java/util/zip/Checksum#update(java.nio.ByteBuffer))`(`[ByteBuffer](https://developer.android.com/reference/java/nio/ByteBuffer)` buffer) ` Updates the current checksum with the bytes from the specified buffer. | | ` abstract void` | ` `[update](https://developer.android.com/reference/java/util/zip/Checksum#update(byte[],%20int,%20int))`(byte[] b, int off, int len) ` Updates the current checksum with the specified array of bytes.                                                               | | ` abstract void` | ` `[update](https://developer.android.com/reference/java/util/zip/Checksum#update(int))`(int b) ` Updates the current checksum with the specified byte.                                                                                                               | ||

## Public constructors

### CRC32C

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public CRC32C ()
```

Creates a new CRC32C object.

<br />

## Public methods

### getValue

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public long getValue ()
```

Returns CRC-32C value.

<br />

|                  Returns                  ||
|--------|-----------------------------------|
| `long` | the current checksum value <br /> |

### reset

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void reset ()
```

Resets CRC-32C to initial value.

<br />

### update

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void update (ByteBuffer buffer)
```

Updates the CRC-32C checksum with the bytes from the specified buffer. The checksum is updated with the remaining bytes in the buffer, starting at the buffer's position. Upon return, the buffer's position will be updated to its limit; its limit will not have been changed.

<br />

|                                Parameters                                 ||
|----------|-----------------------------------------------------------------|
| `buffer` | `ByteBuffer`: the ByteBuffer to update the checksum with <br /> |

### update

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void update (byte[] b, 
                int off, 
                int len)
```

Updates the CRC-32C checksum with the specified array of bytes.

<br />

|                            Parameters                            ||
|-------|-----------------------------------------------------------|
| `b`   | `byte`: the byte array to update the checksum with <br /> |
| `off` | `int`: the start offset of the data <br />                |
| `len` | `int`: the number of bytes to use for the update <br />   |

|                                                                                                             Throws                                                                                                             ||
|--------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------|
| [ArrayIndexOutOfBoundsException](https://developer.android.com/reference/java/lang/ArrayIndexOutOfBoundsException) | if`off`is negative, or`len`is negative, or`off+len`is negative or greater than the length of the array`b`. |

### update

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

```
public void update (int b)
```

Updates the CRC-32C checksum with the specified byte (the low eight bits of the argument b).

<br />

|                       Parameters                        ||
|-----|----------------------------------------------------|
| `b` | `int`: the byte to update the checksum with <br /> |