AS AgentScopeAPI 手册 / API Reference

ReaderUtils

public final class ReaderUtils
源码Source io/agentscope/core/rag/reader/ReaderUtils.java:31–95

读取器 Utils,把私有文档转化为可检索的知识。位于 io.agentscope.core.rag.reader 包。核心成员包括 generateDocId、generateDocIdMD5、generateDocIdSHA256、bytesToHex。

Utility class for common reader operations.

This class provides shared functionality for document readers, including:

  • Document ID generation using hash algorithms

  • Byte array to hex string conversion

方法摘要Method Summary

方法Method说明Description
public static String generateDocId(String input, String algorithm)
static
执行 `generateDocId` 方法。
Generates a deterministic document ID using the specified hash algorithm.
public static String generateDocIdMD5(String input)
static
设置该参数。
Generates a deterministic document ID using MD5 hash.
public static String generateDocIdSHA256(String input)
static
设置该参数。
Generates a deterministic document ID using SHA-256 hash.
public static String bytesToHex(byte[] bytes)
static
设置该参数。
Converts byte array to hexadecimal string.

方法详情Method Detail

generateDocId

public static String generateDocId(String input, String algorithm)
static

执行 generateDocId 方法。

Generates a deterministic document ID using the specified hash algorithm.

参数Parameters
名称Name类型Type说明Description
inputString输入消息(类型 `String`)。the input string to hash (typically a file path)
algorithmStringalgorithm(类型 `String`)。the hash algorithm to use (e.g., "MD5", "SHA-256")
返回Returns String
返回字符串结果。the hash of the input as a hexadecimal string
抛出Throws
  • RuntimeException 可能抛出 `RuntimeException`。if the specified algorithm is not available
源码Source io/agentscope/core/rag/reader/ReaderUtils.java:48–56

generateDocIdMD5

public static String generateDocIdMD5(String input)
static

设置该参数。

Generates a deterministic document ID using MD5 hash.

参数Parameters
名称Name类型Type说明Description
inputString输入消息(类型 `String`)。the input string to hash (typically a file path)
返回Returns String
返回字符串结果。MD5 hash of the input as a hexadecimal string
源码Source io/agentscope/core/rag/reader/ReaderUtils.java:66–68

generateDocIdSHA256

public static String generateDocIdSHA256(String input)
static

设置该参数。

Generates a deterministic document ID using SHA-256 hash.

参数Parameters
名称Name类型Type说明Description
inputString输入消息(类型 `String`)。the input string to hash (typically a file path)
返回Returns String
返回字符串结果。SHA-256 hash of the input as a hexadecimal string
源码Source io/agentscope/core/rag/reader/ReaderUtils.java:78–80

bytesToHex

public static String bytesToHex(byte[] bytes)
static

设置该参数。

Converts byte array to hexadecimal string.

参数Parameters
名称Name类型Type说明Description
bytesbyte[]字节(类型 `byte[]`)。the byte array to convert
返回Returns String
返回字符串结果。hexadecimal string representation (lowercase)
源码Source io/agentscope/core/rag/reader/ReaderUtils.java:88–94
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.