Package org.apache.commons.io.output

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


            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


    }

    private String exec(File workingDir, org.apache.commons.exec.CommandLine cmdLine) throws Exception {
        Executor executor = new DefaultExecutor();
        org.apache.commons.io.output.ByteArrayOutputStream buffer = new org.apache.commons.io.output.ByteArrayOutputStream();
        NullOutputStream nullOs = new NullOutputStream();
        PumpStreamHandler streamHandler = new PumpStreamHandler(nullOs, buffer);
        executor.setWorkingDirectory(workingDir);
        executor.setStreamHandler(streamHandler);
        String result = "";

        try {
            exec(executor, cmdLine);
            result = buffer.toString();

        } finally {
            try {
                buffer.close();
                nullOs.close();
            } catch (Exception e) {
                // best effort
            }
        }
View Full Code Here

                ttfFile.toURI().toASCIIString());
        fontList.add(font);
        renderer.addFontList(fontList);
       
        ua.setRendererOverride(renderer);
        OutputStream out = new NullOutputStream();
       
        Fop fop = fopFactory.newFop(null, ua, out);
       
        TransformerFactory tFactory = TransformerFactory.newInstance();
        Source src = new StreamSource(new StringReader(
View Full Code Here

    public Checksum update( InputStream stream )
        throws IOException
    {
        DigestInputStream dig = new DigestInputStream( stream, md );
        IOUtils.copy( dig, new NullOutputStream() );

        return this;
    }
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

           * getXMLStreamReader() method will execute the actual request */
          if (i == (n - 1)) {
            return DBUtils.cloneAndReturnBuiltElement(result);
          } else {
              /* process the result of the request, no need to cache the data */
              result.serializeAndConsume(new NullOutputStream());
          }
        } catch (XMLStreamException e) {
          throw new DataServiceFault(e, "Error in request box result serializing");
        }
      }
View Full Code Here

   * the query is executed and the result set is stored.
   */
  public void prefetchData() throws DataServiceFault {
    try {
      XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance()
          .createXMLStreamWriter(new NullOutputStream());
      this.execute(xmlWriter, true);
    } catch (XMLStreamException e) {
      throw new DataServiceFault(e, "Error in pre-fetching data");
    }
  }
View Full Code Here

   * so a result is not expected.
   */
  public void executeInOnly() throws XMLStreamException {
    /* in case there is a result, write it to /dev/null */
    XMLStreamWriter xmlWriter = XMLOutputFactory.newInstance().
        createXMLStreamWriter(new NullOutputStream());
    this.serialize(xmlWriter);
  }
View Full Code Here

            //expected
        }
    }
   
    public void testBadRenderLifecycle() throws Exception {
        final PrintWriter pw = new PrintWriter(new NullOutputStream());
        final Object validity = new Object();
        try {
            this.portletAdaptor.generateKey();
            fail("IllegalStateException expected, no channel static data");
        }
View Full Code Here

        this.portletAdaptor.setPortalControlStructures(pcs);
        this.portletAdaptor.setRuntimeData(rd);

        final ChannelCacheKey channelCacheKey = new ChannelCacheKey();
        final Object validity = new Object();
        final PrintWriter pw = new PrintWriter(new NullOutputStream());
       
        EasyMock.reset(this.portletChannel);
        EasyMock.expect(this.portletChannel.generateKey(this.sd, pcs, rd)).andReturn(channelCacheKey).once();
        EasyMock.expect(this.portletChannel.isCacheValid(this.sd, pcs, rd, validity)).andReturn(false).once();
        this.portletChannel.render(this.sd, pcs, rd, pw);
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.