Class Overview
A stream wrapper that closes itself after a defined number of bytes.
Summary
Public Methods |
void
|
close()
Does not close the underlying socket output.
|
void
|
flush()
Flushes this stream.
|
void
|
write(byte[] b, int off, int len)
Writes count bytes from the byte array buffer starting at
position offset to this stream.
|
void
|
write(byte[] b)
Equivalent to write(buffer, 0, buffer.length) .
|
void
|
write(int b)
Writes a single byte to this stream.
|
[Expand]
Inherited Methods |
From class
java.io.OutputStream
void
|
close()
Closes this stream.
|
void
|
flush()
Flushes this stream.
|
void
|
write(byte[] buffer, int offset, int count)
Writes count bytes from the byte array buffer starting at
position offset to this stream.
|
void
|
write(byte[] buffer)
Equivalent to write(buffer, 0, buffer.length) .
|
abstract
void
|
write(int oneByte)
Writes a single byte to this stream.
|
|
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
From interface
java.io.Closeable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
From interface
java.io.Flushable
abstract
void
|
flush()
Flushes the object by writing out any buffered data to the underlying
output.
|
|
From interface
java.lang.AutoCloseable
abstract
void
|
close()
Closes the object and release any system resources it holds.
|
|
Public Constructors
public
ContentLengthOutputStream
(SessionOutputBuffer out, long contentLength)
Creates a new length limited stream
Parameters
out
| The data transmitter to wrap |
contentLength
| The maximum number of bytes that can be written to
the stream. Subsequent write operations will be ignored. |
Public Methods
public
void
close
()
Does not close the underlying socket output.
public
void
flush
()
Flushes this stream. Implementations of this method should ensure that
any buffered data is written out. This implementation does nothing.
public
void
write
(byte[] b, int off, int len)
Writes count
bytes from the byte array buffer
starting at
position offset
to this stream.
Parameters
b
| the buffer to be written. |
off
| the start position in buffer from where to get bytes. |
len
| the number of bytes from buffer to write to this
stream. |
public
void
write
(byte[] b)
Equivalent to write(buffer, 0, buffer.length)
.
public
void
write
(int b)
Writes a single byte to this stream. Only the least significant byte of
the integer oneByte
is written to the stream.
Parameters
b
| the byte to be written. |