class PassportService {
/**
* Reads the type of document.
* The ICAO documentation gives "P<" as an example.
*
* @return a string of length 2 containing the document type
* @throws IOException if something goes wrong
*/
public String readDocumentType() throws IOException {
byte[] fileData = readMRZ();
DataInputStream in = new DataInputStream(new ByteArrayInputStream(fileData));
byte[] result = new byte[2];
in.readFully(result);
return new String(result);
}
}