com.bumptech.glide.util
Class ContentLengthInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by com.bumptech.glide.util.ContentLengthInputStream
All Implemented Interfaces:
Closeable

public final class ContentLengthInputStream
extends FilterInputStream

Uses the content length as the basis for the return value of available() and verifies that at least content length bytes are returned from the various read methods.


Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Method Summary
 int available()
           
static InputStream obtain(InputStream other, long contentLength)
           
static InputStream obtain(InputStream other, String contentLengthHeader)
           
 int read()
           
 int read(byte[] buffer)
           
 int read(byte[] buffer, int byteOffset, int byteCount)
           
 
Methods inherited from class java.io.FilterInputStream
close, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

obtain

public static InputStream obtain(InputStream other,
                                 String contentLengthHeader)

obtain

public static InputStream obtain(InputStream other,
                                 long contentLength)

available

public int available()
              throws IOException
Overrides:
available in class FilterInputStream
Throws:
IOException

read

public int read()
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] buffer)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException

read

public int read(byte[] buffer,
                int byteOffset,
                int byteCount)
         throws IOException
Overrides:
read in class FilterInputStream
Throws:
IOException