java.lang.Object
dev.hloth.zgztransport.CardId
- All Implemented Interfaces:
Encodable
The card id printed on the plastic, which block 2 holds as two letters and
one decimal digit per nibble, such as
BE322743.-
Method Summary
Modifier and TypeMethodDescriptionstatic CardIddecode(byte[] block) Decodes block 2.byte[]encode()Encodes this id into block 2, with its checksum.booleaninthashCode()static CardIdThe id that text spells.toString()The id as printed on the card: the two letters, then the digits with the trailing zero bytes the card pads with trimmed off.
-
Method Details
-
parse
The id that text spells.- Parameters:
text- two capital letters followed by an even count of 6 to 26 digits- Returns:
- the id
- Throws:
IllegalArgumentException- if the text is not in that form
-
decode
Decodes block 2. Only the checksum is checked, so an id printed from a damaged block can hold bytes thatparse(String)would not accept.- Parameters:
block- the sixteen bytes- Returns:
- the id
- Throws:
CardFormatException- if the block is not sixteen bytes or its checksum does not match
-
encode
public byte[] encode()Encodes this id into block 2, with its checksum. -
equals
-
hashCode
public int hashCode() -
toString
The id as printed on the card: the two letters, then the digits with the trailing zero bytes the card pads with trimmed off.
-