Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.NullOutputStream


public class QuotedPrintableOutputStreamBench {

    public static void main(String[] args) throws Exception {
        byte[] data = initData(1024);

        OutputStream nullOut = new NullOutputStream();
        QuotedPrintableOutputStream base64Out = new QuotedPrintableOutputStream(nullOut, true);

        // warmup

        for (int i = 0; i < 2000; i++) {
View Full Code Here


public class Base64OutputStreamBench {

    public static void main(String[] args) throws Exception {
        byte[] data = initData(1024);

        OutputStream nullOut = new NullOutputStream();
        Base64OutputStream base64Out = new Base64OutputStream(nullOut);

        // warmup

        for (int i = 0; i < 2000; i++) {
View Full Code Here

    public void testStrictUnexpectedEof() throws Exception {
        ByteArrayInputStream bis = new ByteArrayInputStream(
                fromString("VGhpcyBpcyB0aGUgcGxhaW4gdGV4dCBtZXNzYWdlI"));
        Base64InputStream decoder = new Base64InputStream(bis, true);
        try {
            CodecUtil.copy(decoder, new NullOutputStream());
            fail();
        } catch (IOException expected) {
            assertTrue(expected.getMessage().toLowerCase().contains(
                    "end of base64 stream"));
        }
View Full Code Here

    public void testStrictUnexpectedPad() throws Exception {
        ByteArrayInputStream bis = new ByteArrayInputStream(
                fromString("VGhpcyBpcyB0aGUgcGxhaW4gdGV4dCBtZXNzYWdlI="));
        Base64InputStream decoder = new Base64InputStream(bis, true);
        try {
            CodecUtil.copy(decoder, new NullOutputStream());
            fail();
        } catch (IOException expected) {
            assertTrue(expected.getMessage().toLowerCase().contains("pad"));
        }
    }
View Full Code Here

        Source src = new StreamSource(foFile);
       
        Transformer transformer = replicatorTemplates.newTransformer();
        transformer.setParameter("repeats", new Integer(replicatorRepeats));
       
        OutputStream out = new NullOutputStream(); //write to /dev/nul
        FOUserAgent userAgent = fopFactory.newFOUserAgent();
        userAgent.setBaseURL(foFile.getParentFile().toURL().toExternalForm());
        Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF, userAgent, out);
        Result res = new SAXResult(fop.getDefaultHandler());
       
View Full Code Here

    public void runTest() throws Exception {
        Node file = root.getNode("file" + (i++ % FILE_COUNT));
        Node content = file.getNode("jcr:content");
        InputStream stream = content.getProperty("jcr:data").getStream();
        try {
            IOUtils.copy(stream, new NullOutputStream());
        } finally {
            stream.close();
        }
    }
View Full Code Here

        for (int i = 0; i < FILE_COUNT; i++) {
            Node file = root.getNode("file" + i);
            Node content = file.getNode("jcr:content");
            InputStream stream = content.getProperty("jcr:data").getStream();
            try {
                IOUtils.copy(stream, new NullOutputStream());
            } finally {
                stream.close();
            }
        }
    }
View Full Code Here

        for (int i = 0; i < FILE_COUNT; i++) {
            Node file = root.getNode("file" + i);
            Node content = file.getNode("jcr:content");
            InputStream stream = content.getProperty("jcr:data").getStream();
            try {
                IOUtils.copy(stream, new NullOutputStream());
            } finally {
                stream.close();
            }
        }
    }
View Full Code Here

public class TIFFImageWriterTest extends TestCase {

    public void testJPEGWritingWithoutParams() throws Exception {
        //This used to generate a NPE when no ImageWriterParams were not set
        OutputStream out = new NullOutputStream();
        org.apache.xmlgraphics.image.writer.ImageWriter imageWriter = new TIFFImageWriter();
        BufferedImage image = new BufferedImage(200, 200, BufferedImage.TYPE_BYTE_GRAY);
        imageWriter.writeImage(image, out);
    }
View Full Code Here

        imageWriter.writeImage(image, out);
    }

    public void testJPEGWritingWithoutJPEGParams() throws Exception {
        //This used to generate a NPE because the JPEG encoding params were not set
        OutputStream out = new NullOutputStream();
        org.apache.xmlgraphics.image.writer.ImageWriter imageWriter = new TIFFImageWriter();
        MultiImageWriter writer = null;
        try {
            writer = imageWriter.createMultiImageWriter(out);
            // retrieve writer
View Full Code Here

TOP

Related Classes of org.apache.commons.io.output.NullOutputStream

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.