| java.lang.Object java.io.OutputStream java.io.FilterOutputStream org.apache.cocoon.util.BufferedOutputStream
BufferedOutputStream | final public class BufferedOutputStream extends FilterOutputStream (Code) | | This class is like the
java.io.BufferedOutputStream but it
extends it with a logic to count the number of bytes written to
the output stream.
author: Carsten Ziegeler version: CVS $Id: BufferedOutputStream.java 433543 2006-08-22 06:22:54Z crossley $ since: 2.1 |
Field Summary | |
protected byte | buf | protected int | count |
Constructor Summary | |
public | BufferedOutputStream(OutputStream out) Creates a new buffered output stream to write data to the
specified underlying output stream with a default 8192-byte
buffer size. | public | BufferedOutputStream(OutputStream out, int size) Creates a new buffered output stream to write data to the
specified underlying output stream with the specified buffer
size. |
Method Summary | |
public void | clearBuffer() | public void | close() Closes this buffered output stream. | public void | flush() Flushes this buffered output stream. | public int | getCount() | public void | realFlush() Flushes this buffered output stream. | public void | write(int b) Writes the specified byte to this buffered output stream. | public void | write(byte b, int off, int len) Writes len bytes from the specified byte array
starting at offset off to this buffered output stream.
Ordinarily this method stores bytes from the given array into this
stream's buffer, flushing the buffer to the underlying output stream as
needed. |
count | protected int count(Code) | | |
BufferedOutputStream | public BufferedOutputStream(OutputStream out)(Code) | | Creates a new buffered output stream to write data to the
specified underlying output stream with a default 8192-byte
buffer size.
Parameters: out - the underlying output stream. |
BufferedOutputStream | public BufferedOutputStream(OutputStream out, int size)(Code) | | Creates a new buffered output stream to write data to the
specified underlying output stream with the specified buffer
size.
Parameters: out - the underlying output stream. Parameters: size - the buffer size. exception: IllegalArgumentException - if size <= 0. |
clearBuffer | public void clearBuffer()(Code) | | Clear/reset the buffer
|
close | public void close() throws IOException(Code) | | Closes this buffered output stream.
Flush before closing.
exception: IOException - if an I/O error occurs. |
flush | public void flush() throws IOException(Code) | | Flushes this buffered output stream.
We don't flush here, flushing is done during closing.
exception: IOException - if an I/O error occurs. |
getCount | public int getCount()(Code) | | Return the size of the current buffer
|
realFlush | public void realFlush() throws IOException(Code) | | Flushes this buffered output stream.
|
write | public void write(int b) throws IOException(Code) | | Writes the specified byte to this buffered output stream.
Parameters: b - the byte to be written. exception: IOException - if an I/O error occurs. |
write | public void write(byte b, int off, int len) throws IOException(Code) | | Writes len bytes from the specified byte array
starting at offset off to this buffered output stream.
Ordinarily this method stores bytes from the given array into this
stream's buffer, flushing the buffer to the underlying output stream as
needed. If the requested length is at least as large as this stream's
buffer, however, then this method will flush the buffer and write the
bytes directly to the underlying output stream. Thus redundant
BufferedOutputStream s will not copy data unnecessarily.
Parameters: b - the data. Parameters: off - the start offset in the data. Parameters: len - the number of bytes to write. exception: IOException - if an I/O error occurs. |
|
|