Package ghidra.pcode.emu.unix
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
Fields inherited from class ghidra.pcode.emu.unix.AbstractStreamEmuUnixFileHandle
arithmetic, offsetBytes
Fields inherited from interface ghidra.pcode.emu.unix.EmuUnixFileDescriptor
FD_STDERR, FD_STDIN, FD_STDOUT
-
Constructor Summary
ConstructorDescriptionIOStreamEmuUnixFileHandle
(PcodeMachine<byte[]> machine, CompilerSpec cSpec, InputStream input, OutputStream output) Construct a proxy for a host resource -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this descriptorbyte[]
read
(byte[] buf) Read from the file opened by this handlestatic IOStreamEmuUnixFileHandle
stderr
(PcodeMachine<byte[]> machine, CompilerSpec cSpec) Construct a proxy for the host's standard error outputstatic IOStreamEmuUnixFileHandle
stdin
(PcodeMachine<byte[]> machine, CompilerSpec cSpec) Construct a proxy for the host's standard inputstatic IOStreamEmuUnixFileHandle
stdout
(PcodeMachine<byte[]> machine, CompilerSpec cSpec) Construct a proxy for the host's standard outputbyte[]
write
(byte[] buf) Read into the file opened by this handleMethods inherited from class ghidra.pcode.emu.unix.AbstractStreamEmuUnixFileHandle
getOffset, seek, stat
-
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
Description copied from interface:EmuUnixFileDescriptor
Read 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
Description copied from interface:EmuUnixFileDescriptor
Read 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
public void close()Description copied from interface:EmuUnixFileDescriptor
Close this descriptor
-