Class DefaultPromptStoredData
java.lang.Object
de.xima.fc.prompt.service.defaults.DefaultPromptStoredData
- All Implemented Interfaces:
IPromptStoredData
Default implementation of
IPromptStoredData.- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionintfileSize()Gets the size of the stored file in bytes.Gets the supplier for the input stream that can be used to read the stored binary data.static IPromptStoredDataofData(byte[] data) Creates a new prompt stored data instance with the given data.static IPromptStoredDataCreates a new prompt stored data instance with the given file size and input stream supplier.static IPromptStoredDataofSupplier(int fileSize, ISerializableInputStreamSupplier inputStreamSupplier) Creates a new prompt stored data instance with the given file size and input stream supplier.
-
Method Details
-
fileSize
public int fileSize()Description copied from interface:IPromptStoredDataGets the size of the stored file in bytes.- Specified by:
fileSizein interfaceIPromptStoredData- Returns:
- The size of the stored file.
-
inputStreamSupplier
Description copied from interface:IPromptStoredDataGets the supplier for the input stream that can be used to read the stored binary data. The supplier can be called multiple times, each time it will return a new input stream to the data.- Specified by:
inputStreamSupplierin interfaceIPromptStoredData- Returns:
- The supplier for the input stream.
-
ofData
Creates a new prompt stored data instance with the given data.- Parameters:
data- The stored binary data.- Returns:
- The prompt stored data instance.
-
ofFile
Creates a new prompt stored data instance with the given file size and input stream supplier.- Parameters:
file- The path to file with the stored binary data.- Returns:
- The prompt stored data instance.
- Throws:
IOException- If an I/O error occurs reading the file size.
-
ofSupplier
public static IPromptStoredData ofSupplier(int fileSize, ISerializableInputStreamSupplier inputStreamSupplier) Creates a new prompt stored data instance with the given file size and input stream supplier.- Parameters:
fileSize- The size of the stored file in bytes.inputStreamSupplier- The supplier for the input stream that can be used to read the stored binary data.- Returns:
- The prompt stored data instance.
-