Package io.agentscope.core.rag.reader
Class ReaderInput
java.lang.Object
io.agentscope.core.rag.reader.ReaderInput
Input wrapper for document readers.
This class provides a unified interface for different types of input sources (text strings, file paths, URLs, etc.) that can be read by document readers.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionasString()Gets the input content as a string.static ReaderInputCreates a ReaderInput from a File object.static ReaderInputCreates a ReaderInput from a file path.static ReaderInputCreates a ReaderInput from a file path.static ReaderInputCreates a ReaderInput from a File path string.static ReaderInputCreates a ReaderInput from a File path.static ReaderInputfromString(String text) Creates a ReaderInput from a text string.getType()Gets the input type.
-
Method Details
-
fromString
Creates a ReaderInput from a text string.- Parameters:
text- the text content- Returns:
- a ReaderInput instance
-
fromFile
Creates a ReaderInput from a file path.- Parameters:
filePath- the path to the file- Returns:
- a ReaderInput instance
- Throws:
IOException- if the file cannot be read
-
fromFile
Creates a ReaderInput from a file path.- Parameters:
filePath- the path to the file- Returns:
- a ReaderInput instance
- Throws:
IOException- if the file cannot be read
-
fromFile
Creates a ReaderInput from a File object.- Parameters:
file- the file object- Returns:
- a ReaderInput instance
- Throws:
IOException- if the file cannot be read
-
fromPath
Creates a ReaderInput from a File path string.- Parameters:
path- the file path string- Returns:
- a ReaderInput instance
- Throws:
IllegalArgumentException- if the path is invalid
-
fromPath
Creates a ReaderInput from a File path.- Parameters:
path- the file path- Returns:
- a ReaderInput instance
- Throws:
IllegalArgumentException- if the path is invalid
-
asString
Gets the input content as a string.- Returns:
- the content string
-
getType
Gets the input type.- Returns:
- the input type
-