APIdia Launch Partner
Top Description Fields Constructors Methods
sun.net.www.http

public Class PosterOutputStream

extends ByteArrayOutputStream
Class Inheritance
Imports
java.io.*, java.net.*

Instances of this class are returned to applications for the purpose of sending user data for a HTTP request (excluding TRACE). This class is used when the content-length will be specified in the header of the request. The semantics of ByteArrayOutputStream are extended so that when close() is called, it is no longer possible to write additional data to the stream. From this point the content length of the request is fixed and cannot change.
Author
Michael McMahon

Field Summary

Modifier and TypeField and Description
private boolean
Inherited from java.io.ByteArrayOutputStream:
bufcount

Constructor Summary

AccessConstructor and Description
public
PosterOutputStream()

Creates a new output stream for POST user data

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Overrides java.io.ByteArrayOutputStream.close.

Implements java.io.Closeable.close.

After close() has been called, it is no longer possible to write to this stream.

public synchronized void
reset()

Overrides java.io.ByteArrayOutputStream.reset.

Resets the count field of this output stream to zero, so that all currently accumulated output in the output stream is discarded.

public synchronized void
write(int
the byte to be written.
b
)

Overrides java.io.ByteArrayOutputStream.write.

Writes the specified byte to this output stream.

public synchronized void
write(byte[]
the data.
b
,
int
the start offset in the data.
off
,
int
the number of bytes to write.
len
)

Overrides java.io.ByteArrayOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Inherited from java.io.ByteArrayOutputStream:
sizetoByteArraytoStringtoStringtoStringtoStringwriteByteswriteTo

Field Detail

closedback to summary
private boolean closed

Constructor Detail

PosterOutputStreamback to summary
public PosterOutputStream()

Creates a new output stream for POST user data

Method Detail

closeback to summary
public synchronized void close() throws IOException

Overrides java.io.ByteArrayOutputStream.close.

Implements java.io.Closeable.close.

After close() has been called, it is no longer possible to write to this stream. Further calls to write will have no effect.

Exceptions
IOException:

Doc from java.io.OutputStream.close.

if an I/O error occurs.

resetback to summary
public synchronized void reset()

Overrides java.io.ByteArrayOutputStream.reset.

Resets the count field of this output stream to zero, so that all currently accumulated output in the output stream is discarded. The output stream can be used again, reusing the already allocated buffer space. If the output stream has been closed, then this method has no effect.

See Also
java.io.ByteArrayInputStream#count
writeback to summary
public synchronized void write(int b)

Overrides java.io.ByteArrayOutputStream.write.

Writes the specified byte to this output stream.

Parameters
b:int

the byte to be written.

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

Overrides java.io.ByteArrayOutputStream.write.

Writes len bytes from the specified byte array starting at offset off to this output stream.

Parameters
b:byte[]

the data.

off:int

the start offset in the data.

len:int

the number of bytes to write.