AS AgentScopeAPI 手册 / API Reference

FilesystemUtils

public final class FilesystemUtils
源码Source io/agentscope/harness/agent/filesystem/util/FilesystemUtils.java:23–107

文件系统 Utils,承载智能体的部署、调度与服务化运行。位于 io.agentscope.harness.agent.filesystem.util 包。核心成员包括 getFileType、performStringReplacement、countOccurrences、shellQuote。

Shared utility functions for filesystem implementations.

方法摘要Method Summary

方法Method说明Description
public static String getFileType(String path)
static
获取文件类型。
Classify a file as "text" or "binary" based on extension.
public static Object[] performStringReplacement(String content, String oldString, String newString, boolean replaceAll)
static
执行 `performStringReplacement` 方法。
Perform string replacement with occurrence validation.
public static int countOccurrences(String text, String sub)
static
执行 `countOccurrences` 方法。
Count non-overlapping occurrences of a substring.
public static String shellQuote(String s)
static
设置该参数。
Shell-escape a string for safe use in shell commands.

方法详情Method Detail

getFileType

public static String getFileType(String path)
static

获取文件类型。

Classify a file as "text" or "binary" based on extension.

参数Parameters
名称Name类型Type说明Description
pathString路径(类型 `String`)。The path.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/filesystem/util/FilesystemUtils.java:38–48

performStringReplacement

public static Object[] performStringReplacement(String content, String oldString, String newString, boolean replaceAll)
static

执行 performStringReplacement 方法。

Perform string replacement with occurrence validation.

参数Parameters
名称Name类型Type说明Description
contentString内容(类型 `String`)。The content.
oldStringString旧的 String(类型 `String`)。The old string.
newStringString新建 String(类型 `String`)。The new string.
replaceAllbooleanreplace 所有(类型 `boolean`)。The replace all.
返回Returns Object[]
返回对象[]。a two-element array `[newContent, occurrenceCount]` on success, or a single-element array `[errorMessage]` on failure
源码Source io/agentscope/harness/agent/filesystem/util/FilesystemUtils.java:56–87

countOccurrences

public static int countOccurrences(String text, String sub)
static

执行 countOccurrences 方法。

Count non-overlapping occurrences of a substring.

参数Parameters
名称Name类型Type说明Description
textString文本(类型 `String`)。The text.
subString子(类型 `String`)。The sub.
返回Returns int
返回数值结果。Returns a numeric result.
源码Source io/agentscope/harness/agent/filesystem/util/FilesystemUtils.java:90–98

shellQuote

public static String shellQuote(String s)
static

设置该参数。

Shell-escape a string for safe use in shell commands.

参数Parameters
名称Name类型Type说明Description
sStrings(类型 `String`)。The s.
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/harness/agent/filesystem/util/FilesystemUtils.java:101–106
基于官方固定版本源码静态生成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.