Class FileContent
java.lang.Object
de.xima.fc.prompt.ms.impl.service.generic_oai.client.model.FileContent
Represents a file to be sent to the generic OAI endpoint or a file that was received from it.
- Since:
- 8.5.0
-
Method Summary
Modifier and TypeMethodDescriptionfileName()Gets the name of the file.intfileSize()Gets the size of the file in bytes.static FileContentCreates a new file from the given file path.static FileContentfromString(String fileName, String mimeType, String data, Charset charset) Creates a new file with the given file name, mime type and string data.static FileContentfromSupplier(String fileName, String mimeType, int fileSize, SerializableInputStreamSupplier inputStream) Creates a new file with the given file name, mime type and binary data.Gets the supplier of the input stream containing the file's binary data.mimeType()Gets the mime type of the file.
-
Method Details
-
fileName
-
fileSize
public int fileSize()Gets the size of the file in bytes.- Returns:
- The file size.
-
inputStream
Gets the supplier of the input stream containing the file's binary data.- Returns:
- The input stream supplier.
-
mimeType
-
fromFile
Creates a new file from the given file path. Uses the file name of the given file.- Parameters:
mimeType- The mime type of the file.file- The path to the file.- Returns:
- A new file instance.
- Throws:
IOException- If an I/O error occurs reading the file size.
-
fromString
public static FileContent fromString(String fileName, String mimeType, String data, Charset charset) Creates a new file with the given file name, mime type and string data.- Parameters:
fileName- The name of the file.mimeType- The mime type of the file.data- The string data of the file.charset- The charset to encode the string data.- Returns:
- A new file instance.
-
fromSupplier
public static FileContent fromSupplier(String fileName, String mimeType, int fileSize, SerializableInputStreamSupplier inputStream) Creates a new file with the given file name, mime type and binary data.- Parameters:
fileName- The name of the file.mimeType- The mime type of the file.fileSize- The size of the file in bytes.inputStream- The supplier of the input stream containing the file's binary data.- Returns:
- A new file instance.
-