Class sun.server.http.HttpOutputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class sun.server.http.HttpOutputStream

java.lang.Object
   |
   +----java.io.OutputStream
           |
           +----java.servlet.ServletOutputStream
                   |
                   +----sun.server.http.HttpOutputStream

public class HttpOutputStream
extends ServletOutputStream
A buffered output stream for writing HTTP server responses.

Variable Index

 o buf
The buffer where output data is stored.
 o chunking
Whether we are doing HTTP/1.1 chunking or not.
 o chunkOut
If we are doing chunking, delegate to this stream.
 o count
The number of bytes in the buffer.
 o out
The socket output stream.
 o written
Total number of bytes written so far.

Constructor Index

 o HttpOutputStream()
Creates a new output stream with a default buffer size.
 o HttpOutputStream(int)
Creates a new output stream with the specified buffer size.

Method Index

 o close()
Closes the output stream.
 o flush()
Flushes the output stream.
 o print(int)
Prints an integer.
 o print(long)
Prints a long.
 o print(String)
Prints an ASCII string.
 o println()
Prints CRLF.
 o println(int)
Prints an integer followed by CRLF.
 o println(long)
Prints an long followed by CRLF.
 o println(String)
Prints an ASCII string followed by CRLF.
 o reset(OutputStream)
Resets the output stream for a new connection.
 o size()
Returns the number of bytes written so far.
 o startChunking()
Use HTTP/1.1 chunking for output.
 o write(byte[], int, int)
Writes an array of bytes to the output stream.
 o write(int)
Writes a byte of data to the output stream.

Variables

 o out
  protected OutputStream out
The socket output stream.
 o buf
  protected byte buf[]
The buffer where output data is stored.
 o count
  protected int count
The number of bytes in the buffer.
 o written
  protected int written
Total number of bytes written so far.
 o chunking
  protected boolean chunking
Whether we are doing HTTP/1.1 chunking or not.
 o chunkOut
  protected ChunkedOutputStream chunkOut
If we are doing chunking, delegate to this stream.

Constructors

 o HttpOutputStream
  public HttpOutputStream(int size)
Creates a new output stream with the specified buffer size.
Parameters:
size - the output buffer size
 o HttpOutputStream
  public HttpOutputStream()
Creates a new output stream with a default buffer size.

Methods

 o reset
  public void reset(OutputStream out)
Resets the output stream for a new connection.
Parameters:
out - the socket output stream
 o startChunking
  public void startChunking()
Use HTTP/1.1 chunking for output.
 o size
  public int size()
Returns the number of bytes written so far.
 o write
  public void write(int b) throws IOException
Writes a byte of data to the output stream. This method will block until the byte is actually written.
Parameters:
b - the byte to be written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class OutputStream
 o write
  public void write(byte b[],
                    int off,
                    int len) throws IOException
Writes an array of bytes to the output stream. This method will block until all the bytes have been written.
Parameters:
b - the data to be written
off - the start offset of the data
len - the number of bytes to written
Throws: IOException
If an I/O error has occurred.
Overrides:
write in class OutputStream
 o flush
  public void flush() throws IOException
Flushes the output stream.
Throws: IOException
If an I/O error has occurred.
Overrides:
flush in class OutputStream
 o print
  public void print(String s) throws IOException
Prints an ASCII string.
Parameters:
s - the string to be printed
Throws: IOException
If an I/O error has occurred.
Overrides:
print in class ServletOutputStream
 o print
  public void print(int i) throws IOException
Prints an integer.
Parameters:
i - the integer to be printed
Throws: IOException
If an I/O error has occurred.
Overrides:
print in class ServletOutputStream
 o print
  public void print(long l) throws IOException
Prints a long.
Parameters:
l - the long to be printed
Throws: IOException
If an I/O error has occurred.
Overrides:
print in class ServletOutputStream
 o println
  public void println(String s) throws IOException
Prints an ASCII string followed by CRLF.
Parameters:
s - the string to be printed
Throws: IOException
If an I/O error has occurred.
Overrides:
println in class ServletOutputStream
 o println
  public void println(int i) throws IOException
Prints an integer followed by CRLF.
Parameters:
i - the integer to be printed.
Throws: IOException
If an I/O error has occurred.
Overrides:
println in class ServletOutputStream
 o println
  public void println(long l) throws IOException
Prints an long followed by CRLF.
Parameters:
i - the long to be printed.
Throws: IOException
If an I/O error has occurred.
Overrides:
println in class ServletOutputStream
 o println
  public void println() throws IOException
Prints CRLF.
Throws: IOException
If an I/O error has occurred.
Overrides:
println in class ServletOutputStream
 o close
  public void close()
Closes the output stream.
Overrides:
close in class OutputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index