Package uk.gov.nationalarchives.droid.core.signature

Examples of uk.gov.nationalarchives.droid.core.signature.FileFormatHit


        results.setRequestMetaData(request.getRequestMetaData());
        ByteReader byteReader = new IdentificationRequestByteReaderAdapter(request);
        sigFile.runFileIdentification(byteReader);
        final int numHits = byteReader.getNumHits();
        for (int i = 0; i < numHits; i++) {
            FileFormatHit hit = byteReader.getHit(i);
            IdentificationResultImpl result = new IdentificationResultImpl();
            result.setMimeType(hit.getMimeType());
            result.setName(hit.getFileFormatName());
            result.setVersion(hit.getFileFormatVersion());
            result.setPuid(hit.getFileFormatPUID());
            result.setMethod(IdentificationMethod.BINARY_SIGNATURE);
            results.addResult(result);
        }
        results.setFileLength(request.size());
        results.setRequestMetaData(request.getRequestMetaData());
View Full Code Here


        assertEquals(mySize, adapter.getNumBytes());
    }
   
    @Test
    public void testAddAndRemoveHits() {
        FileFormatHit hit0 = mock(FileFormatHit.class);
        FileFormatHit hit1 = mock(FileFormatHit.class);
        FileFormatHit hit2 = mock(FileFormatHit.class);
        assertEquals(0, adapter.getNumHits());

        adapter.addHit(hit0);
        adapter.addHit(hit1);
        adapter.addHit(hit2);
View Full Code Here

        for (InternalSignature internalSig : signatureList) {
            if (internalSig.isFileCompliant(targetFile)) {
                //File matches this internal signature
                targetFile.setPositiveIdent();
                for (int i = 0; i < internalSig.getNumFileFormats(); i++) {
                    FileFormatHit fileHit = new FileFormatHit(internalSig.getFileFormat(i), FileFormatHit.HIT_TYPE_POSITIVE_GENERIC_OR_SPECIFIC, internalSig.isSpecific(), "");
                    targetFile.addHit(fileHit);
                }
            }
        }
View Full Code Here

                //loop through all file formats with no internal signature
                for (int iFormat = 0; iFormat < this.getNumFileFormats(); iFormat++) {
                    if (this.getFileFormat(iFormat).getNumInternalSignatures() == 0) {
                        if (this.getFileFormat(iFormat).hasMatchingExtension(fileExtension)) {
                            //add this as a tentative hit
                            FileFormatHit fileHit = new FileFormatHit(this.getFileFormat(iFormat), FileFormatHit.HIT_TYPE_TENTATIVE, false, "");
                            targetFile.addHit(fileHit);
                            targetFile.setTentativeIdent();
                        }
                    }
                }//loop through file formats
View Full Code Here

        List<InternalSignature> matchingSigs = intSigs.getMatchingSignatures(targetFile, maxBytesToScan);
        for (InternalSignature internalSig : matchingSigs) {
            targetFile.setPositiveIdent();
            final int numFileFormats = internalSig.getNumFileFormats();
            for (int fileFormatIndex = 0; fileFormatIndex < numFileFormats; fileFormatIndex++) {
                final FileFormatHit fileHit =
                    new FileFormatHit(internalSig.getFileFormat(fileFormatIndex),
                                      FileFormatHit.HIT_TYPE_POSITIVE_GENERIC_OR_SPECIFIC,
                                      internalSig.isSpecific(), "");
                targetFile.addHit(fileHit);
            }
        }
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.core.signature.FileFormatHit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.