org.apache.commons.io.output.NullOutputStream#NULL_OUTPUT_STREAM源码实例Demo

下面列出了org.apache.commons.io.output.NullOutputStream#NULL_OUTPUT_STREAM 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: cyberduck   文件: DelayedHttpEntity.java
/**
 * @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;
}
 
源代码2 项目: cyberduck   文件: DelayedHttpMultipartEntity.java
/**
 * @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;
}
 
源代码3 项目: hadoop   文件: TestSnapshot.java
/**
 * 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"));
}
 
源代码4 项目: hadoop   文件: TestOfflineImageViewer.java
@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"));
}
 
源代码5 项目: big-c   文件: TestSnapshot.java
/**
 * 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"));
}
 
源代码6 项目: big-c   文件: TestOfflineImageViewer.java
@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"));
}
 
源代码7 项目: zeno   文件: HashOrderDependent.java
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);
}
 
源代码8 项目: gatk   文件: CapturedStreamOutput.java
/**
 * @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);
    }
}