Package org.jmrtd.lds.icao
Class COMFile
- java.lang.Object
-
- org.jmrtd.lds.AbstractTaggedLDSFile
-
- org.jmrtd.lds.icao.COMFile
-
- All Implemented Interfaces:
java.io.Serializable
,LDSElement
,LDSFile
public class COMFile extends AbstractTaggedLDSFile
File structure for the EF_COM file. This file contains the common data (version and data group presence table) information.- Version:
- $Revision: 1808 $
- Author:
- The JMRTD team ([email protected])
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from interface org.jmrtd.lds.LDSFile
EF_COM_TAG, EF_DG1_TAG, EF_DG10_TAG, EF_DG11_TAG, EF_DG12_TAG, EF_DG13_TAG, EF_DG14_TAG, EF_DG15_TAG, EF_DG16_TAG, EF_DG2_TAG, EF_DG3_TAG, EF_DG4_TAG, EF_DG5_TAG, EF_DG6_TAG, EF_DG7_TAG, EF_DG8_TAG, EF_DG9_TAG, EF_SOD_TAG
-
-
Constructor Summary
Constructors Constructor Description COMFile(java.io.InputStream in)
Constructs a new EF_COM file based on the encoded value inin
.COMFile(java.lang.String ldsVer, java.lang.String unicodeVer, int[] tagList)
Constructs a new COM file.COMFile(java.lang.String versionLDS, java.lang.String updateLevelLDS, java.lang.String majorVersionUnicode, java.lang.String minorVersionUnicode, java.lang.String releaseLevelUnicode, int[] tagList)
Constructs a new COM file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object other)
Whether other is equal to this file.byte[]
getEncoded()
Returns the contents of this file as byte array, includes the ICAO tag and length.java.lang.String
getLDSVersion()
Returns the LDS version as a dot seperated string containing version and update level.int[]
getTagList()
Returns the ICAO datagroup tags as a list of bytes.java.lang.String
getUnicodeVersion()
Returns the unicode version as a dot seperated string containing major version, minor version, and release level.int
hashCode()
void
insertTag(java.lang.Integer tag)
Inserts a tag in a proper place if not already present.protected void
readContent(java.io.InputStream in)
Reads the contents of the data group from an input stream.java.lang.String
toString()
Returns a textual representation of this file.protected void
writeContent(java.io.OutputStream out)
Writes the contents of the data group to an output stream.-
Methods inherited from class org.jmrtd.lds.AbstractTaggedLDSFile
getLength, getTag, readObject, writeObject
-
-
-
-
Constructor Detail
-
COMFile
public COMFile(java.lang.String versionLDS, java.lang.String updateLevelLDS, java.lang.String majorVersionUnicode, java.lang.String minorVersionUnicode, java.lang.String releaseLevelUnicode, int[] tagList)
Constructs a new COM file.- Parameters:
versionLDS
- a numerical string of length 2updateLevelLDS
- a numerical string of length 2majorVersionUnicode
- a numerical string of length 2minorVersionUnicode
- a numerical string of length 2releaseLevelUnicode
- a numerical string of length 2tagList
- a list of ICAO data group tags- Throws:
java.lang.IllegalArgumentException
- if the input is not well-formed
-
COMFile
public COMFile(java.lang.String ldsVer, java.lang.String unicodeVer, int[] tagList)
Constructs a new COM file.- Parameters:
ldsVer
- a "x.y" version numberunicodeVer
- a "x.y.z" version numbertagList
- list of tags
-
COMFile
public COMFile(java.io.InputStream in) throws java.io.IOException
Constructs a new EF_COM file based on the encoded value inin
.- Parameters:
in
- should contain a TLV object with appropriate tag and contents- Throws:
java.io.IOException
- if the input could not be decoded
-
-
Method Detail
-
readContent
protected void readContent(java.io.InputStream in) throws java.io.IOException
Description copied from class:AbstractTaggedLDSFile
Reads the contents of the data group from an input stream. Client code implementing this method should only read the contents from the input stream, not the tag or length of the data group.- Specified by:
readContent
in classAbstractTaggedLDSFile
- Parameters:
in
- the input stream to read from- Throws:
java.io.IOException
- on error reading from input stream
-
getLDSVersion
public java.lang.String getLDSVersion()
Returns the LDS version as a dot seperated string containing version and update level.- Returns:
- a string of the form "a.b"
-
getUnicodeVersion
public java.lang.String getUnicodeVersion()
Returns the unicode version as a dot seperated string containing major version, minor version, and release level.- Returns:
- a string of the form "aa.bb.cc"
-
getTagList
public int[] getTagList()
Returns the ICAO datagroup tags as a list of bytes.- Returns:
- a list of bytes
-
insertTag
public void insertTag(java.lang.Integer tag)
Inserts a tag in a proper place if not already present.- Parameters:
tag
- the tag to insert
-
writeContent
protected void writeContent(java.io.OutputStream out) throws java.io.IOException
Description copied from class:AbstractTaggedLDSFile
Writes the contents of the data group to an output stream. Client code implementing this method should only write the contents to the output stream, not the tag or length of the data group.- Specified by:
writeContent
in classAbstractTaggedLDSFile
- Parameters:
out
- the output stream to write to- Throws:
java.io.IOException
- on error writing to output stream
-
toString
public java.lang.String toString()
Returns a textual representation of this file.- Overrides:
toString
in classAbstractTaggedLDSFile
- Returns:
- a textual representation of this file
-
equals
public boolean equals(java.lang.Object other)
Whether other is equal to this file.- Overrides:
equals
in classjava.lang.Object
- Returns:
- a boolean
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getEncoded
public byte[] getEncoded()
Returns the contents of this file as byte array, includes the ICAO tag and length.- Specified by:
getEncoded
in interfaceLDSElement
- Returns:
- a byte array containing the file
-
-