Package datasoul.util

Examples of datasoul.util.ZipWriter


   
    private void saveFile() {
        try {

            OutputStream os = null;
            ZipWriter zip = null;

            if (fileName.endsWith(".servicelist")){
                os = new FileOutputStream(fileName);
                zip = new ZipWriter(1);
            }else{
                zip = new ZipWriter(fileName, DatasoulMainForm.FILE_FORMAT_VERSION);
                os = zip.getOutputStream();
            }

            Node node = this.writeObject(zip);
            Document doc = node.getOwnerDocument();
            doc.appendChild(node);                        // Add Root to Document

            Source source = new DOMSource(doc);

            // Prepare the output file
            Result result = new StreamResult(os);

            // Write the DOM document to the file
            Transformer xformer = TransformerFactory.newInstance().newTransformer();
            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
            xformer.transform(source, result);

            if (fileName.endsWith(".servicelist")){
                os.close();
            }else{
                zip.close();
            }

        } catch (Exception e) {
            ShowDialog.showWriteFileError(fileName, e);
        }
View Full Code Here


        }else{

            String path = ConfigObj.getActiveInstance().getStoragePathTemplates();
            String filename = path + File.separator + this.getName()+".templatez";

            ZipWriter zip = new ZipWriter(filename, DatasoulMainForm.FILE_FORMAT_VERSION);
            Node node = this.writeObject(zip);
            Document doc = node.getOwnerDocument();
            doc.appendChild( node);                        // Add Root to Document

            Source source = new DOMSource(doc);

            // Prepare the output file
            Result result = new StreamResult(zip.getOutputStream());

            // Write the DOM document to the file
            Transformer xformer = TransformerFactory.newInstance().newTransformer();
            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
            xformer.transform(source, result);

            // Now, store meta data
            DisplayTemplateMetadata meta = new DisplayTemplateMetadata(this);
            meta.setFilename(filename);
            zip.startMetadata();
            meta.save(zip);

            TemplateManager.getInstance().addTemplateMetadata(meta);

            // Done, write images and close it
            zip.close();

        }
    }
View Full Code Here

TOP

Related Classes of datasoul.util.ZipWriter

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.