com.cloudera.sqoop.io
Class FixedLengthInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.apache.commons.io.input.ProxyInputStream
              extended by com.cloudera.sqoop.io.FixedLengthInputStream
All Implemented Interfaces:
java.io.Closeable

public class FixedLengthInputStream
extends org.apache.commons.io.input.ProxyInputStream

Provides an InputStream that can consume a fixed maximum number of bytes from an underlying stream. Closing the FixedLengthInputStream does not close the underlying stream. After reading the maximum number of available bytes this acts as though EOF has been reached.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
FixedLengthInputStream(java.io.InputStream stream, long maxLen)
           
 
Method Summary
 int available()
           
 int read()
           
 int read(byte[] buf)
           
 int read(byte[] buf, int start, int count)
           
 
Methods inherited from class org.apache.commons.io.input.ProxyInputStream
close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FixedLengthInputStream

public FixedLengthInputStream(java.io.InputStream stream,
                              long maxLen)
Method Detail

available

public int available()
              throws java.io.IOException
Overrides:
available in class org.apache.commons.io.input.ProxyInputStream
Throws:
java.io.IOException

read

public int read()
         throws java.io.IOException
Overrides:
read in class org.apache.commons.io.input.ProxyInputStream
Throws:
java.io.IOException

read

public int read(byte[] buf)
         throws java.io.IOException
Overrides:
read in class org.apache.commons.io.input.ProxyInputStream
Throws:
java.io.IOException

read

public int read(byte[] buf,
                int start,
                int count)
         throws java.io.IOException
Overrides:
read in class org.apache.commons.io.input.ProxyInputStream
Throws:
java.io.IOException


Copyright © 2010 Cloudera, Inc.