JMRTD 0.4.6

org.jmrtd.lds
Class DG2File

java.lang.Object
  extended by org.jmrtd.lds.PassportFile
      extended by org.jmrtd.lds.DataGroup
          extended by org.jmrtd.lds.DG2File

public class DG2File
extends DataGroup

File structure for the EF_DG2 file. Datagroup 2 contains the facial features of the document holder. See A 13.3 in MRTD's LDS document. NOTE: multiple FaceInfos may be embedded in two ways: 1) as multiple images in the same record (see Fig. 3 in ISO/IEC 19794-5) 2) as multiple records (see A 13.3 in LDS technical report). For writing we choose option 2, because otherwise we have to precalc the total length of all FaceInfos, which sucks. -- CB

Version:
$Revision: 1208 $
Author:
Cees-Bart Breunesse (ceesb@cs.ru.nl), Martijn Oostdijk (martijn.oostdijk@gmail.com)

Field Summary
protected  List<byte[]> templates
           
 
Fields inherited from class org.jmrtd.lds.PassportFile
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
DG2File()
          Creates a new file with zero images.
DG2File(InputStream in)
          Creates a new file based on an input stream.
 
Method Summary
 void addFaceInfo(FaceInfo fi)
          Adds an image to this file.
 boolean equals(Object obj)
           
 byte[] getEncoded()
          Gets the contents of this file as byte array, includes the ICAO tag and length.
 List<FaceInfo> getFaceInfos()
          Gets the images in this file.
 int getTag()
          The data group tag.
 int hashCode()
           
protected  void readBiometricData(InputStream in, int valueLength)
          Reads the biometric data block.
 void removeFaceInfo(int index)
          Removes an image from this file.
 String toString()
          Gets a textual representation of this file.
 
Methods inherited from class org.jmrtd.lds.DataGroup
getLength
 
Methods inherited from class org.jmrtd.lds.PassportFile
createPassportFile, lookupDataGroupNumberByTag, lookupFIDByDataGroupNumber, lookupFIDByTag, lookupTagByDataGroupNumber, lookupTagByFID, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

templates

protected List<byte[]> templates
Constructor Detail

DG2File

public DG2File()
Creates a new file with zero images.


DG2File

public DG2File(InputStream in)
Creates a new file based on an input stream.

Parameters:
in - an input stream
Method Detail

readBiometricData

protected void readBiometricData(InputStream in,
                                 int valueLength)
                          throws IOException
Reads the biometric data block. This method should be implemented by concrete subclasses (DG2 - DG4 structures). It is assumed that the caller has already read the biometric data block tag (5F2E or 7F2E) and the length.

Parameters:
in - the input stream positioned so that biometric data block tag and length are already read
valueLength - the length
Throws:
IOException - if reading fails

getTag

public int getTag()
The data group tag.

Overrides:
getTag in class DataGroup
Returns:
the tag of the data group

addFaceInfo

public void addFaceInfo(FaceInfo fi)
Adds an image to this file.

Parameters:
fi - the image to add

removeFaceInfo

public void removeFaceInfo(int index)
Removes an image from this file.

Parameters:
index - the index of the image to remove

getEncoded

public byte[] getEncoded()
Description copied from class: PassportFile
Gets the contents of this file as byte array, includes the ICAO tag and length.

Returns:
a byte array containing the file

toString

public String toString()
Gets a textual representation of this file.

Returns:
a textual representation of this file

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getFaceInfos

public List<FaceInfo> getFaceInfos()
Gets the images in this file.

Returns:
the images

JMRTD 0.4.6