Java Code Examples for org.apache.commons.io.output.NullOutputStream#NULL_OUTPUT_STREAM
The following examples show how to use
org.apache.commons.io.output.NullOutputStream#NULL_OUTPUT_STREAM .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DelayedHttpEntity.java From cyberduck with GNU General Public License v3.0 | 5 votes |
/** * @return The stream to write to after the entry signal was received. */ public OutputStream getStream() { if(null == stream) { // Nothing to write return NullOutputStream.NULL_OUTPUT_STREAM; } return stream; }
Example 2
Source File: DelayedHttpMultipartEntity.java From cyberduck with GNU General Public License v3.0 | 5 votes |
/** * @return The stream to write to after the entry signal was received. */ public OutputStream getStream() { if(null == stream) { // Nothing to write return NullOutputStream.NULL_OUTPUT_STREAM; } return stream; }
Example 3
Source File: TestSnapshot.java From hadoop with Apache License 2.0 | 5 votes |
/** * Test if the OfflineImageViewerPB can correctly parse a fsimage containing * snapshots */ @Test public void testOfflineImageViewer() throws Exception { runTestSnapshot(1); // retrieve the fsimage. Note that we already save namespace to fsimage at // the end of each iteration of runTestSnapshot. File originalFsimage = FSImageTestUtil.findLatestImageFile( FSImageTestUtil.getFSImage( cluster.getNameNode()).getStorage().getStorageDir(0)); assertNotNull("Didn't generate or can't find fsimage", originalFsimage); PrintStream o = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM); PBImageXmlWriter v = new PBImageXmlWriter(new Configuration(), o); v.visit(new RandomAccessFile(originalFsimage, "r")); }
Example 4
Source File: TestOfflineImageViewer.java From hadoop with Apache License 2.0 | 5 votes |
@Test(expected = IOException.class) public void testTruncatedFSImage() throws IOException { File truncatedFile = folder.newFile(); PrintStream output = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM); copyPartOfFile(originalFsimage, truncatedFile); new FileDistributionCalculator(new Configuration(), 0, 0, output) .visit(new RandomAccessFile(truncatedFile, "r")); }
Example 5
Source File: TestSnapshot.java From big-c with Apache License 2.0 | 5 votes |
/** * Test if the OfflineImageViewerPB can correctly parse a fsimage containing * snapshots */ @Test public void testOfflineImageViewer() throws Exception { runTestSnapshot(1); // retrieve the fsimage. Note that we already save namespace to fsimage at // the end of each iteration of runTestSnapshot. File originalFsimage = FSImageTestUtil.findLatestImageFile( FSImageTestUtil.getFSImage( cluster.getNameNode()).getStorage().getStorageDir(0)); assertNotNull("Didn't generate or can't find fsimage", originalFsimage); PrintStream o = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM); PBImageXmlWriter v = new PBImageXmlWriter(new Configuration(), o); v.visit(new RandomAccessFile(originalFsimage, "r")); }
Example 6
Source File: TestOfflineImageViewer.java From big-c with Apache License 2.0 | 5 votes |
@Test(expected = IOException.class) public void testTruncatedFSImage() throws IOException { File truncatedFile = folder.newFile(); PrintStream output = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM); copyPartOfFile(originalFsimage, truncatedFile); new FileDistributionCalculator(new Configuration(), 0, 0, output) .visit(new RandomAccessFile(truncatedFile, "r")); }
Example 7
Source File: HashOrderDependent.java From zeno with Apache License 2.0 | 5 votes |
public HashOrderDependent(){ try{ digest = MessageDigest.getInstance("MD5"); } catch ( Exception ex ) { throw new RuntimeException(ex); } digestOutputStream = new DigestOutputStream(NullOutputStream.NULL_OUTPUT_STREAM, digest); dataOutputStream = new DataOutputStream(digestOutputStream); }
Example 8
Source File: CapturedStreamOutput.java From gatk with BSD 3-Clause "New" or "Revised" License | 4 votes |
/** * @param settings Settings that define what to capture. * @param processStream Stream to capture output. * @param standardStream Stream to write debug output. */ public CapturedStreamOutput(OutputStreamSettings settings, InputStream processStream, PrintStream standardStream) { this.processStream = processStream; int bufferSize = settings.getBufferSize(); this.bufferStream = (bufferSize < 0) ? new ByteArrayOutputStream() : new ByteArrayOutputStream(bufferSize); for (StreamLocation location : settings.getStreamLocations()) { OutputStream outputStream; switch (location) { case Buffer: if (bufferSize < 0) { outputStream = this.bufferStream; } else { outputStream = new HardThresholdingOutputStream(bufferSize) { @Override protected OutputStream getStream() { return bufferTruncated ? NullOutputStream.NULL_OUTPUT_STREAM : bufferStream; } @Override protected void thresholdReached() { bufferTruncated = true; } }; } break; case File: try { outputStream = new FileOutputStream(settings.getOutputFile(), settings.isAppendFile()); } catch (IOException e) { throw new UserException.BadInput(e.getMessage()); } break; case Standard: outputStream = standardStream; break; default: throw new GATKException("Unexpected stream location: " + location); } this.outputStreams.put(location, outputStream); } }