Package datasoul.util

Examples of datasoul.util.ZipReader


    public void openFile(String filename) {

        try{
            InputStream is = null;
            ZipReader zip = null;

            if (filename.endsWith(".servicelist")){
                is = new FileInputStream(filename);
                zip = new ZipReader(null, 1);
            }else{
                zip = new ZipReader(filename, DatasoulMainForm.FILE_FORMAT_VERSION);
                is = zip.getMainInputStream();
            }

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();

            //Using factory get an instance of document builder
            DocumentBuilder db = dbf.newDocumentBuilder();

            //parse using builder to get DOM representation of the XML file
            Document dom = db.parse(is);

            //node = dom.getDocumentElement().getChildNodes().item(0);
            Node node = dom.getElementsByTagName("ServiceListTable").item(0);

            this.readObject(node, zip);

            if (filename.endsWith(".servicelist")){
                is.close();
            }else{
                zip.close();
            }
        }catch (Exception e){
            ShowDialog.showReadFileError(filename, e);
        }
View Full Code Here


        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
       
        //Using factory get an instance of document builder
        DocumentBuilder db = dbf.newDocumentBuilder();

        ZipReader zip;
        Document dom;

        // Open the file
        if (filename.endsWith(".template")){
            // Older version
            zip = new ZipReader(null, 1);
            FileInputStream fis = new FileInputStream(filename);
            GZIPInputStream zis = null;
            try{
                zis = new GZIPInputStream(fis);
            }catch(IOException e){
                zis = null;
            }
            //parse using builder to get DOM representation of the XML file
            if (zis != null){
                // file in GZIP format
                dom = db.parse(zis);
            }else{
                // uncompressed file
                dom = db.parse(filename);
            }

        }else{
            // Newer format, zip
            zip = new ZipReader(filename, DatasoulMainForm.FILE_FORMAT_VERSION);
            dom = db.parse(zip.getMainInputStream());
        }
       
        Node node = dom.getElementsByTagName("DisplayTemplate").item(0);

        this.readObject(node, zip);
       
        // Close the input stream
        zip.close();

        // upgrade from older versions
       
        // version up to 1.2 had fixed resolution at 640x480
        if (getDatasoulFileVersion() < 1){
View Full Code Here

        this.targetContent = template.getTargetContentIdx();
    }

    public DisplayTemplateMetadata (String filename) throws Exception{
        this.filename = filename;
        ZipReader zip = new ZipReader(filename, DatasoulMainForm.FILE_FORMAT_VERSION);
        loadFromFile(zip);
        zip.close();
    }
View Full Code Here

    }

    public BufferedImage getMiniImage(){
        BufferedImage ret = null;
        try{
            ZipReader zip = new ZipReader(filename, DatasoulMainForm.FILE_FORMAT_VERSION);
            ret = ImageIO.read(zip.getInputStream(this.exampleImageName));
            zip.close();
        }catch(Exception e){
            e.printStackTrace();
        }
        return ret;
    }
View Full Code Here

TOP

Related Classes of datasoul.util.ZipReader

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.