当前位置: 首页>>代码示例>>Java>>正文


Java NullOutputStream.NULL_OUTPUT_STREAM属性代码示例

本文整理汇总了Java中org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM属性的典型用法代码示例。如果您正苦于以下问题:Java NullOutputStream.NULL_OUTPUT_STREAM属性的具体用法?Java NullOutputStream.NULL_OUTPUT_STREAM怎么用?Java NullOutputStream.NULL_OUTPUT_STREAM使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.apache.commons.io.output.NullOutputStream的用法示例。


在下文中一共展示了NullOutputStream.NULL_OUTPUT_STREAM属性的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testOutputStreamBigDataBigChunks

@Test
public void testOutputStreamBigDataBigChunks() {
  // don't run if the JVM doesn't have enough memory
  Assume.assumeTrue("testOutputStreamBigDataBigChunks: JVM has enough memory (~4GB)",
          Runtime.getRuntime().maxMemory() > 4e9);
  final int dataSize = (Integer.MAX_VALUE - 8) /*=max array size*/ - 5 /*=array header size*/;
  byte[] data = new byte[dataSize - 1];
  AutoBuffer ab = new AutoBuffer(NullOutputStream.NULL_OUTPUT_STREAM, false);
  // make sure the buffer can take the full array
  ab.putA1(data);
  // now try to stream 1TB of data through the buffer
  for (int i = 0; i < 512; i++) {
    if (i % 10 == 0)
      System.out.println(i);
    ab.putA1(data);
  }
  ab.close();
}
 
开发者ID:h2oai,项目名称:h2o-3,代码行数:18,代码来源:AutoBufferTest.java

示例2: computeTrailerSizeByVersion

private static int[] computeTrailerSizeByVersion() {
  int versionToSize[] = new int[HFile.MAX_FORMAT_VERSION + 1];
  for (int version = HFile.MIN_FORMAT_VERSION;
       version <= HFile.MAX_FORMAT_VERSION;
       ++version) {
    FixedFileTrailer fft = new FixedFileTrailer(version, HFileBlock.MINOR_VERSION_NO_CHECKSUM);
    DataOutputStream dos = new DataOutputStream(NullOutputStream.NULL_OUTPUT_STREAM);
    try {
      fft.serialize(dos);
    } catch (IOException ex) {
      // The above has no reason to fail.
      throw new RuntimeException(ex);
    }
    versionToSize[version] = dos.size();
  }
  return versionToSize;
}
 
开发者ID:cloud-software-foundation,项目名称:c5,代码行数:17,代码来源:FixedFileTrailer.java

示例3: getStream

/**
 * @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;
}
 
开发者ID:iterate-ch,项目名称:cyberduck,代码行数:10,代码来源:DelayedHttpEntity.java

示例4: testOfflineImageViewer

/**
 * 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"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestSnapshot.java

示例5: testTruncatedFSImage

@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"));
}
 
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:TestOfflineImageViewer.java

示例6: testOutputStreamBigDataSmallChunks

@Test
public void testOutputStreamBigDataSmallChunks() {
  final int dataSize = 100 * 1024;
  byte[] data = new byte[dataSize - 1];
  AutoBuffer ab = new AutoBuffer(NullOutputStream.NULL_OUTPUT_STREAM, false);
  // make sure the buffer can take full array
  ab.putA1(data);
  // try to stream 1TB of data made of small chunks through AutoBuffer
  for (int i = 0; i < 1e12 / dataSize; i++)
    ab.putA1(data);
  ab.close();
}
 
开发者ID:h2oai,项目名称:h2o-3,代码行数:12,代码来源:AutoBufferTest.java

示例7: testOutputStreamSmallData

@Test
public void testOutputStreamSmallData() {
  final int dataSize = 100 * 1024;
  byte[] data = new byte[dataSize];
  AutoBuffer ab = new AutoBuffer(NullOutputStream.NULL_OUTPUT_STREAM, false);
  // stream bite-size data to AutoBuffer
  for (int i = 0; i < Integer.MAX_VALUE / dataSize; i++)
    ab.putA1(data);
  ab.close();
}
 
开发者ID:h2oai,项目名称:h2o-3,代码行数:10,代码来源:AutoBufferTest.java

示例8: HashOrderDependent

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);
}
 
开发者ID:Netflix,项目名称:zeno,代码行数:9,代码来源:HashOrderDependent.java

示例9: CapturedStreamOutput

/**
 * @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);
    }
}
 
开发者ID:broadinstitute,项目名称:gatk,代码行数:46,代码来源:CapturedStreamOutput.java

示例10: NullObjectOutputStream

NullObjectOutputStream() throws IOException {
    super(NullOutputStream.NULL_OUTPUT_STREAM);
}
 
开发者ID:offbynull,项目名称:actors,代码行数:3,代码来源:BestEffortSerializer.java

示例11: CustomTrigWriter

public CustomTrigWriter(Set<String> usedPrefixes) {
	super(NullOutputStream.NULL_OUTPUT_STREAM);
	this.usedPrefixes = usedPrefixes;
}
 
开发者ID:Nanopublication,项目名称:nanopub-java,代码行数:4,代码来源:CustomTrigWriter.java

示例12: redirectOutput

/**
 * Redirects the process' output stream to given output stream.
 * If this method is invoked multiple times each call overwrites the previous.
 * Use {@link #redirectOutputAlsoTo(OutputStream)} if you want to redirect the output to multiple streams.
 *
 * @param output output stream where the process output is redirected to (<code>null</code> means {@link NullOutputStream} which acts like a <code>/dev/null</code>).
 * @return This process executor.
 */
public ProcessExecutor redirectOutput(OutputStream output) {
  if (output == null)
    output = NullOutputStream.NULL_OUTPUT_STREAM;
  PumpStreamHandler pumps = pumps();
  // Only set the output stream handler, preserve the same error stream handler
  return streams(new PumpStreamHandler(output, pumps == null ? null : pumps.getErr(), pumps == null ? null : pumps.getInput()));
}
 
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:15,代码来源:ProcessExecutor.java

示例13: redirectError

/**
 * Redirects the process' error stream to given output stream.
 * If this method is invoked multiple times each call overwrites the previous.
 * Use {@link #redirectErrorAlsoTo(OutputStream)} if you want to redirect the error to multiple streams.
 * <p>
 * Calling this method automatically disables merging the process error stream to its output stream.
 * </p>
 *
 * @param output output stream where the process error is redirected to (<code>null</code> means {@link NullOutputStream} which acts like a <code>/dev/null</code>).
 * @return This process executor.
 */
public ProcessExecutor redirectError(OutputStream output) {
  if (output == null)
    output = NullOutputStream.NULL_OUTPUT_STREAM;
  PumpStreamHandler pumps = pumps();
  // Only set the error stream handler, preserve the same output stream handler
  streams(new PumpStreamHandler(pumps == null ? null : pumps.getOut(), output, pumps == null ? null : pumps.getInput()));
  redirectErrorStream(false);
  return this;
}
 
开发者ID:zacharee,项目名称:RCTDRemoverforLG,代码行数:20,代码来源:ProcessExecutor.java


注:本文中的org.apache.commons.io.output.NullOutputStream.NULL_OUTPUT_STREAM属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。