Examples of ModifiableSource


Examples of org.apache.excalibur.source.ModifiableSource

        // Check that dest is writeable
        if (! (dest instanceof ModifiableSource)) {
            throw new IllegalArgumentException("Non-writeable URI : " + dest.getURI());
        }
       
        ModifiableSource wdest = (ModifiableSource)dest;
       
        // Get streams
        InputStream is = src.getInputStream();
        OutputStream os = wdest.getOutputStream();
       
        // And transfer all content.
        try {
            byte[] buffer = new byte[1024];
            int len;
            while ((len = is.read(buffer, 0, buffer.length)) > 0) {
                os.write(buffer, 0, len);
            }
            os.close();
        } catch(Exception e) {
            if (wdest.canCancel(os)) {
                wdest.cancel(os);
            }
        } finally {
            is.close();
        }
        // Success !
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.