@LimitedPrivate({"Common","HDFS","MapReduce","Yarn"})
@Unstable
public class CrcComposer
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
byte[] |
digest() |
Returns byte representation of composed CRCs; if no stripeLength was
specified, the digest should be of length equal to exactly one CRC.
|
static CrcComposer |
newCrcComposer(DataChecksum.Type type,
long bytesPerCrcHint) |
Returns a CrcComposer which will collapse all ingested CRCs into a single
value.
|
static CrcComposer |
newStripedCrcComposer(DataChecksum.Type type,
long bytesPerCrcHint,
long stripeLength) |
Returns a CrcComposer which will collapse CRCs for every combined
underlying data size which aligns with the specified stripe boundary.
|
void |
update(byte[] crcBuffer,
int offset,
int length,
long bytesPerCrc) |
Composes length / CRC_SIZE_IN_BYTES more CRCs from crcBuffer, with
each CRC expected to correspond to exactly
bytesPerCrc underlying
data bytes. |
void |
update(int crcB,
long bytesPerCrc) |
Updates with a single additional CRC which corresponds to an underlying
data size of
bytesPerCrc. |
void |
update(java.io.DataInputStream checksumIn,
long numChecksumsToRead,
long bytesPerCrc) |
Composes
numChecksumsToRead additional CRCs into the current digest
out of checksumIn, with each CRC expected to correspond to exactly
bytesPerCrc underlying data bytes. |
public static CrcComposer newCrcComposer(DataChecksum.Type type, long bytesPerCrcHint) throws java.io.IOException
type - type.bytesPerCrcHint - bytesPerCrcHint.java.io.IOException - raised on errors performing I/O.public static CrcComposer newStripedCrcComposer(DataChecksum.Type type, long bytesPerCrcHint, long stripeLength) throws java.io.IOException
type - type.bytesPerCrcHint - bytesPerCrcHint.stripeLength - stripeLength.java.io.IOException - raised on errors performing I/O.public void update(byte[] crcBuffer,
int offset,
int length,
long bytesPerCrc)
throws java.io.IOException
bytesPerCrc underlying
data bytes.crcBuffer - crcBuffer.offset - offset.length - must be a multiple of the expected byte-size of a CRC.bytesPerCrc - bytesPerCrc.java.io.IOException - raised on errors performing I/O.public void update(java.io.DataInputStream checksumIn,
long numChecksumsToRead,
long bytesPerCrc)
throws java.io.IOException
numChecksumsToRead additional CRCs into the current digest
out of checksumIn, with each CRC expected to correspond to exactly
bytesPerCrc underlying data bytes.checksumIn - checksumIn.numChecksumsToRead - numChecksumsToRead.bytesPerCrc - bytesPerCrc.java.io.IOException - raised on errors performing I/O.public void update(int crcB,
long bytesPerCrc)
throws java.io.IOException
bytesPerCrc.crcB - crcB.bytesPerCrc - bytesPerCrc.java.io.IOException - raised on errors performing I/O.public byte[] digest()
Copyright © 2008–2025 Apache Software Foundation. All rights reserved.