Class DefaultEmuUnixFileHandle<T>
java.lang.Object
ghidra.pcode.emu.unix.AbstractEmuUnixFileHandle<T>
ghidra.pcode.emu.unix.DefaultEmuUnixFileHandle<T>
- Type Parameters:
T- the type of values stored in the file
- All Implemented Interfaces:
EmuUnixFileDescriptor<T>
A concrete file descriptor
-
Field Summary
Fields inherited from class AbstractEmuUnixFileHandle
arithmetic, file, flags, offsetBytes, userFields inherited from interface EmuUnixFileDescriptor
FD_STDERR, FD_STDIN, FD_STDOUT -
Constructor Summary
ConstructorsConstructorDescriptionDefaultEmuUnixFileHandle(PcodeMachine<T> machine, CompilerSpec cSpec, EmuUnixFile<T> file, Set<EmuUnixFileSystem.OpenFlag> flags, EmuUnixUser user) Construct a new handle on the given file -
Method Summary
Modifier and TypeMethodDescriptionReturns the current offset of the file, or 0 if not applicable.longReturns the current offset of the file, or 0 if not applicable.intRead from the file opened by this handlereadAbstract(T buf) Read from the file opened by this handlevoidseek(long offset) Seek to the given offsetvoidSeek to the given offsetintWrite into the file opened by this handlewriteAbstract(T buf) Write into the file opened by this handleMethods inherited from class AbstractEmuUnixFileHandle
checkReadable, checkWritable, close, getFile, stat
-
Constructor Details
-
DefaultEmuUnixFileHandle
public DefaultEmuUnixFileHandle(PcodeMachine<T> machine, CompilerSpec cSpec, EmuUnixFile<T> file, Set<EmuUnixFileSystem.OpenFlag> flags, EmuUnixUser user) Construct a new handle on the given file- Parameters:
machine- the machine emulating the hardwarecSpec- the ABI of the target platformfile- the file opened by this handleflags- the user-specified flags, as defined by the simulatoruser- the user that opened the file- See Also:
-
-
Method Details
-
getOffset
public long getOffset()Description copied from interface:EmuUnixFileDescriptorReturns the current offset of the file, or 0 if not applicable.- Returns:
- the current offset of the file, or 0 if not applicable
-
getAbstractOffset
Description copied from interface:EmuUnixFileDescriptorReturns the current offset of the file, or 0 if not applicable.- Returns:
- the current offset of the file, or 0 if not applicable
-
seek
Description copied from interface:EmuUnixFileDescriptorSeek to the given offset- Parameters:
offset- the desired offset- Throws:
EmuIOException- if an error occurred
-
seek
Description copied from interface:EmuUnixFileDescriptorSeek to the given offset- Parameters:
offset- the desired offset- Throws:
EmuIOException- if an error occurred
-
read
Description 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
-
readAbstract
Description 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
Description 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
-
writeAbstract
Description 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
-