public class BooleanType extends AbstractDERType implements DEREncoder
Modifier and Type | Field and Description |
---|---|
private byte[] |
derItem
Boolean to encode.
|
private static byte |
FALSE_BYTE
Boolean false byte representation.
|
private static byte |
TRUE_BYTE
Boolean true byte representation.
|
Constructor and Description |
---|
BooleanType(boolean item)
Creates a new boolean type.
|
BooleanType(DERTag tag,
boolean item)
Creates a new boolean type.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
decode(ByteBuffer encoded)
Converts bytes in the buffer to a boolean by reading from the current position to the limit.
|
byte[] |
encode()
Encode this object into it's DER type.
|
static byte[] |
toBytes(boolean b)
Converts the supplied boolean to a byte array.
|
encode, readBuffer
private static final byte TRUE_BYTE
private static final byte FALSE_BYTE
private final byte[] derItem
public BooleanType(boolean item)
item
- to DER encodepublic BooleanType(DERTag tag, boolean item)
tag
- der tag associated with this typeitem
- to DER encodeIllegalArgumentException
- if the der tag is constructedpublic byte[] encode()
DEREncoder
encode
in interface DEREncoder
public static boolean decode(ByteBuffer encoded)
encoded
- buffer containing DER-encoded data where the buffer is positioned at the start of boolean bytes
and the limit is set beyond the last byte of integer data.public static byte[] toBytes(boolean b)
b
- to convertCopyright © 2003-2019 Virginia Tech. All Rights Reserved.