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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Flushes and closes the OutputStream, clears all resources, does not remove the file if has been created on disk.void
flush()
Doesn't do anything if the message is kept in memoryvoid
flush
(boolean writeBufferToDisk) Doesn't do anything if the message is kept in memory unless parameterwriteBufferToDisk
is true.If the contents was small enough to be kept in memory a ByteArray-message will be returned.void
write
(byte[] b, int off, int len) void
write
(int b) Methods inherited from class java.io.OutputStream
nullOutputStream, write
-
Constructor Details
-
OverflowToDiskOutputStream
- Throws:
IOException
-
-
Method Details
-
write
- Specified by:
write
in classOutputStream
- Throws:
IOException
-
write
- Overrides:
write
in 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 aTemporaryMessage
will be returned. Once read the buffer will be removed.- Returns:
- A new
Message
object representing the contents written to thisOutputStream
.
-
flush
Doesn't do anything if the message is kept in memory- Specified by:
flush
in interfaceFlushable
- Overrides:
flush
in classOutputStream
- Throws:
IOException
-
flush
Doesn't do anything if the message is kept in memory unless parameterwriteBufferToDisk
is 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classOutputStream
- Throws:
IOException
-