org.restlet.engine.http.io
Class ChunkedOutputStream

java.lang.Object
  extended by java.io.OutputStream
      extended by org.restlet.engine.http.io.ChunkedOutputStream
All Implemented Interfaces:
Closeable, Flushable

public class ChunkedOutputStream
extends OutputStream

OutputStream to write data in the HTTP chunked encoding format to a destination OutputStream. See section 3.6.1 of HTTP Protocol for more information on chunked encoding.

Author:
Kevin Conaway
See Also:
HTTP/1.1 Protocol

Constructor Summary
ChunkedOutputStream(OutputStream destination)
          Convenience constructor to use a default chunk size size of 2048.
ChunkedOutputStream(OutputStream destination, int chunkSize)
           
 
Method Summary
 void close()
          Closes this output stream for writing but does not close the wrapped stream.
 void flush()
          Writes the current chunk and flushes the wrapped stream.
 void write(int b)
           
 
Methods inherited from class java.io.OutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ChunkedOutputStream

public ChunkedOutputStream(OutputStream destination)
Convenience constructor to use a default chunk size size of 2048.

Parameters:
destination -
See Also:
ChunkedOutputStream(OutputStream, int)

ChunkedOutputStream

public ChunkedOutputStream(OutputStream destination,
                           int chunkSize)
Parameters:
destination - Outputstream to write chunked data to
chunkSize - Chunk size
Method Detail

close

public void close()
           throws IOException
Closes this output stream for writing but does not close the wrapped stream.

Specified by:
close in interface Closeable
Overrides:
close in class OutputStream
Throws:
IOException

flush

public void flush()
           throws IOException
Writes the current chunk and flushes the wrapped stream.

Specified by:
flush in interface Flushable
Overrides:
flush in class OutputStream
Throws:
IOException

write

public void write(int b)
           throws IOException
Specified by:
write in class OutputStream
Throws:
IOException


Copyright © 2005-2011 Noelios Technologies.