apps/docs/src/content/docs/en/java-sdk/pty.mdx
Options used when creating a PTY session in a Sandbox.
public PtyCreateOptions()
Creates PTY options with default dimensions (120x30).
public PtyCreateOptions(String id, int cols, int rows, Consumer<byte[]> onData)
Creates PTY options with explicit values.
Parameters:
id String - custom PTY session identifier; if null, the server generates onecols int - terminal width in columnsrows int - terminal height in rowsonData Consumer<byte[]> - callback invoked for each PTY output chunkpublic String getId()
Returns the PTY session identifier to request.
Returns:
String - requested PTY session identifier, or null to auto-generatepublic PtyCreateOptions setId(String id)
Sets the PTY session identifier.
Parameters:
id String - PTY session identifierReturns:
PtyCreateOptions - this options instancepublic int getCols()
Returns terminal width in columns.
Returns:
int - terminal widthpublic PtyCreateOptions setCols(int cols)
Sets terminal width in columns.
Parameters:
cols int - terminal widthReturns:
PtyCreateOptions - this options instancepublic int getRows()
Returns terminal height in rows.
Returns:
int - terminal heightpublic PtyCreateOptions setRows(int rows)
Sets terminal height in rows.
Parameters:
rows int - terminal heightReturns:
PtyCreateOptions - this options instancepublic Consumer<byte[]> getOnData()
Returns callback used for streaming PTY output.
Returns:
Consumer\<byte[]\> - PTY output callback, or null when not configuredpublic PtyCreateOptions setOnData(Consumer<byte[]> onData)
Sets callback invoked for each PTY output chunk.
Parameters:
onData Consumer<byte[]> - callback receiving raw PTY bytesReturns:
PtyCreateOptions - this options instanceFinal outcome of a PTY session.
Contains exit status and an optional error/exit reason reported by the PTY backend.
public PtyResult(int exitCode, String error)
Creates a PTY result object.
Parameters:
exitCode int - exit code returned by the PTY process; negative values indicate no exit codeerror String - optional error or exit reasonpublic int getExitCode()
Returns the process exit code.
Returns:
int - PTY process exit codepublic String getError()
Returns the PTY error or exit reason when available.
Returns:
String - error message, or null when the session ended successfully