HashingInputStream.java 1.47 KB
package com.google.common.hash;

import com.google.common.annotations.Beta;
import com.google.common.base.Preconditions;
import java.io.FilterInputStream;
import java.io.IOException;
import java.io.InputStream;

@Beta
public final class HashingInputStream
  extends FilterInputStream
{
  private final Hasher a;
  
  public HashingInputStream(HashFunction paramHashFunction, InputStream paramInputStream)
  {
    super((InputStream)Preconditions.checkNotNull(paramInputStream));
    this.a = ((Hasher)Preconditions.checkNotNull(paramHashFunction.newHasher()));
  }
  
  public final HashCode hash()
  {
    return this.a.hash();
  }
  
  public final void mark(int paramInt) {}
  
  public final boolean markSupported()
  {
    return false;
  }
  
  public final int read()
    throws IOException
  {
    int i = this.in.read();
    if (i != -1) {
      this.a.putByte((byte)i);
    }
    return i;
  }
  
  public final int read(byte[] paramArrayOfByte, int paramInt1, int paramInt2)
    throws IOException
  {
    paramInt2 = this.in.read(paramArrayOfByte, paramInt1, paramInt2);
    if (paramInt2 != -1) {
      this.a.putBytes(paramArrayOfByte, paramInt1, paramInt2);
    }
    return paramInt2;
  }
  
  public final void reset()
    throws IOException
  {
    throw new IOException("reset not supported");
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/google/common/hash/HashingInputStream.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */