类 FileSystemDocumentLoader
java.lang.Object
top.aoyudi.rag.impl.FileSystemDocumentLoader
- 所有已实现的接口:
DocumentLoader
文件系统文档加载器,从本地文件系统加载文档
-
字段概要
字段 -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明extractMetadata(Path filePath) 提取文件元数据查找指定目录下所有符合条件的文件(包括子目录)private StringgetCellValue(org.apache.poi.ss.usermodel.Cell cell) private StringgetFileExtension(Path filePath) 获取文件扩展名loadDocument(String source) 加载单个文档loadDocuments(List<String> sources) 批量加载文档loadDocumentsFromPath(String path) 加载指定路径下的所有符合条件的文档private StringreadDocxContent(Path filePath) 使用Apache POI读取DOCX文件内容readExcelContent(Path excelPath) private StringreadFileContent(Path filePath) 读取文件内容private StringreadMarkdownFile(Path filePath) 读取Markdown文件内容,进行基本处理readPdfContent(Path pdfPath) private StringreadTextFile(Path filePath) 读取文本文件内容,支持指定编码private voidvalidateFile(Path filePath) 验证文件是否存在且支持
-
字段详细资料
-
SUPPORTED_EXTENSIONS
-
-
构造器详细资料
-
FileSystemDocumentLoader
public FileSystemDocumentLoader()
-
-
方法详细资料
-
loadDocument
从接口复制的说明:DocumentLoader加载单个文档- 指定者:
loadDocument在接口中DocumentLoader- 参数:
source- 文档来源(文件路径、URL等)- 返回:
- 加载的文档
-
loadDocuments
从接口复制的说明:DocumentLoader批量加载文档- 指定者:
loadDocuments在接口中DocumentLoader- 参数:
sources- 文档来源列表- 返回:
- 加载的文档列表
-
loadDocumentsFromPath
从接口复制的说明:DocumentLoader加载指定路径下的所有符合条件的文档- 指定者:
loadDocumentsFromPath在接口中DocumentLoader- 参数:
path- 文档所在路径- 返回:
- 加载的文档列表
- 抛出:
IOException
-
findFiles
查找指定目录下所有符合条件的文件(包括子目录)- 参数:
rootPath- 根目录路径- 返回:
- 符合条件的文件列表
- 抛出:
IOException- 如果发生I/O错误
-
validateFile
验证文件是否存在且支持 -
readFileContent
读取文件内容- 抛出:
IOException
-
extractMetadata
提取文件元数据- 抛出:
IOException
-
getFileExtension
获取文件扩展名 -
readTextFile
读取文本文件内容,支持指定编码- 抛出:
IOException
-
readMarkdownFile
读取Markdown文件内容,进行基本处理- 抛出:
IOException
-
readDocxContent
使用Apache POI读取DOCX文件内容- 抛出:
IOException
-
readPdfContent
-
readExcelContent
-
getCellValue
-