Filesystem
public class Filesystem
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:34–316文件系统,在隔离环境中安全执行代码和工具。位于 io.agentscope.extensions.sandbox.kubernetes.client 包。核心成员包括 write、read、list、exists、Filesystem。
File operations inside a sandbox via the runtime HTTP API.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public Filesystem(SandboxConnector connector) | 初始化 `Filesystem` 实例。 Creates a new instance. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void write(String path, byte[] content) | 执行写入相关操作。 Writes content to a file in the sandbox. |
public void write(String path, byte[] content, Duration timeout, boolean allowUnsafePaths) | 执行写入相关操作。 Writes content to a file in the sandbox. |
public void write(String path, String content) | 执行写入相关操作。 Writes string content (UTF-8) to a file in the sandbox. |
public byte[] read(String path) | 设置读取。 Reads a file from the sandbox. |
public byte[] read(String path, Duration timeout, boolean allowUnsafePaths) | 执行读取相关操作。 Reads a file from the sandbox. |
public List<FileEntry> list(String path) | 设置列表。 Lists entries in a directory. |
public List<FileEntry> list(String path, Duration timeout) | 执行列表相关操作。 Lists entries in a directory. |
public boolean exists(String path) | 判断数据是否存在。 Checks whether a path exists in the sandbox. |
public boolean exists(String path, Duration timeout) | 判断数据是否存在。 Checks whether a path exists in the sandbox. |
构造器详情Constructor Detail
Filesystem
public Filesystem(SandboxConnector connector)
初始化 Filesystem 实例。
Creates a new instance.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
connector | SandboxConnector | connector(类型 `SandboxConnector`)。The connector. |
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:41–43方法详情Method Detail
write
public void write(String path, byte[] content)
执行写入相关操作。
Writes content to a file in the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。relative destination path |
content | byte[] | 内容(类型 `byte[]`)。file bytes |
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:51–53write
public void write(String path, byte[] content, Duration timeout, boolean allowUnsafePaths)
执行写入相关操作。
Writes content to a file in the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。destination path |
content | byte[] | 内容(类型 `byte[]`)。file bytes |
timeout | Duration | 超时时间(类型 `Duration`)。request timeout |
allowUnsafePaths | boolean | allow Unsafe Paths(类型 `boolean`)。when false, rejects absolute paths and `..` |
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:63–88write
public void write(String path, String content)
执行写入相关操作。
Writes string content (UTF-8) to a file in the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。relative destination path |
content | String | 内容(类型 `String`)。text content |
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:96–98read
public byte[] read(String path)
设置读取。
Reads a file from the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。file path |
byte[]返回byte[]。file bytes
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:106–108read
public byte[] read(String path, Duration timeout, boolean allowUnsafePaths)
执行读取相关操作。
Reads a file from the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。file path |
timeout | Duration | 超时时间(类型 `Duration`)。request timeout |
allowUnsafePaths | boolean | allow Unsafe Paths(类型 `boolean`)。when false, rejects absolute paths and `..` |
byte[]返回byte[]。file bytes
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:118–136list
public List<FileEntry> list(String path)
设置列表。
Lists entries in a directory.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。directory path |
List<FileEntry>返回列出。file entries
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:144–146list
public List<FileEntry> list(String path, Duration timeout)
执行列表相关操作。
Lists entries in a directory.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。directory path |
timeout | Duration | 超时时间(类型 `Duration`)。request timeout |
List<FileEntry>返回列出。file entries
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:155–176exists
public boolean exists(String path)
判断数据是否存在。
Checks whether a path exists in the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。path to check |
boolean返回布尔值,表示判断结果。true if exists
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:184–186exists
public boolean exists(String path, Duration timeout)
判断数据是否存在。
Checks whether a path exists in the sandbox.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
path | String | 路径(类型 `String`)。path to check |
timeout | Duration | 超时时间(类型 `Duration`)。request timeout |
boolean返回布尔值,表示判断结果。true if exists
源码Source
io/agentscope/extensions/sandbox/kubernetes/client/Filesystem.java:195–213