org.apache.commons.httpclient
Class RequestOutputStream

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

public class RequestOutputStream
extends java.io.OutputStream

OutputStream wrapper supporting the chunked transfer encoding.

Version:
$Revision: 1.14 $ $Date: 2002/08/05 14:46:05 $
Author:
Remy Maucherat, Sean C. Sullivan, dIon Gillard
See Also:
ResponseInputStream

Constructor Summary
RequestOutputStream(java.io.OutputStream stream)
          Construct an output stream wrapping the given stream.
RequestOutputStream(java.io.OutputStream stream, boolean useChunking)
          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.
 boolean isUseChunking()
          Use chunking flag getter.
 void print(java.lang.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(java.lang.String s)
          Writes a String to the client, followed by a carriage return-line feed (CRLF).
 void setUseChunking(boolean useChunking)
          Use chunking flag setter.
 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.
 
Methods inherited from class java.io.OutputStream
flush, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RequestOutputStream

public RequestOutputStream(java.io.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.

RequestOutputStream

public RequestOutputStream(java.io.OutputStream stream,
                           boolean useChunking)
Construct an output stream wrapping the given stream.
Parameters:
stream - wrapped output stream. Must be non-null.
useChunking - when true, the chunked transfer encoding will be used
Method Detail

setUseChunking

public void setUseChunking(boolean useChunking)
Use chunking flag setter.
Parameters:
useChunking - true if chunking is to be used, false otherwise

isUseChunking

public boolean isUseChunking()
Use chunking flag getter.
Returns:
true if chunking is to be used, false otherwise

print

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

println

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

println

public void println(java.lang.String s)
             throws java.io.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:
java.io.IOException - if an input or output exception occurred

write

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

write

public void write(byte[] b,
                  int off,
                  int len)
           throws java.io.IOException
Write the specified byte array.
Overrides:
write in class java.io.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:
java.io.IOException - when errors occur writing output

close

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


Copyright (c) 2001 - Apache Software Foundation