cascading.tap.hadoop.io
Class FSDigestInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.hadoop.fs.FSInputStream
          extended by cascading.tap.hadoop.io.FSDigestInputStream
All Implemented Interfaces:
Closeable, org.apache.hadoop.fs.PositionedReadable, org.apache.hadoop.fs.Seekable

public class FSDigestInputStream
extends org.apache.hadoop.fs.FSInputStream

Class FSDigestInputStream is an FSInputStream implementation that can verify a MessageDigest and will count the number of bytes read for use in progress status.


Constructor Summary
FSDigestInputStream(InputStream inputStream, MessageDigest messageDigest, String digestHex)
          Constructor FSDigestInputStream creates a new FSDigestInputStream instance.
FSDigestInputStream(InputStream inputStream, String digestHex)
          Constructor FSDigestInputStream creates a new FSDigestInputStream instance.
 
Method Summary
 void close()
           
 long getPos()
           
 int read()
           
 int read(byte[] b, int off, int len)
           
 void seek(long pos)
           
 boolean seekToNewSource(long targetPos)
           
 
Methods inherited from class org.apache.hadoop.fs.FSInputStream
read, readFully, readFully
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FSDigestInputStream

public FSDigestInputStream(InputStream inputStream,
                           String digestHex)
                    throws IOException
Constructor FSDigestInputStream creates a new FSDigestInputStream instance.

Parameters:
inputStream - of type InputStream
digestHex - of type String
Throws:
IOException - if unable to get md5 digest

FSDigestInputStream

public FSDigestInputStream(InputStream inputStream,
                           MessageDigest messageDigest,
                           String digestHex)
Constructor FSDigestInputStream creates a new FSDigestInputStream instance.

Parameters:
inputStream - of type InputStream
messageDigest - of type MessageDigest
digestHex - of type String
Method Detail

read

public int read()
         throws IOException
Specified by:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException
Overrides:
read in class InputStream
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

seek

public void seek(long pos)
          throws IOException
Specified by:
seek in interface org.apache.hadoop.fs.Seekable
Specified by:
seek in class org.apache.hadoop.fs.FSInputStream
Throws:
IOException

getPos

public long getPos()
            throws IOException
Specified by:
getPos in interface org.apache.hadoop.fs.Seekable
Specified by:
getPos in class org.apache.hadoop.fs.FSInputStream
Throws:
IOException

seekToNewSource

public boolean seekToNewSource(long targetPos)
                        throws IOException
Specified by:
seekToNewSource in interface org.apache.hadoop.fs.Seekable
Specified by:
seekToNewSource in class org.apache.hadoop.fs.FSInputStream
Throws:
IOException


Copyright © 2007-2013 Concurrent, Inc. All Rights Reserved.