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 of IPromptStoredData.
Since:
8.5.0
  • Method Details

    • fileSize

      public int fileSize()
      Description copied from interface: IPromptStoredData
      Gets the size of the stored file in bytes.
      Specified by:
      fileSize in interface IPromptStoredData
      Returns:
      The size of the stored file.
    • inputStreamSupplier

      public ISerializableInputStreamSupplier inputStreamSupplier()
      Description copied from interface: IPromptStoredData
      Gets 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:
      inputStreamSupplier in interface IPromptStoredData
      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.