Class IOStreamEmuUnixFileHandle
java.lang.Object
ghidra.pcode.emu.unix.AbstractStreamEmuUnixFileHandle<byte[]>
ghidra.pcode.emu.unix.IOStreamEmuUnixFileHandle
- All Implemented Interfaces:
EmuUnixFileDescriptor<byte[]>
A simulated file descriptor that proxies a host resource, typically a console/terminal
-
Field Summary
FieldsFields inherited from class AbstractStreamEmuUnixFileHandle
arithmetic, offsetBytesFields inherited from interface EmuUnixFileDescriptor
FD_STDERR, FD_STDIN, FD_STDOUT -
Constructor Summary
ConstructorsChangeConstructorDescriptionIOStreamEmuUnixFileHandle(PcodeMachine<byte[]> machine, CompilerSpec cSpec, InputStream input, OutputStream output) Construct a proxy for a host resource -
Method Summary
ChangeModifier and TypeMethodDescriptionvoidclose()Close this descriptorintread(byte[] buf) Read from the file opened by this handlestatic IOStreamEmuUnixFileHandlestderr(PcodeMachine<byte[]> machine, CompilerSpec cSpec) Construct a proxy for the host's standard error outputstatic IOStreamEmuUnixFileHandlestdin(PcodeMachine<byte[]> machine, CompilerSpec cSpec) Construct a proxy for the host's standard inputstatic IOStreamEmuUnixFileHandlestdout(PcodeMachine<byte[]> machine, CompilerSpec cSpec) Construct a proxy for the host's standard outputintwrite(byte[] buf) Write into the file opened by this handleMethods inherited from class AbstractStreamEmuUnixFileHandle
getAbstractOffset, getOffset, readAbstract, seek, seek, stat, writeAbstract
-
Field Details
-
input
-
output
-
-
Constructor Details
-
IOStreamEmuUnixFileHandle
public IOStreamEmuUnixFileHandle(PcodeMachine<byte[]> machine, CompilerSpec cSpec, InputStream input, OutputStream output) Construct a proxy for a host resourceWARNING: Think carefully before proxying any host resource to a temperamental target program.
- Parameters:
machine- the machine emulating the hardwarecSpec- the ABI of the target platforminput- the stream representing the input side of the descriptor, if applicableoutput- the stream representing the output side of the descriptor, if applicable
-
-
Method Details
-
stdin
Construct a proxy for the host's standard input- Parameters:
machine- the machine emulating the hardwarecSpec- the ABI of the target platform- Returns:
- the proxy's handle
-
stdout
Construct a proxy for the host's standard output- Parameters:
machine- the machine emulating the hardwarecSpec- the ABI of the target platform- Returns:
- the proxy's handle
-
stderr
Construct a proxy for the host's standard error output- Parameters:
machine- the machine emulating the hardwarecSpec- the ABI of the target platform- Returns:
- the proxy's handle
-
read MODIFIED
return type: byte[] → int-byte[] read(byte[] buf) throws EmuIOException+int read(byte[] buf) throws EmuIOExceptionDescription copied from interface:EmuUnixFileDescriptorRead from the file opened by this handle- Parameters:
buf- the destination buffer- Returns:
- the number of bytes read
- Throws:
EmuIOException- if an error occurred
-
write MODIFIED
return type: byte[] → int-byte[] write(byte[] buf) throws EmuIOException+int write(byte[] buf) throws EmuIOExceptionDescription copied from interface:EmuUnixFileDescriptorWrite into the file opened by this handle- Parameters:
buf- the source buffer- Returns:
- the number of bytes written
- Throws:
EmuIOException- if an error occurred
-
close
-