Package org.apache.commons.io.output

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


     */
    public void testLargeFiles_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;
        NullInputStream mock    = new NullInputStream(size);
        CountingInputStream cis = new CountingInputStream(mock);
        OutputStream out        = new NullOutputStream();

        // Test integer methods
        IOUtils.copyLarge(cis, out);
        try {
            cis.getCount();
View Full Code Here


            throw new IllegalArgumentException("Checksums can't be computed on directories");
        }
        InputStream in = null;
        try {
            in = new CheckedInputStream(new FileInputStream(file), checksum);
            IOUtils.copy(in, new NullOutputStream());
        } finally {
            IOUtils.closeQuietly(in);
        }
        return checksum;
    }
View Full Code Here

            throw new IllegalArgumentException("Checksums can't be computed on directories");
        }
        InputStream in = null;
        try {
            in = new CheckedInputStream(new FileInputStream(file), checksum);
            IOUtils.copy(in, new NullOutputStream());
        } finally {
            IOUtils.closeQuietly(in);
        }
        return checksum;
    }
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

    public void testArchiveBug4039() throws Exception {
        File tmp = Util.createTempDir();
        try {
            FilePath d = new FilePath(french,tmp.getPath());
            d.child("test").touch(0);
            d.zip(new NullOutputStream());
            d.zip(new NullOutputStream(),"**/*");
        } finally {
            Util.deleteRecursive(tmp);
        }
    }
View Full Code Here

                CertificateUtil.validatePath(certs,anchors);
            }

            // this is for computing a digest to check sanity
            MessageDigest sha1 = MessageDigest.getInstance("SHA1");
            DigestOutputStream dos = new DigestOutputStream(new NullOutputStream(),sha1);

            // this is for computing a signature
            Signature sig = Signature.getInstance("SHA1withRSA");
            sig.initVerify(certs.get(0));
            SignatureOutputStream sos = new SignatureOutputStream(sig);
View Full Code Here

        }


        private void testConnection(URL url) throws IOException {
            try {
                Util.copyStreamAndClose(ProxyConfiguration.open(url).getInputStream(),new NullOutputStream());
            } catch (SSLHandshakeException e) {
                if (e.getMessage().contains("PKIX path building failed"))
                   // fix up this crappy error message from JDK
                    throw new IOException2("Failed to validate the SSL certificate of "+url,e);
            }
View Full Code Here

            if (name.startsWith("META-INF/") && name.endsWith(".SF")) continue;
            if (name.startsWith("META-INF/") && name.endsWith(".RSA")) continue;
            if (name.startsWith("META-INF/") && name.endsWith(".DSA")) continue;

            // make sure bits are signed
            IOUtils.copy(myJar.getInputStream(entry), new NullOutputStream());
            if (entry.getCodeSigners()==null) {
                Assert.fail("No signature for " + name);
            }
        }
    }
View Full Code Here

            throw new IllegalArgumentException("Checksums can't be computed on directories");
        }
        InputStream in = null;
        try {
            in = new CheckedInputStream(new FileInputStream(file), checksum);
            IOUtils.copy(in, new NullOutputStream());
        } finally {
            IOUtils.closeQuietly(in);
        }
        return checksum;
    }
View Full Code Here

                            } else {
                                target = new TeeOutputStream(output,baos);
                            }
                        }
                        if (target == null){
                            target=new NullOutputStream();
                        }
                        input = ftp.retrieveFileStream(remote);
                        if (input == null){// Could not access file or other error
                            res.setResponseCode(Integer.toString(ftp.getReplyCode()));
                            res.setResponseMessage(ftp.getReplyString());
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.