Package org.jmrtd.lds

Class AbstractTaggedLDSFile

    • 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 tag
        inputStream - 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.
        Overrides:
        toString in class Object
        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 interface LDSElement
        Returns:
        a byte array containing the file