private final class ThresholdStorageProvider.ThresholdStorageOutputStream extends StorageOutputStream
| Modifier and Type | Field and Description |
|---|---|
private ByteArrayBuffer |
head |
private StorageOutputStream |
tail |
| Constructor and Description |
|---|
ThresholdStorageOutputStream() |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this output stream.
|
protected Storage |
toStorage0()
Has to be implemented by a concrete subclass to create a
Storage
object from the bytes that have been written to this
StorageOutputStream. |
protected void |
write0(byte[] buffer,
int offset,
int length)
Has to implemented by a concrete subclass to write bytes from the given
byte array to this
StorageOutputStream. |
toStorage, write, write, writeprivate final ByteArrayBuffer head
private StorageOutputStream tail
public void close()
throws java.io.IOException
StorageOutputStreamsuper.close().
This implementation never throws an IOException but a subclass
might.
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class StorageOutputStreamjava.io.IOException - if an I/O error occurs.protected void write0(byte[] buffer,
int offset,
int length)
throws java.io.IOException
StorageOutputStreamStorageOutputStream. This method gets
called by StorageOutputStream.write(int), StorageOutputStream.write(byte[]) and
StorageOutputStream.write(byte[], int, int). All the required preconditions have
already been checked by these methods, including the check if the output
stream has already been closed.write0 in class StorageOutputStreambuffer - buffer containing bytes to write.offset - start offset in the buffer.length - number of bytes to write.java.io.IOException - if an I/O error occurs.protected Storage toStorage0() throws java.io.IOException
StorageOutputStreamStorage
object from the bytes that have been written to this
StorageOutputStream. This method gets called by
StorageOutputStream.toStorage() after the preconditions have been checked. The
implementation can also be sure that this methods gets invoked only once.toStorage0 in class StorageOutputStreamStorage object as described above.java.io.IOException - if an I/O error occurs.