Class DefaultPromptStoredData
- java.lang.Object
-
- de.xima.fc.prompt.service.defaults.DefaultPromptStoredData
-
- All Implemented Interfaces:
IPromptStoredData
public final class DefaultPromptStoredData extends Object implements IPromptStoredData
Default implementation ofIPromptStoredData.- Since:
- 8.5.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intfileSize()Gets the size of the stored file in bytes.ISerializableInputStreamSupplierinputStreamSupplier()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 IPromptStoredDataofFile(Path file)Creates 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 Detail
-
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
public ISerializableInputStreamSupplier 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
public static IPromptStoredData ofData(byte[] data)
Creates a new prompt stored data instance with the given data.- Parameters:
data- The stored binary data.- Returns:
- The prompt stored data instance.
-
ofFile
public static IPromptStoredData ofFile(Path file) throws IOException
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.
-
-