org.apache.jackrabbit.mk.util
Class ChunkedInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.apache.jackrabbit.mk.util.ChunkedInputStream
All Implemented Interfaces:
Closeable

public class ChunkedInputStream
extends FilterInputStream

Input stream that reads and decodes HTTP chunks, assuming that no chunk exceeds 32768 bytes and that a chunk's length is represented by exactly 4 hexadecimal characters.


Field Summary
static int MAX_CHUNK_SIZE
          Maximum chunk size.
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ChunkedInputStream(InputStream in)
          Create a new instance of this class.
 
Method Summary
 void close()
          Close this input stream.
 int read()
           
 int read(byte[] b, int off, int len)
           
 void recycle(InputStream in)
          Recycle this input stream.
 
Methods inherited from class java.io.FilterInputStream
available, mark, markSupported, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_CHUNK_SIZE

public static final int MAX_CHUNK_SIZE
Maximum chunk size.

See Also:
Constant Field Values
Constructor Detail

ChunkedInputStream

public ChunkedInputStream(InputStream in)
Create a new instance of this class.

Parameters:
in - input stream
Method Detail

read

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

read

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

recycle

public void recycle(InputStream in)
Recycle this input stream.

Parameters:
in - new underlying input stream

close

public void close()
           throws IOException
Close this input stream. Finishes reading any pending chunks until the last chunk is received. Does not close the underlying input stream.

Specified by:
close in interface Closeable
Overrides:
close in class FilterInputStream
Throws:
IOException
See Also:
FilterInputStream.close()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.