このコンテンツはまだ日本語訳がありません。
FileSystem
File system operations facade for a specific Sandbox.
Provides methods for directory management, file upload/download, metadata inspection, and search/replace operations.
Methods
createFolder()
public void createFolder(String path, String mode)Creates a directory in the Sandbox.
Parameters:
pathString - directory pathmodeString - POSIX mode (for example755); defaults to755whennull
Throws:
io.daytona.sdk.exception.DaytonaException- if creation fails
deleteFile()
public void deleteFile(String path)Deletes a file.
Parameters:
pathString - file path to delete
Throws:
io.daytona.sdk.exception.DaytonaException- if deletion fails
downloadFile()
public byte[] downloadFile(String remotePath)Downloads a file into memory.
Parameters:
remotePathString - source file path in the Sandbox
Returns:
byte[]- file bytes; empty array when no file payload is returned
Throws:
io.daytona.sdk.exception.DaytonaException- if download or local read fails
uploadFile()
public void uploadFile(byte[] content, String remotePath)Uploads in-memory file content to a Sandbox path.
Parameters:
contentbyte[] - file bytes;nulluploads an empty fileremotePathString - destination file path in the Sandbox
Throws:
io.daytona.sdk.exception.DaytonaException- if upload fails
listFiles()
public List<FileInfo> listFiles(String path)Lists files and directories under a path.
Parameters:
pathString - directory path
Returns:
List\<FileInfo\>- file metadata entries
Throws:
io.daytona.sdk.exception.DaytonaException- if listing fails
getFileDetails()
public FileInfo getFileDetails(String path)Returns metadata for a single file or directory.
Parameters:
pathString - file or directory path
Returns:
FileInfo- metadata record
Throws:
io.daytona.sdk.exception.DaytonaException- if lookup fails
findFiles()
public List<Map<String, Object>> findFiles(String path, String pattern)Searches files by content pattern.
Parameters:
pathString - root directory to searchpatternString - text pattern to find
Returns:
List\<Map\<String, Object\>\>- list of matches containing file, line, and content
Throws:
io.daytona.sdk.exception.DaytonaException- if the search request fails
searchFiles()
public Map<String, Object> searchFiles(String path, String pattern)Searches files by file-name pattern.
Parameters:
pathString - root directory to searchpatternString - file-name pattern
Returns:
Map\<String, Object\>- result map containingfiles
Throws:
io.daytona.sdk.exception.DaytonaException- if the search request fails
replaceInFiles()
public void replaceInFiles(List<String> files, String pattern, String newValue)Performs in-place replacement in multiple files.
Parameters:
filesList<String> - files to processpatternString - pattern to replacenewValueString - replacement text
Throws:
io.daytona.sdk.exception.DaytonaException- if replacement fails
moveFiles()
public void moveFiles(String source, String destination)Moves or renames a file or directory.
Parameters:
sourceString - source pathdestinationString - destination path
Throws:
io.daytona.sdk.exception.DaytonaException- if move fails