org.apache.commons.httpclient
Class ChunkedOutputStream

java.lang.Object
  |
  +--java.io.OutputStream
        |
        +--org.apache.commons.httpclient.ChunkedOutputStream

public class ChunkedOutputStream
extends OutputStream

Wrapper supporting the chunked transfer encoding.

Since:
2.0
Version:
$Revision: 1.10.2.1 $ $Date: 2004/02/22 18:21:13 $
Author:
Remy Maucherat, Sean C. Sullivan, dIon Gillard, Oleg Kalnichevski, Mike Bowler
See Also:
ChunkedInputStream

Constructor Summary
ChunkedOutputStream(OutputStream stream)
          Construct an output stream wrapping the given stream.
 
Method Summary
 void close()
          Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.
 void flush()
          Flushes the underlying stream.
 void print(String s)
          Writes a String to the client, without a carriage return line feed (CRLF) character at the end.
 void println()
          Writes a carriage return-line feed (CRLF) to the client.
 void println(String s)
          Writes a String to the client, followed by a carriage return-line feed (CRLF).
 void write(byte[] b, int off, int len)
          Write the specified byte array.
 void write(int b)
          Write the specified byte to our output stream.
 void writeClosingChunk()
          Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException.
 
Methods inherited from class java.io.OutputStream
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 stream)
Construct an output stream wrapping the given stream. The stream will not use chunking.
Parameters:
stream - wrapped output stream. Must be non-null.
Method Detail

print

public void print(String s)
           throws IOException
Writes a String to the client, without a carriage return line feed (CRLF) character at the end. The platform default encoding is used!
Parameters:
s - the String to send to the client. Must be non-null.
Throws:
IOException - if an input or output exception occurred

println

public void println()
             throws IOException
Writes a carriage return-line feed (CRLF) to the client.
Throws:
IOException - if an input or output exception occurred

println

public void println(String s)
             throws IOException
Writes a String to the client, followed by a carriage return-line feed (CRLF).
Parameters:
s - the String to write to the client
Throws:
IOException - if an input or output exception occurred

write

public void write(int b)
           throws IOException,
                  IllegalStateException
Write the specified byte to our output stream.
Overrides:
write in class OutputStream
Parameters:
b - The byte to be written
Throws:
IOException - if an input/output error occurs
IllegalStateException - if stream already closed

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Write the specified byte array.
Overrides:
write in class OutputStream
Parameters:
b - the byte array to write out
off - the offset within b to start writing from
len - the length of data within b to write
Throws:
IOException - when errors occur writing output

writeClosingChunk

public void writeClosingChunk()
                       throws IOException
Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException. The underlying stream is not closed!
Throws:
IOException - if an error occurs closing the stream

flush

public void flush()
           throws IOException
Flushes the underlying stream.
Overrides:
flush in class OutputStream
Throws:
IOException - If an IO problem occurs.

close

public void close()
           throws IOException
Close this output stream, causing any buffered data to be flushed and any further output data to throw an IOException. The underlying stream is not closed!
Overrides:
close in class OutputStream
Throws:
IOException - if an error occurs closing the stream


Copyright © 2001-2004 Apache Software Foundation. All Rights Reserved.