public abstract class AbstractBufferedOutputStream extends FilterOutputStream
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
The default buffer size in bytes
|
out
Constructor and Description |
---|
AbstractBufferedOutputStream(OutputStream out)
A BufferedOutputStream where the buffer is provided by a byte array.
|
AbstractBufferedOutputStream(OutputStream out,
int size)
Creates a new instance with the given buffer size in bytes.
|
Modifier and Type | Method and Description |
---|---|
protected abstract byte[] |
bytes()
Return the bytes in the buffer as a byte array
|
protected abstract void |
clean()
Performs any necessary cleaning of the buffer and releasing of resources.
|
void |
close() |
void |
flush() |
protected abstract int |
limit()
Returns the limit of the buffer
|
protected abstract void |
put(byte b)
Put a single byte into the buffer
|
protected abstract void |
put(int count,
byte[] b,
int off,
int len)
Puts bytes into the buffer
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
write
public static int DEFAULT_BUFFER_SIZE
public AbstractBufferedOutputStream(OutputStream out)
BufferedOutputStream
out
- OutputStream to be decoratedpublic AbstractBufferedOutputStream(OutputStream out, int size)
out
- OutputStream to be decoratedsize
- The size of the buffer in bytesBufferedOutputStream.BufferedOutputStream(OutputStream, int)
public void write(int b) throws IOException
write
in class FilterOutputStream
IOException
BufferedOutputStream.write(int)
public void write(byte[] b, int off, int len) throws IOException
write
in class FilterOutputStream
IOException
BufferedOutputStream.write(byte[], int, int)
public void flush() throws IOException
flush
in interface Flushable
flush
in class FilterOutputStream
IOException
BufferedOutputStream.flush()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class FilterOutputStream
IOException
protected abstract byte[] bytes()
protected abstract void put(byte b)
b
- The byteprotected abstract void put(int count, byte[] b, int off, int len)
count
- The number of bytes already written into the bufferb
- The byte array with the bytes to putoff
- Offset to write from in the bytes, blen
- The number of bytes to writeprotected abstract int limit()
protected abstract void clean()
Copyright © 2010–2018 Jadira Systems. All rights reserved.