Examples of NullInputStream


Examples of freenet.support.io.NullInputStream

       
    }

    @Override
    public InputStream getInputStreamUnbuffered() throws IOException {
        if(size() == 0) return new NullInputStream();
        if(isFreed){
            throw new IOException("This RandomAccessBuffer has already been closed. This should not"
                    + " happen.");
        }
        InputStream is = underlying.getInputStreamUnbuffered();
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 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

        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
    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

      File compressedLogFile = new File(logFile.getParentFile(), logFile.getName()+ ".gz");
      if (compressedLogFile.exists()) {
            return new GZIPInputStream(new FileInputStream(compressedLogFile));
      }
     
      return new NullInputStream(0);
    }
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
    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
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.