Class Overview
Instances of this class are returned to applications for the purpose of
sending user data for a HTTP POST or PUT request. 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.
Summary
Public Methods |
synchronized
void
|
close()
After close() has been called, it is no longer possible to write
to this stream.
|
synchronized
void
|
reset()
Resets the count field of this output
stream to zero, so that all currently accumulated output in the
ouput stream is discarded.
|
synchronized
void
|
write(byte[] b, int off, int len)
Writes len bytes from the specified byte array
starting at offset off to this output stream.
|
synchronized
void
|
write(int b)
Writes the specified byte to this output stream.
|
[Expand]
Inherited Methods |
From class
java.io.ByteArrayOutputStream
void
|
close()
Closing a ByteArrayOutputStream has no effect.
|
synchronized
void
|
reset()
Resets the count field of this byte array output
stream to zero, so that all currently accumulated output in the
output stream is discarded.
|
synchronized
int
|
size()
Returns the current size of the buffer.
|
synchronized
byte[]
|
toByteArray()
Creates a newly allocated byte array.
|
synchronized
String
|
toString(int hibyte)
This method is deprecated.
This method does not properly convert bytes into characters.
As of JDK 1.1, the preferred way to do this is via the
toString(String enc) method, which takes an encoding-name
argument, or the toString() method, which uses the
platform's default character encoding.
|
synchronized
String
|
toString(String charsetName)
Converts the buffer's contents into a string by decoding the bytes using
the specified charsetName .
|
synchronized
String
|
toString()
Converts the buffer's contents into a string decoding bytes using the
platform's default character set.
|
synchronized
void
|
write(byte[] b, int off, int len)
Writes len bytes from the specified byte array
starting at offset off to this byte array output stream.
|
synchronized
void
|
write(int b)
Writes the specified byte to this byte array output stream.
|
synchronized
void
|
writeTo(OutputStream out)
Writes the complete contents of this byte array output stream to
the specified output stream argument, as if by calling the output
stream's write method using out.write(buf, 0, count) .
|
|
From class
java.io.OutputStream
void
|
close()
Closes this output stream and releases any system resources
associated with this stream.
|
void
|
flush()
Flushes this output stream and forces any buffered output bytes
to be written out.
|
void
|
write(byte[] b, int off, int len)
Writes len bytes from the specified byte array
starting at offset off to this output stream.
|
void
|
write(byte[] b)
Writes b.length bytes from the specified byte array
to this output stream.
|
abstract
void
|
write(int b)
Writes the specified byte to this output stream.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait()
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object.
|
final
void
|
wait(long timeout, int nanos)
Causes the current thread to wait until another thread invokes the
notify() method or the
notifyAll() method for this object, or
some other thread interrupts the current thread, or a certain
amount of real time has elapsed.
|
final
void
|
wait(long timeout)
Causes the current thread to wait until either another thread invokes the
notify() method or the
notifyAll() method for this object, or a
specified amount of time has elapsed.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes this stream and releases any system resources associated
with it.
|
|
From interface
java.io.Flushable
abstract
void
|
flush()
Flushes this stream by writing any buffered output to the underlying
stream.
|
|
Public Constructors
public
PosterOutputStream
()
Creates a new output stream for POST user data
Public Methods
public
synchronized
void
close
()
After close() has been called, it is no longer possible to write
to this stream. Further calls to write will have no effect.
public
synchronized
void
reset
()
Resets the count
field of this output
stream to zero, so that all currently accumulated output in the
ouput 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.
public
synchronized
void
write
(byte[] b, int off, int len)
Writes len
bytes from the specified byte array
starting at offset off
to this output stream.
Parameters
b
| the data. |
off
| the start offset in the data. |
len
| the number of bytes to write.
|
public
synchronized
void
write
(int b)
Writes the specified byte to this output stream.
Parameters
b
| the byte to be written.
|