Package sun.net.www.http
Class ChunkedOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- java.io.FilterOutputStream
-
- java.io.PrintStream
-
- sun.net.www.http.ChunkedOutputStream
-
- All Implemented Interfaces:
Closeable,Flushable,Appendable,AutoCloseable
public class ChunkedOutputStream extends PrintStream
OutputStream that sends the output to the underlying stream using chunked encoding as specified in RFC 2068.
-
-
Constructor Summary
Constructors Constructor Description ChunkedOutputStream(PrintStream o)ChunkedOutputStream(PrintStream o, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckError()Flushes the stream and checks its error state.voidclose()Closes the stream.voidflush()Flushes the stream.voidreset()intsize()voidwrite(byte[] b, int off, int len)Writeslenbytes from the specified byte array starting at offsetoffto this stream.voidwrite(int _b)Writes the specified byte to this stream.-
Methods inherited from class java.io.PrintStream
append, append, append, clearError, print, print, print, print, print, print, print, print, print, println, println, println, println, println, println, println, println, println, println, setError
-
Methods inherited from class java.io.FilterOutputStream
write
-
-
-
-
Constructor Detail
-
ChunkedOutputStream
public ChunkedOutputStream(PrintStream o)
-
ChunkedOutputStream
public ChunkedOutputStream(PrintStream o, int size)
-
-
Method Detail
-
checkError
public boolean checkError()
Description copied from class:PrintStreamFlushes the stream and checks its error state. The internal error state is set totruewhen the underlying output stream throws anIOExceptionother thanInterruptedIOException, and when thesetErrormethod is invoked. If an operation on the underlying output stream throws anInterruptedIOException, then thePrintStreamconverts the exception back into an interrupt by doing:Thread.currentThread().interrupt();
or the equivalent.- Overrides:
checkErrorin classPrintStream- Returns:
trueif and only if this stream has encountered anIOExceptionother thanInterruptedIOException, or thesetErrormethod has been invoked
-
write
public void write(byte[] b, int off, int len)Description copied from class:PrintStreamWriteslenbytes from the specified byte array starting at offsetoffto this stream. If automatic flushing is enabled then theflushmethod 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)orprintln(char)methods.- Overrides:
writein classPrintStream- Parameters:
b- A byte arrayoff- Offset from which to start taking byteslen- Number of bytes to write- See Also:
FilterOutputStream.write(int)
-
write
public void write(int _b)
Description copied from class:PrintStreamWrites the specified byte to this stream. If the byte is a newline and automatic flushing is enabled then theflushmethod 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)orprintln(char)methods.- Overrides:
writein classPrintStream- Parameters:
_b- The byte to be written- See Also:
PrintStream.print(char),PrintStream.println(char)
-
reset
public void reset()
-
size
public int size()
-
close
public void close()
Description copied from class:PrintStreamCloses the stream. This is done by flushing the stream and then closing the underlying output stream.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classPrintStream- See Also:
OutputStream.close()
-
flush
public void flush()
Description copied from class:PrintStreamFlushes the stream. This is done by writing any buffered output bytes to the underlying output stream and then flushing that stream.- Specified by:
flushin interfaceFlushable- Overrides:
flushin classPrintStream- See Also:
OutputStream.flush()
-
-