Package uk.gov.nationalarchives.pronom

Examples of uk.gov.nationalarchives.pronom.SigFile


  }
 
  public static void downloadAllPronomFormatRecords(File outputFolder) throws Exception {
    //File outputFolder = new File("src/main/resources/uk/gov/nationalarchives/pronom/");
    //outputFolder.mkdirs();
    SigFile sigFile = SigFileUtils.getLatestSigFile();
    BigInteger version = sigFile.getFFSignatureFile().getVersion();
    System.out.println("Got version "+version);
    String filename = "droid-signature-file.xml";
    try {
      writeSigFileTypeToOutputStream( sigFile.getFFSignatureFile(),
          new FileOutputStream( new File( outputFolder, filename) ) );
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
      throw(e);
    }
    //
    File xmlFolder = new File(outputFolder,"xml"); xmlFolder.mkdir();
    try {
      for( FileFormatType fft : sigFile.getFFSignatureFile().getFileFormatCollection().getFileFormat() ) {
        String puid = fft.getPUID();
        String puidFilename = "puid."+puid.replace("/", ".")+".xml";
        FileOutputStream fos = new FileOutputStream(new File(xmlFolder, puidFilename) );
        URL repurl = getPronomUrlForPUID(puid);
        System.out.println("Downloading "+repurl);
View Full Code Here


      System.out.println("Setting");
            Authenticator.setDefault(
                new ProxyAuth( proxyUser, System.getProperty("http.proxyPassword") ) );
    }
   
    SigFile sigFile = SigFileUtils.getLatestSigFile();
    try {
      SigFileUtils.writeSigFileToOutputStream(sigFile, new FileOutputStream("signaturefile.xml"));
    } catch (FileNotFoundException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
View Full Code Here

  public static void main(String[] args) throws JAXBException, IOException {
    // Do it....
    downloadSigFile();
   
    // Sig file other download...
    SigFile sigFile = getLatestSigFile();
    System.out.println("SigFile v"+sigFile.getFFSignatureFile().getVersion());
    for( FileFormatType fft : sigFile.getFFSignatureFile().getFileFormatCollection().getFileFormat()) {
      System.out.println("PUID "+fft.getPUID());
    }
   
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    writeSigFileTypeToOutputStream(sigFile.getFFSignatureFile(),bos);
    // Turn it into a string:
    String xml = bos.toString("UTF-8");
    System.out.println(xml.substring(0, 500));
 
    // Write it to a file:
    String filename = "droid-signature_"+sigFile.getFFSignatureFile().getVersion()+".xml";
    writeSigFileTypeToOutputStream( sigFile.getFFSignatureFile(), new FileOutputStream(filename) );
   
    // Write it out raw:
    File raw = new File("droid-signature-raw_"+sigFile.getFFSignatureFile().getVersion()+".xml");
    writeSigFileToOutputStream( sigFile, new FileOutputStream(raw) );
   
    // Read it back:
    SignatureFileType s2 = readSigFileType( new File(filename) );
    System.out.println("Read back sigfile: "+s2.getVersion());
View Full Code Here

TOP

Related Classes of uk.gov.nationalarchives.pronom.SigFile

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.