Examples of NullInputStream


Examples of org.apache.commons.io.input.NullInputStream

    @Test
    public void streamIsFileItemStream() throws Exception
    {
        FileItem item = newMock(FileItem.class);
        InputStream stream = new NullInputStream(3);
        UploadedFileItem uploadedFile = new UploadedFileItem(item);

        expect(item.getInputStream()).andReturn(stream);

        replay();
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

        n.setProperty("jcr:encoding", "UTF-8");
        n.setProperty("jcr:mimeType", "text/plain");
        n.setProperty(
                "jcr:data",
                session.getValueFactory().createBinary(
                        new NullInputStream(1024 * 40)));
        testRootNode.getSession().save();

        String sql = "SELECT * FROM [nt:unstructured] as f "
                + " WHERE ISCHILDNODE([" + testRoot
                + "]) and type = 'testnode' ";
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

    /**
     * Test Copying file > 2GB  - see issue# IO-84
     */
    public void testCopy_inputStreamToOutputStream_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;
        InputStream  in  = new NullInputStream(size);
        OutputStream out = new NullOutputStream();

        // Test copy() method
        assertEquals(-1, IOUtils.copy(in, out));

        // reset the input
        in.close();

        // Test copyLarge() method
        assertEquals("copyLarge()", size, IOUtils.copyLarge(in, out));
    }
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

     * Test for files > 2GB in size - see issue IO-84
     */
    public void testLargeFiles_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;

        NullInputStream mock     = new NullInputStream(size);
        OutputStream nos         = new NullOutputStream();
        CountingOutputStream cos = new CountingOutputStream(nos);

        // Test integer methods
        IOUtils.copyLarge(mock, cos);
        try {
            cos.getCount();
            fail("Expected getCount() to throw an ArithmeticException");
        } catch (ArithmeticException ae) {
            // expected result
        }
        try {
            cos.resetCount();
            fail("Expected resetCount() to throw an ArithmeticException");
        } catch (ArithmeticException ae) {
            // expected result
        }

        mock.close();

        // Test long methods
        IOUtils.copyLarge(mock, cos);
        assertEquals("getByteCount()",   size, cos.getByteCount());
        assertEquals("resetByteCount()", size, cos.resetByteCount());
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

        long length = Long.parseLong(lengthHeader);
        Blob blob = new Blob(mediaType, length, null);

        if (length == 0 && is == null) {
            // Apparently when the length is 0, no InputStream is provided, therefore the following
            is = new NullInputStream(0);
        }

        OutputStream os = null;
        try {
            os = getTable(uriInfo).getOutputStream(blob);
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

                autoCommitSetting == null ? "" : autoCommitSetting);
        FileUtils.writeStringToFile(new File(solrConfDir, "solrconfig.xml"), solrConfigString);
    }

    private void createEmptyFile(File destination) throws IOException {
        FileUtils.copyInputStreamToFile(new NullInputStream(0), destination);
    }
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

     * Test for files > 2GB in size - see issue IO-84
     */
    public void testLargeFiles_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;

        NullInputStream mock     = new NullInputStream(size);
        OutputStream nos         = new NullOutputStream();
        CountingOutputStream cos = new CountingOutputStream(nos);

        // Test integer methods
        IOUtils.copyLarge(mock, cos);
        try {
            cos.getCount();
            fail("Expected getCount() to throw an ArithmeticException");
        } catch (ArithmeticException ae) {
            // expected result
        }
        try {
            cos.resetCount();
            fail("Expected resetCount() to throw an ArithmeticException");
        } catch (ArithmeticException ae) {
            // expected result
        }

        mock.close();

        // Test long methods
        IOUtils.copyLarge(mock, cos);
        assertEquals("getByteCount()",   size, cos.getByteCount());
        assertEquals("resetByteCount()", size, cos.resetByteCount());
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

    /**
     * Test Copying file > 2GB  - see issue# IO-84
     */
    public void testCopy_inputStreamToOutputStream_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;
        InputStream  in  = new NullInputStream(size);
        OutputStream out = new NullOutputStream();

        // Test copy() method
        assertEquals(-1, IOUtils.copy(in, out));

        // reset the input
        in.close();

        // Test copyLarge() method
        assertEquals("copyLarge()", size, IOUtils.copyLarge(in, out));
    }
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

    /**
     * Test Copying file > 2GB  - see issue# IO-84
     */
    public void testCopy_inputStreamToOutputStream_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;
        InputStream  in  = new NullInputStream(size);
        OutputStream out = new NullOutputStream();

        // Test copy() method
        assertEquals(-1, IOUtils.copy(in, out));

        // reset the input
        in.close();

        // Test copyLarge() method
        assertEquals("copyLarge()", size, IOUtils.copyLarge(in, out));
    }
View Full Code Here

Examples of org.apache.commons.io.input.NullInputStream

     * Test for files > 2GB in size - see issue IO-84
     */
    public void testLargeFiles_IO84() throws Exception {
        long size = (long)Integer.MAX_VALUE + (long)1;

        NullInputStream mock     = new NullInputStream(size);
        OutputStream nos         = new NullOutputStream();
        CountingOutputStream cos = new CountingOutputStream(nos);

        // Test integer methods
        IOUtils.copyLarge(mock, cos);
        try {
            cos.getCount();
            fail("Expected getCount() to throw an ArithmeticException");
        } catch (ArithmeticException ae) {
            // expected result
        }
        try {
            cos.resetCount();
            fail("Expected resetCount() to throw an ArithmeticException");
        } catch (ArithmeticException ae) {
            // expected result
        }

        mock.close();

        // Test long methods
        IOUtils.copyLarge(mock, cos);
        assertEquals("getByteCount()",   size, cos.getByteCount());
        assertEquals("resetByteCount()", size, cos.resetByteCount());
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.