public class

ChunkedOutputStream

extends PrintStream
java.lang.Object
   ↳ java.io.OutputStream
     ↳ java.io.FilterOutputStream
       ↳ java.io.PrintStream
         ↳ sun.net.www.http.ChunkedOutputStream

Class Overview

OutputStream that sends the output to the underlying stream using chunked encoding as specified in RFC 2068.

Summary

[Expand]
Inherited Fields
From class java.io.FilterOutputStream
Public Constructors
ChunkedOutputStream(PrintStream o)
ChunkedOutputStream(PrintStream o, int size)
Public Methods
boolean checkError()
Flushes the stream and checks its error state.
synchronized void close()
Closes the stream.
synchronized void flush()
Flushes the stream.
synchronized void reset()
int size()
synchronized void write(byte[] b, int off, int len)
Writes len bytes from the specified byte array starting at offset off to this stream.
synchronized void write(int b)
Writes the specified byte to this stream.
[Expand]
Inherited Methods
From class java.io.PrintStream
From class java.io.FilterOutputStream
From class java.io.OutputStream
From class java.lang.Object
From interface java.io.Closeable
From interface java.io.Flushable
From interface java.lang.Appendable

Public Constructors

public ChunkedOutputStream (PrintStream o)

public ChunkedOutputStream (PrintStream o, int size)

Public Methods

public boolean checkError ()

Flushes the stream and checks its error state. The internal error state is set to true when the underlying output stream throws an IOException other than InterruptedIOException, and when the setError method is invoked. If an operation on the underlying output stream throws an InterruptedIOException, then the PrintStream converts the exception back into an interrupt by doing:

     Thread.currentThread().interrupt();
 
or the equivalent.

Returns
  • true if and only if this stream has encountered an IOException other than InterruptedIOException, or the setError method has been invoked

public synchronized void close ()

Closes the stream. This is done by flushing the stream and then closing the underlying output stream.

public synchronized void flush ()

Flushes the stream. This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.

public synchronized void reset ()

public int size ()

public synchronized void write (byte[] b, int off, int len)

Writes len bytes from the specified byte array starting at offset off to this stream. If automatic flushing is enabled then the flush method will be invoked.

Note that the bytes will be written as given; to write characters that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Parameters
b A byte array
off Offset from which to start taking bytes
len Number of bytes to write

public synchronized void write (int b)

Writes the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then the flush method will be invoked.

Note that the byte is written as given; to write a character that will be translated according to the platform's default character encoding, use the print(char) or println(char) methods.

Parameters
b The byte to be written