Package org.frankframework.stream
Class OverflowToDiskOutputStream
java.lang.Object
java.io.OutputStream
org.frankframework.stream.OverflowToDiskOutputStream
- All Implemented Interfaces:
Closeable,Flushable,AutoCloseable
Writes to an in-memory buffer until it 'overflows', after which a file on disk will be created and the in-memory buffer will be flushed to it.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Flushes and closes the OutputStream, clears all resources, does not remove the file if has been created on disk.voidflush()Doesn't do anything if the message is kept in memoryvoidflush(boolean writeBufferToDisk) Doesn't do anything if the message is kept in memory unless parameterwriteBufferToDiskis true.If the contents was small enough to be kept in memory a ByteArray-message will be returned.toMessage(boolean binary) If the contents was small enough to be kept in memory a ByteArray-message will be returned.voidwrite(byte[] b, int off, int len) voidwrite(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
OverflowToDiskOutputStream
- Throws:
IOException
-
-
Method Details
-
write
- Specified by:
writein classOutputStream- Throws:
IOException
-
write
- Overrides:
writein classOutputStream- Throws:
IOException
-
toMessage
If the contents was small enough to be kept in memory a ByteArray-message will be returned. If the contents was written to disk aTemporaryMessagewill be returned. Once read the buffer will be removed.- Returns:
- A new
Messageobject representing the contents written to thisOutputStream.
-
toMessage
If the contents was small enough to be kept in memory a ByteArray-message will be returned. If the contents was written to disk aTemporaryMessagewill be returned. Once read the buffer will be removed.- Returns:
- A new
Messageobject representing the contents written to thisOutputStream.
-
flush
Doesn't do anything if the message is kept in memory- Specified by:
flushin interfaceFlushable- Overrides:
flushin classOutputStream- Throws:
IOException
-
flush
Doesn't do anything if the message is kept in memory unless parameterwriteBufferToDiskis true.- Parameters:
writeBufferToDisk- Forces the in-memory buffer to be written to disk.- Throws:
IOException
-
close
Flushes and closes the OutputStream, clears all resources, does not remove the file if has been created on disk.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classOutputStream- Throws:
IOException
-