Modifier and Type | Field and Description |
---|---|
protected byte[] | buf
The internal buffer where data is stored. |
protected int | count
The number of valid bytes in the buffer. |
private static final int | |
private static final int | |
private final InternalLock | |
private final int | maxBufSize
Max size of the internal buffer. |
Access | Constructor and Description |
---|---|
private | BufferedOutputStream(OutputStream out, int initialSize, int maxSize)
Creates a new buffered output stream. |
public | BufferedOutputStream(OutputStream
the underlying output stream. out)Creates a new buffered output stream to write data to the specified underlying output stream. |
public | BufferedOutputStream(OutputStream
the underlying output stream. out, int the buffer size. size)Creates a new buffered output stream to write data to the specified underlying output stream with the specified buffer size. |
Modifier and Type | Method and Description |
---|---|
public void | flush()
Overrides java. Implements java. Flushes this buffered output stream. |
private void | |
private void | |
private void | |
private void | |
private void | |
private static int | |
public void | write(int
the byte to be written. b)Overrides java. Writes the specified byte to this buffered output stream. |
public void | write(byte[]
the data. b, int the start offset in the data. off, int the number of bytes to write. len)Overrides java. Writes |
buf | back to summary |
---|---|
protected byte[] buf The internal buffer where data is stored. |
count | back to summary |
---|---|
protected int count The number of valid bytes in the buffer. This value is always
in the range |
DEFAULT_INITIAL_BUFFER_SIZE | back to summary |
---|---|
private static final int DEFAULT_INITIAL_BUFFER_SIZE |
DEFAULT_MAX_BUFFER_SIZE | back to summary |
---|---|
private static final int DEFAULT_MAX_BUFFER_SIZE |
lock | back to summary |
---|---|
private final InternalLock lock |
maxBufSize | back to summary |
---|---|
private final int maxBufSize Max size of the internal buffer. |
BufferedOutputStream | back to summary |
---|---|
private BufferedOutputStream(OutputStream out, int initialSize, int maxSize) Creates a new buffered output stream. |
BufferedOutputStream | back to summary |
---|---|
public BufferedOutputStream(OutputStream out) Creates a new buffered output stream to write data to the specified underlying output stream.
|
BufferedOutputStream | back to summary |
---|---|
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.
|
flush | back to summary |
---|---|
public void flush() throws IOException Overrides java. Implements java. Flushes this buffered output stream. This forces any buffered output bytes to be written out to the underlying output stream.
|
flushBuffer | back to summary |
---|---|
private void flushBuffer() throws IOException Flush the internal buffer |
growIfNeeded | back to summary |
---|---|
private void growIfNeeded(int len) Grow buf to fit an additional len bytes if needed. If possible, it grows by len+1 to avoid flushing when len bytes are added. A no-op if the buffer is not resizable. This method should only be called while holding the lock. |
implFlush | back to summary |
---|---|
private void implFlush() throws IOException |
implWrite | back to summary |
---|---|
private void implWrite(int b) throws IOException |
implWrite | back to summary |
---|---|
private void implWrite(byte[] b, int off, int len) throws IOException |
initialBufferSize | back to summary |
---|---|
private static int initialBufferSize() Returns the buffer size to use when no output buffer size specified. |
write | back to summary |
---|---|
public void write(int b) throws IOException Overrides java. Writes the specified byte to this buffered output stream.
|
write | back to summary |
---|---|
public void write(byte[] b, int off, int len) throws IOException Overrides java. Writes 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
|