public class PayloadChunk extends AbstractBlock implements Serializable
Modifier and Type | Field and Description |
---|---|
static int |
MIN_VALID_ID |
static long |
serialVersionUID |
CRLF
Constructor and Description |
---|
PayloadChunk()
Creates an empty payload block.
|
PayloadChunk(org.bouncycastle.asn1.ASN1Encodable to,
UsagePeriod period)
Creates a payload block from a ASN1 stream.
|
PayloadChunk(int id,
byte[] payload,
UsagePeriod period)
Creates a payload block from raw data.
|
Modifier and Type | Method and Description |
---|---|
String |
dumpValueNotation(String prefix,
DumpType dumpType)
Dumps the current object as a value representation.
|
boolean |
equals(Object o) |
int |
getId()
Gets the id of the payload chunk.
|
byte[] |
getPayload()
Gets the the currently set payload.
|
byte[] |
getReplyBlock()
Gets the the currently set reply block.
|
UsagePeriod |
getUsagePeriod() |
int |
hashCode() |
boolean |
isInUsagePeriod() |
boolean |
isInUsagePeriod(Date reference)
Checks if the usage period passed is fully embraced in the usage period.
|
protected void |
parse(org.bouncycastle.asn1.ASN1Encodable to) |
int |
setId(int id)
Sets the id of the payload chunk.
|
byte[] |
setPayload(byte[] b)
Set a byte array as payload.
|
byte[] |
setReplyBlock(byte[] reply)
Set a byte array as reply block.
|
UsagePeriod |
setUsagePeriod(UsagePeriod period)
Sets the usage period of the payload cunk.
|
org.bouncycastle.asn1.ASN1Object |
toAsn1Object(DumpType dumpType)
Creates a der encoded ASN1 representation of the payload chunk.
|
fromBase64, fromHex, parse, prepareDump, toBase64, toBitString, toBytes, toDer, toHex
public static final long serialVersionUID
public static final int MIN_VALID_ID
public PayloadChunk()
Creates an empty payload block.
public PayloadChunk(org.bouncycastle.asn1.ASN1Encodable to, UsagePeriod period) throws IOException
Creates a payload block from a ASN1 stream.
to
- the ASN.1 object of the PayloadCunk to be parsedperiod
- the validity period to be associated withIOException
- if parsing failspublic PayloadChunk(int id, byte[] payload, UsagePeriod period)
Creates a payload block from raw data.
id
- the payload locationpayload
- the payload contentperiod
- the validity period to be associated withpublic org.bouncycastle.asn1.ASN1Object toAsn1Object(DumpType dumpType) throws IOException
Creates a der encoded ASN1 representation of the payload chunk.
toAsn1Object
in interface Dumpable
dumpType
- the dump type to be usedIOException
- if id is too low or the payload has not been setpublic final byte[] setPayload(byte[] b)
Set a byte array as payload.
b
- the payload to be setpublic final byte[] getPayload()
Gets the the currently set payload.
public final byte[] setReplyBlock(byte[] reply)
Set a byte array as reply block.
reply
- the reply block to be setpublic final byte[] getReplyBlock()
Gets the the currently set reply block.
public final UsagePeriod getUsagePeriod()
public final UsagePeriod setUsagePeriod(UsagePeriod period)
Sets the usage period of the payload cunk.
period
- the new usage periodprotected final void parse(org.bouncycastle.asn1.ASN1Encodable to) throws IOException
parse
in class AbstractBlock
IOException
public final int setId(int id)
Sets the id of the payload chunk.
id
- the id to be setpublic final int getId()
Gets the id of the payload chunk.
public String dumpValueNotation(String prefix, DumpType dumpType) throws IOException
Dumps the current object as a value representation.
dumpValueNotation
in interface Block
prefix
- the prefix to be used (normally used for indentation)dumpType
- the dump type to be used (@see DumpType)IOException
- if the payload id is below MIN_VALID_ID or no payload/reply block
has been setpublic boolean isInUsagePeriod()
public boolean isInUsagePeriod(Date reference)
Checks if the usage period passed is fully embraced in the usage period.
reference
- the usage period to be embracedCopyright © 2023. All rights reserved.