Package org.apache.commons.io.input

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


           
            //binary
            if(is != null) {
              rd.setBinary(is, fileLength);
            } else {
              rd.setBinary(new NullInputStream(0),0);
            }

            //properties
            List<Property<?>> properties = document.getProperties();
            String id = StringUtils.EMPTY;
View Full Code Here


    AudioInputStream wrapped;
    public boolean stopped;

    public SplitableAudioInputStream(AudioInputStream wrapped) {
        // this is really just to foil the parent. The parent should never be used.
        super(new NullInputStream(0), new AudioFormat(16000.0F, 16, 1, true, true), 0);
        this.wrapped = wrapped;
        this.stopped = false;
    }
View Full Code Here

          //binary
          if(fileLength>0 && document.getContentStream()!=null){
            is = document.getContentStream().getStream();
            rd.setBinary(is, fileLength);
          } else {
            rd.setBinary(new NullInputStream(0),0);
          }

          //properties
          List<Property<?>> properties = document.getProperties();
          String id = StringUtils.EMPTY;
View Full Code Here

        // Start the record with an arbitrary 14-digit date per RFC2540
        long now = System.currentTimeMillis();
        long recordLength = org.apache.commons.io.FileUtils.ONE_GB * 3;
      
        arcWriter.write("dummy:uri", "application/octet-stream",
            "0.1.2.3", now, recordLength, new NullInputStream(recordLength));
        arcWriter.close();
    }
View Full Code Here

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

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

        // Test integer methods
        IOUtils.copyLarge(mock, cos);
        try {
            cos.getCount();
            fail("Expected getCount() to throw an ArithmeticException");
        } catch (final ArithmeticException ae) {
            // expected result
        }
        try {
            cos.resetCount();
            fail("Expected resetCount() to throw an ArithmeticException");
        } catch (final 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

    /**
     * Test Copying file > 2GB  - see issue# IO-84
     */
    public void testCopy_inputStreamToOutputStream_IO84() throws Exception {
        final long size = (long)Integer.MAX_VALUE + (long)1;
        final InputStream  in  = new NullInputStream(size);
        final 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

     * 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

      {
        if (!getModule().getInputPipeTypes().containsKey(kv.getKey()))
          throw new PipetError("No such input port: "+kv.getKey());
       
        if (kv.getValue() == null)
          input_pipes.put(kv.getKey(), Collections.<InputStream>singleton(new NullInputStream(0)));
        else if (kv.getValue().equals("-"))
          input_pipes.put(kv.getKey(), Collections.<InputStream>singleton(System.in));
        else
          input_pipes.put(kv.getKey(), Collections.<InputStream>singleton(new FileInputStream(kv.getValue())));
      }
View Full Code Here

    @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

      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

TOP

Related Classes of org.apache.commons.io.input.NullInputStream

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.