public class Checksum
extends java.lang.Object
implements org.apache.directory.api.asn1.Asn1Object
Checksum ::= SEQUENCE {
cksumtype [0] Int32,
checksum [1] OCTET STRING
}
| Modifier and Type | Field and Description |
|---|---|
private byte[] |
checksum
The byte array containing the checksum
|
private int |
checksumBytesLength |
private int |
checksumLength |
private int |
checksumTypeLength |
private ChecksumType |
cksumtype
The checksum type used
|
private static boolean |
IS_DEBUG
Speedup for logs
|
private static org.slf4j.Logger |
log
The logger
|
| Constructor and Description |
|---|
Checksum()
Creates a new instance of Checksum.
|
Checksum(ChecksumType cksumtype,
byte[] checksum)
Creates a new instance of Checksum.
|
| Modifier and Type | Method and Description |
|---|---|
int |
computeLength()
Compute the checksum length
|
java.nio.ByteBuffer |
encode(java.nio.ByteBuffer buffer)
Encode the Checksum message to a PDU.
|
boolean |
equals(java.lang.Object o) |
ChecksumType |
getChecksumType()
Returns the
ChecksumType. |
byte[] |
getChecksumValue()
Returns the checksum value.
|
int |
hashCode() |
void |
setChecksumType(ChecksumType cksumType)
Set the
ChecksumType. |
void |
setChecksumValue(byte[] checksum)
Set the checksum Value.
|
java.lang.String |
toString() |
java.lang.String |
toString(java.lang.String tabs) |
private static final org.slf4j.Logger log
private static final boolean IS_DEBUG
private ChecksumType cksumtype
private byte[] checksum
private int checksumTypeLength
private int checksumBytesLength
private int checksumLength
public Checksum()
public Checksum(ChecksumType cksumtype, byte[] checksum)
cksumtype - The checksum type usedchecksum - The checksum valuepublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.ObjectObject.equals(Object)public byte[] getChecksumValue()
public void setChecksumValue(byte[] checksum)
checksum - The checksum valuepublic ChecksumType getChecksumType()
ChecksumType.ChecksumType.public void setChecksumType(ChecksumType cksumType)
ChecksumType.cksumType - The checksum algorithm usedpublic int computeLength()
Checksum :
0x30 L1 checksum sequence
|
+--> 0xA0 L2 cksumtype tag
| |
| +--> 0x02 L2-1 cksumtype (int)
|
+--> 0xA1 L3 checksum tag
|
+--> 0x04 L3-1 checksum (OCTET STRING)
where L1 = L2 + lenght(0xA0) + length(L2) +
L3 + lenght(0xA1) + length(L3)
and
L2 = L2-1 + length(0x02) + length( L2-1)
L3 = L3-1 + length(0x04) + length( L3-1)
computeLength in interface org.apache.directory.api.asn1.Asn1Objectpublic java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
throws org.apache.directory.api.asn1.EncoderException
Checksum :
0x30 LL
0xA0 LL
0x02 0x01 cksumtype
0xA1 LL
0x04 LL Checksum
encode in interface org.apache.directory.api.asn1.Asn1Objectbuffer - The buffer where to put the PDU. It should have been allocated
before, with the right size.org.apache.directory.api.asn1.EncoderExceptionpublic java.lang.String toString()
toString in class java.lang.ObjectObject.toString()public java.lang.String toString(java.lang.String tabs)
Object.toString()