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

Examples of uk.gov.nationalarchives.droid.core.signature.droid6.InternalSignatureComparator


        serializer.serialize(internalSigXml);
        xmlReader.parse(new InputSource(new StringReader(writer.getBuffer().toString())));
       
        InternalSignatureCollection sigs = (InternalSignatureCollection) mb.getModel();
        assertEquals(1, sigs.getInternalSignatures().size());
        InternalSignature sig = sigs.getInternalSignatures().get(0);
        assertEquals(2, sig.getByteSequences().size());
    }
View Full Code Here


     * @param entryName the name of the container file entry
     */
    public void matchFileEntry(String entryName) {
        if (unmatchedFiles.contains(entryName)) {
            //String textSig = signature.getFiles().get(entryName).getTextSignature();
            InternalSignatureCollection binSigs = signature.getFiles().get(entryName).getCompiledBinarySignatures();
            //if (textSig == null && binSig == null) {
            if (binSigs == null) {
                unmatchedFiles.remove(entryName);
            }
        }
View Full Code Here

     * @return true if this file is subject to a text signature; false otherwise
     */
    public boolean needsBinaryMatch(String entryName) {
        boolean needsMatch = false;
        if (unmatchedFiles.contains(entryName)) {
            InternalSignatureCollection binarySigs = signature.getFiles().get(entryName).getCompiledBinarySignatures();
            needsMatch = binarySigs != null;
        }
        return needsMatch;
    }
View Full Code Here

     */
    public void matchBinaryContent(String entryName, ByteReader content) {
        boolean matched = true;
        if (unmatchedFiles.contains(entryName)) {
            Map<String, ContainerFile> sigFiles = signature.getFiles();
            InternalSignatureCollection binSigs = sigFiles.get(entryName).getCompiledBinarySignatures();
            if (binSigs != null) {
                matched = binSigs.getMatchingSignatures(content, maxBytesToScan).size() > 0;
            }
            if (matched) {
                unmatchedFiles.remove(entryName);
            }
        }
View Full Code Here

        serializer.setOutputCharStream(writer);

        serializer.serialize(internalSigXml);
        xmlReader.parse(new InputSource(new StringReader(writer.getBuffer().toString())));
       
        InternalSignatureCollection sigs = (InternalSignatureCollection) mb.getModel();
        assertEquals(1, sigs.getInternalSignatures().size());
        InternalSignature sig = sigs.getInternalSignatures().get(0);
        assertEquals(2, sig.getByteSequences().size());
    }
View Full Code Here

                new BinarySignatureXMLParser<InternalSignatureCollection>();
            Element element = binarySignatures.getElement();
            try {
                signatures = signatureParser.fromXmlElement(element);
                signatures.prepareForUse();
                signatures.sortSignatures(new InternalSignatureComparator());
            } catch (SignatureParseException e) {
                compileError = true;
                signatures = null;
                String message = String.format("Could not parse signature:\n%s", element.getTextContent());
                log.warn(message);
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.core.signature.droid6.InternalSignatureComparator

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.