Package com.xmlcalabash.io.DataStore

Examples of com.xmlcalabash.io.DataStore.DataWriter


        String href = getOption(_href).getString();

        try {
            final FoProcessor processor = provider;
            DataStore store = runtime.getDataStore();
            URI id = store.writeEntry(href, base, contentType, new DataWriter() {
                public void store(OutputStream content) throws IOException {
                    OutputStream out = new BufferedOutputStream(content);
                    try {
                        processor.format(source.read(),out,contentType);
                    } catch (SaxonApiException e) {
View Full Code Here


                }
                returnData(baos);
                return null;
            } else {
                DataStore store = runtime.getDataStore();
                return store.writeEntry(href, base, media, new DataWriter() {
                    public void store(OutputStream outstr)
                            throws IOException {
                        if (method == CompressionMethod.GZIP) {
                            GZIPOutputStream gzout = new GZIPOutputStream(outstr);
                            outstr = gzout;
View Full Code Here

                }
                returnData(baos);
                return null;
            } else {
                DataStore store = runtime.getDataStore();
                return store.writeEntry(href, base, media, new DataWriter() {
                    public void store(OutputStream outstr) throws IOException {
                        if (method == CompressionMethod.GZIP) {
                            GZIPOutputStream gzout = new GZIPOutputStream(outstr);
                            outstr = gzout;
                        }
View Full Code Here

                }
                returnData(baos);
                return null;
            } else {
                DataStore store = runtime.getDataStore();
                return store.writeEntry(href, base, media, new DataWriter() {
                    public void store(OutputStream outstr) throws IOException {
                        if (method == CompressionMethod.GZIP) {
                            GZIPOutputStream gzout = new GZIPOutputStream(outstr);
                            outstr = gzout;
                        }
View Full Code Here

                }
                returnData(baos);
                return null;
            } else {
                DataStore store = runtime.getDataStore();
                return store.writeEntry(href, base, media, new DataWriter() {
                    public void store(OutputStream outstr) throws IOException {
                        if (method == CompressionMethod.GZIP) {
                            GZIPOutputStream gzout = new GZIPOutputStream(outstr);
                            outstr = gzout;
                        }
View Full Code Here

  public void setUp() throws Exception {
    store = new FileDataStore(new FallbackDataStore());
  }

  public void testWriteFile() throws IOException {
    store.writeEntry("file.txt", tmp, "text/plain", new DataWriter() {
      public void store(OutputStream content) throws IOException {
        content.write("content".getBytes());
      }
    });
    store.readEntry("file.txt", tmp, "text/plain", null, new DataReader() {
View Full Code Here

    });
    store.deleteEntry("file.txt", tmp);
  }

  public void testWriteDirectory() throws IOException {
    URI file = store.writeEntry("dir/", tmp, "text/plain", new DataWriter() {
      public void store(OutputStream content) throws IOException {
        content.write("content".getBytes());
      }
    });
    store.infoEntry(file.getPath(), tmp, "text/plain", new DataInfo() {
View Full Code Here

    URI dir = store.createList("dir", tmp);
    assertTrue(new File(dir).isDirectory());
  }

  public void testDeleteEntry() throws IOException {
    URI file = store.writeEntry("dir/", tmp, "text/plain", new DataWriter() {
      public void store(OutputStream content) throws IOException {
        content.write("content".getBytes());
      }
    });
    assertTrue(new File(file).exists());
View Full Code Here

            final DataStore store = runtime.getDataStore();
            store.readEntry(href.getString(), href.getBaseURI().toASCIIString(), "*/*", null, new DataReader() {
                public void load(URI id, String media, final InputStream src, long len)
                        throws IOException {
                    RuntimeValue target = getOption(_target);
                    URI uri = store.writeEntry(target.getString(), target.getBaseURI().toASCIIString(), media, new DataWriter() {
                        public void store(OutputStream dst) throws IOException {
                            byte[] buffer = new byte[bufsize];
                            int read = src.read(buffer, 0, bufsize);
                            while (read >= 0) {
                                dst.write(buffer, 0, read);
View Full Code Here

            String base = href.getBaseURI().toASCIIString();
            store.readEntry(href.getString(), base, "*/*", null, new DataReader() {
                public void load(URI id, String media, final InputStream src, long len)
                        throws IOException {
                    RuntimeValue target = getOption(_target);
                    URI uri = store.writeEntry(target.getString(), target.getBaseURI().toASCIIString(), media, new DataWriter() {
                        public void store(OutputStream dst) throws IOException {
                            byte[] buffer = new byte[bufsize];
                            int read = src.read(buffer, 0, bufsize);
                            while (read >= 0) {
                                dst.write(buffer, 0, read);
View Full Code Here

TOP

Related Classes of com.xmlcalabash.io.DataStore.DataWriter

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.