Package org.apache.james.mime4j.storage
Class MemoryStorageProvider.MemoryStorageOutputStream
- java.lang.Object
-
- java.io.OutputStream
-
- org.apache.james.mime4j.storage.StorageOutputStream
-
- org.apache.james.mime4j.storage.MemoryStorageProvider.MemoryStorageOutputStream
-
- All Implemented Interfaces:
java.io.Closeable
,java.io.Flushable
,java.lang.AutoCloseable
- Enclosing class:
- MemoryStorageProvider
private static final class MemoryStorageProvider.MemoryStorageOutputStream extends StorageOutputStream
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ByteArrayBuffer
bab
-
Constructor Summary
Constructors Modifier Constructor Description private
MemoryStorageOutputStream()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Storage
toStorage0()
Has to be implemented by a concrete subclass to create aStorage
object from the bytes that have been written to thisStorageOutputStream
.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 thisStorageOutputStream
.
-
-
-
Field Detail
-
bab
final ByteArrayBuffer bab
-
-
Method Detail
-
write0
protected void write0(byte[] buffer, int offset, int length) throws java.io.IOException
Description copied from class:StorageOutputStream
Has to implemented by a concrete subclass to write bytes from the given byte array to thisStorageOutputStream
. This method gets called byStorageOutputStream.write(int)
,StorageOutputStream.write(byte[])
andStorageOutputStream.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.- Specified by:
write0
in classStorageOutputStream
- Parameters:
buffer
- buffer containing bytes to write.offset
- start offset in the buffer.length
- number of bytes to write.- Throws:
java.io.IOException
- if an I/O error occurs.
-
toStorage0
protected Storage toStorage0() throws java.io.IOException
Description copied from class:StorageOutputStream
Has to be implemented by a concrete subclass to create aStorage
object from the bytes that have been written to thisStorageOutputStream
. This method gets called byStorageOutputStream.toStorage()
after the preconditions have been checked. The implementation can also be sure that this methods gets invoked only once.- Specified by:
toStorage0
in classStorageOutputStream
- Returns:
- a
Storage
object as described above. - Throws:
java.io.IOException
- if an I/O error occurs.
-
-