Package com.google.common.io

Examples of com.google.common.io.NullOutputStream


    try {
      for (int i = 0; i < stms.length; i++) {
        stms[i] = fs.open(TEST_FILE);
      }
      for (InputStream stm : stms) {
        IOUtils.copyBytes(stm, new NullOutputStream(), 1024);
      }
    } finally {
      IOUtils.cleanup(null, stms);
    }
   
View Full Code Here


    try {
      for (int i = 0; i < stms.length; i++) {
        stms[i] = fs.open(TEST_FILE);
      }
      for (InputStream stm : stms) {
        IOUtils.copyBytes(stm, new NullOutputStream(), 1024);
      }
    } finally {
      IOUtils.cleanup(null, stms);
    }
   
View Full Code Here

  public TrHash(final Object toHash, final int maxSize) throws TrSerializableException {
    MessageDigest digest;
    try {
      digest = MessageDigest.getInstance("SHA-256");
      digest.reset();
      final DataOutputStream digOS = new DataOutputStream(new DigestOutputStream(new NullOutputStream(), digest));
      TrSerializer.serializeTo(toHash, digOS);
      hash = digest.digest();
    } catch (final NoSuchAlgorithmException e) {
      throw new RuntimeException(e);
    } catch (final IOException e) {
View Full Code Here

    @Test
    public void callableShouldBeRemotable() throws IOException {
        givenACallable();
       
        // WHEN callable is serialized
        ObjectOutputStream oos = new ObjectOutputStream(new NullOutputStream());
        oos.writeObject(callable);
        // THEN no NotSerializableException should have been thrown
        oos.close();
    }
View Full Code Here

    for (int version = MIN_FORMAT_VERSION;
         version <= MAX_FORMAT_VERSION;
         ++version) {
      FixedFileTrailer fft = new FixedFileTrailer(version,
                                   HFileBlock.MINOR_VERSION_NO_CHECKSUM);
      DataOutputStream dos = new DataOutputStream(new NullOutputStream());
      try {
        fft.serialize(dos);
      } catch (IOException ex) {
        // The above has no reason to fail.
        throw new RuntimeException(ex);
View Full Code Here

    try {
      for (int i = 0; i < stms.length; i++) {
        stms[i] = fs.open(TEST_FILE);
      }
      for (InputStream stm : stms) {
        IOUtils.copyBytes(stm, new NullOutputStream(), 1024);
      }
    } finally {
      IOUtils.cleanup(null, stms);
    }
   
View Full Code Here

    int versionToSize[] = new int[HFile.MAX_FORMAT_VERSION + 1];
    for (int version = MIN_FORMAT_VERSION;
         version <= MAX_FORMAT_VERSION;
         ++version) {
      FixedFileTrailer fft = new FixedFileTrailer(version);
      DataOutputStream dos = new DataOutputStream(new NullOutputStream());
      try {
        fft.serialize(dos);
      } catch (IOException ex) {
        // The above has no reason to fail.
        throw new RuntimeException(ex);
View Full Code Here

        InputStream is = null;
        try {
            is = new FileInputStream(file);
            MessageDigest md = MessageDigest.getInstance("SHA-1");
            DigestInputStream dis = new DigestInputStream(is, md);
            IOUtils.copyLarge(dis, new NullOutputStream());
            dis.close();
            byte[] bytes = dis.getMessageDigest().digest();
            return hex(bytes);
        } catch (NoSuchAlgorithmException e) {
            throw new UnhandledException(e);
View Full Code Here

  public OrderedSnapshotWriter(SnapshotWriter delegate)
      throws SnapshotWriterException{
    // The superclass is not actually used, but the Writer argument
    // cannot be null. We use a null sink.
    super(new OutputStreamWriter(new NullOutputStream()), null, null);
    this.delegate = delegate;
    this.maxWrittenSnapshot = null;
  }
View Full Code Here

    }

    private void testError(String path) throws Exception{
        try {
            URL url = new URL(new WebClient().getContextPath()+path);
            IOUtils.copy(url.openStream(), new NullOutputStream());
            fail("Should have been 404");
        } catch (FileNotFoundException e) {
            // expected
        }
    }
View Full Code Here

TOP

Related Classes of com.google.common.io.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.