Package uk.gov.nationalarchives.droid.command

Examples of uk.gov.nationalarchives.droid.command.ResultPrinter


                        final TarEntryIdentificationRequest tarRequest =
                            new TarEntryIdentificationRequest(metaData, identifier, tmpDir);
                        tarRequest.open(in);
                        final IdentificationResultCollection tarResults =
                                binarySignatureIdentifier.matchBinarySignatures(tarRequest);
                        final ResultPrinter resultPrinter =
                                new ResultPrinter(binarySignatureIdentifier,
                                    containerSignatureDefinitions, newPath, slash, slash1, true);
                        resultPrinter.print(tarResults, tarRequest);
                    }
                }
            } finally {
                if (in != null) {
                    in.close();
View Full Code Here


            gzRequest.open(gzin);
            final IdentificationResultCollection gzResults =
                     binarySignatureIdentifier.matchBinarySignatures(gzRequest);
           
            final ResultPrinter resultPrinter = new ResultPrinter(binarySignatureIdentifier,
                    containerSignatureDefinitions, newPath, slash, slash1, true);
            resultPrinter.print(gzResults, gzRequest);
        } catch (IOException ioe) {
            System.err.println(ioe + " (" + newPath + ")"); // continue after corrupt archive
        } finally {
            if (gzin != null) {
                try {
View Full Code Here

                            new ZipEntryIdentificationRequest(metaData, identifier, tmpDir);
                       
                        zipRequest.open(in);
                        final IdentificationResultCollection zipResults =
                                binarySignatureIdentifier.matchBinarySignatures(zipRequest);
                        final ResultPrinter resultPrinter =
                                new ResultPrinter(binarySignatureIdentifier,
                                    containerSignatureDefinitions, newPath, slash, slash1, true);
                        resultPrinter.print(zipResults, zipRequest);
                    }
                }
            } finally {
                if (in != null) {
                    in.close();
View Full Code Here

              }
            }
        }
       
        path = "";
        ResultPrinter resultPrinter =
            new ResultPrinter(binarySignatureIdentifier, containerSignatureDefinitions,
                path, slash, slash1, archives);

        String fileName = null;
        for (File file : matchedFiles) {
            try {
                fileName = file.getCanonicalPath();
            } catch (IOException e) {
                throw new CommandExecutionException(e);
            }
            URI uri = file.toURI();
            RequestMetaData metaData =
                new RequestMetaData(file.length(), file.lastModified(), fileName);
            RequestIdentifier identifier = new RequestIdentifier(uri);
            identifier.setParentId(1L);
           
            InputStream in = null;
            IdentificationRequest request = new FileSystemIdentificationRequest(metaData, identifier);
            try {
                in = new FileInputStream(file);
                request.open(in);
                IdentificationResultCollection results =
                    binarySignatureIdentifier.matchBinarySignatures(request);
               
                resultPrinter.print(results, request);
            } catch (FileNotFoundException fnfe) {
              log.error("error processing files", fnfe);
              throw new CommandExecutionException(fnfe);
            } catch (IOException e) {
                throw new CommandExecutionException(e);
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.droid.command.ResultPrinter

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.