*/
@Override
public IdentificationResultCollection process(
final InputStream in, final IdentificationResultCollection containerResults) throws IOException {
final IdentificationRequest request = new ContainerFileIdentificationRequest(null);
try {
request.open(in);
int maxBytesToScan = -1;
ContainerSignatureMatchCollection matches =
new ContainerSignatureMatchCollection(getContainerIdentifierInit().getContainerSignatures(),
getContainerIdentifierInit().getUniqueFileEntries(), maxBytesToScan);
getIdentifierEngine().process(request, matches);
final Map<String, String> puidMap = new HashMap<String, String>();
for (ContainerSignatureMatch match : matches.getContainerSignatureMatches()) {
if (match.isMatch()) {
List<FileFormatMapping> mappings = getFormats().get(match.getSignature().getId());
for (FileFormatMapping mapping : mappings) {
IdentificationResultImpl result = new IdentificationResultImpl();
result.setMethod(IdentificationMethod.CONTAINER);
result.setRequestMetaData(request.getRequestMetaData());
String puid = mapping.getPuid();
result.setPuid(mapping.getPuid());
if (!puidMap.containsKey(puid)) {
puidMap.put(puid, "");
containerResults.addResult(result);
}
}
}
}
request.close();
} finally {
if (in != null) {
in.close();
}
}