Package com.storedobject.core
Interface StreamDataProvider
- All Known Implementing Classes:
FileDataProvider
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
Stream data provider that provides data to StreamData objects.
-
Method Summary
Modifier and TypeMethodDescriptiongetStream
(StreamData streamData) Get an input stream for reading the data.default void
writeStream
(StreamData streamData, OutputStream output) This method will be called only if getStream() returns "null".
-
Method Details
-
getStream
Get an input stream for reading the data. If a stream for reading data can not be provided, return "null" so that writeStream() will be called.- Parameters:
streamData
- Stream data that is requesting the stream.- Returns:
- Input stream from which data can be obtained. The stream will be closed after reading the data from it.
- Throws:
Data_Not_Changed
- If this is thrown no data change will happen and previously stored data will remain. This should not be thrown for newly created StreamData.Exception
- Any exception other than Data_Not_Changed will cause the transaction "rollback".
-
writeStream
This method will be called only if getStream() returns "null".- Parameters:
streamData
- Stream data that is requesting the stream.output
- Output stream to which data can be written. There is no need to close the stream after writing.- Throws:
Exception
- Any exception thrown will cause the transaction "rollback".
-