Package org.jmrtd.lds
Class AbstractTaggedLDSFile
- java.lang.Object
-
- org.jmrtd.lds.AbstractTaggedLDSFile
-
- All Implemented Interfaces:
Serializable
,LDSElement
,LDSFile
public abstract class AbstractTaggedLDSFile extends Object
Base class for TLV based LDS files.- Version:
- $Revision: 1799 $
- 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 Modifier Constructor Description protected
AbstractTaggedLDSFile(int dataGroupTag)
Constructs a data group.protected
AbstractTaggedLDSFile(int tag, InputStream inputStream)
Constructs a data group from the DER encoded data in the given input stream.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description byte[]
getEncoded()
Returns the contents of this file as byte array, includes the ICAO tag and length.int
getLength()
The length of the value of the data group.int
getTag()
Returns the tag that identifies this LDS file.protected abstract void
readContent(InputStream inputStream)
Reads the contents of the data group from an input stream.protected void
readObject(InputStream inputStream)
Reads the contents of this data group, including tag and length from an input stream.String
toString()
Returns a textual representation of this file.protected abstract void
writeContent(OutputStream outputStream)
Writes the contents of the data group to an output stream.protected void
writeObject(OutputStream outputStream)
Writes the file to an output stream.
-
-
-
Constructor Detail
-
AbstractTaggedLDSFile
protected AbstractTaggedLDSFile(int dataGroupTag)
Constructs a data group. This constructor is only visible to the other classes in this package.- Parameters:
dataGroupTag
- data group tag
-
AbstractTaggedLDSFile
protected AbstractTaggedLDSFile(int tag, InputStream inputStream) throws IOException
Constructs a data group from the DER encoded data in the given input stream.- Parameters:
tag
- the taginputStream
- an input stream- Throws:
IOException
- on error reading input stream
-
-
Method Detail
-
readObject
protected void readObject(InputStream inputStream) throws IOException
Reads the contents of this data group, including tag and length from an input stream.- Parameters:
inputStream
- the stream to read from- Throws:
IOException
- if reading from the stream fails
-
writeObject
protected void writeObject(OutputStream outputStream) throws IOException
Writes the file to an output stream.- Parameters:
outputStream
- the output stream to write to- Throws:
IOException
- if writing fails
-
readContent
protected abstract void readContent(InputStream inputStream) throws IOException
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.- Parameters:
inputStream
- the input stream to read from- Throws:
IOException
- on error reading from input stream
-
writeContent
protected abstract void writeContent(OutputStream outputStream) throws IOException
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.- Parameters:
outputStream
- the output stream to write to- Throws:
IOException
- on error writing to output stream
-
toString
public String toString()
Returns a textual representation of this file.
-
getTag
public int getTag()
Returns the tag that identifies this LDS file.- Returns:
- the tag of this LDS file
-
getLength
public int getLength()
The length of the value of the data group.- Returns:
- the length of the value of the data group
-
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
-
-