Package com.xmlcalabash.io

Examples of com.xmlcalabash.io.DataStore


        parseManifest(man);

        try {
            final String base = getOption(_href).getBaseURI().toASCIIString();
            final DataStore store = runtime.getDataStore();
            store.writeEntry(zipFn, base, "application/zip", new DataStore.DataWriter() {
                public void store(OutputStream content) throws IOException {
                    final ZipOutputStream outZip = new ZipOutputStream(content);
                    try {
                        store.readEntry(zipFn, base, "application/zip", null, new DataStore.DataReader() {
                            public void load(URI id, String media, InputStream content, long len)
                                    throws IOException {
                                ZipInputStream inZip = new ZipInputStream(content);
                                try {
                                    update(inZip, outZip);
                                } finally {
                                    inZip.close();
                                }
                            }
                        });
                    } catch (FileNotFoundException e) {
                        update(null, outZip);
                    } finally {
                        outZip.close();
                    }
                }
            });
        } catch (IOException e) {
            throw new XProcException(e);
        }

        try {
            final DatatypeFactory dfactory = DatatypeFactory.newInstance();
            DataStore store = runtime.getDataStore();
            store.readEntry(zipFn, zipFn, "application/zip, */*", null, new DataReader() {
                public void load(URI id, String media, InputStream stream,
                        long len) throws IOException {
                    read(id, stream, dfactory);
                }
            });
View Full Code Here


                    final ByteArrayOutputStream baos = new ByteArrayOutputStream();
                    if (srcManifest.containsKey(uri.toString())) {
                        XdmNode doc = srcManifest.get(href);
                        store(file, doc, baos);
                    } else {
                        DataStore store = runtime.getDataStore();
                        store.readEntry(href, href, "*/*", null, new DataReader() {
                            public void load(URI id, String media,
                                    InputStream stream, long len)
                                    throws IOException {
                                int read = stream.read(buffer, 0, bufsize);
                                while (read>0){
                                    baos.write(buffer,0,read);
                                    read = stream.read(buffer, 0, bufsize);
                                }
                            }
                        });
                    }
                    byte[] bytes =  baos.toByteArray();
                    ze.setSize(bytes.length);
                    crc.reset();
                    crc.update(bytes);
                    ze.setCrc(crc.getValue());
                }

                outZip.putNextEntry(ze);

                if (srcManifest.containsKey(href)) {
                    XdmNode doc = srcManifest.get(href);
                    store(file, doc, outZip);
                } else {
                    DataStore store = runtime.getDataStore();
                    store.readEntry(href, href, "*/*", null, new DataReader() {
                        public void load(URI id, String media,
                                InputStream stream, long len)
                                throws IOException {
                            int read = stream.read(buffer, 0, bufsize);
                            while (read >= 0) {
View Full Code Here

                Date date = new Date();
                return date.getTime();
            }

            final List<Long> list = new ArrayList<Long>(1);
            DataStore store = runtime.getDataStore();
            try {
                store.infoEntry(uri.toASCIIString(), uri.toASCIIString(), "*/*", new DataInfo() {
                    public void list(URI id, String media, long lastModified)
                            throws IOException {
                        list.add(lastModified);
                    }
                });
View Full Code Here

        uriResolver.setUnderlyingEntityResolver(resolver);
    }

    public synchronized DataStore getDataStore() {
        if (dataStore == null) {
            DataStore fallback = new URLDataStore(new FallbackDataStore());
            if (!getSafeMode()) {
                fallback = new FileDataStore(fallback);
            }
            dataStore = new HttpClientDataStore(getHttpClient(), fallback);
        }
View Full Code Here

TOP

Related Classes of com.xmlcalabash.io.DataStore

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.