Package ghidra.pcode.emu.unix

# Interface EmuUnixFileDescriptor<T>

Type Parameters:
  `T` - the type of values stored in the file

All Known Implementing Classes:
  `AbstractStreamEmuUnixFileHandle`, `DefaultEmuUnixFileHandle`, `IOStreamEmuUnixFileHandle`

public interface EmuUnixFileDescriptor<T>
A process's handle to a file (or other resource)

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `FD_STDERR`
  The default file descriptor for stderr (standard error output)
  `static final int`
  `FD_STDIN`
  The default file descriptor for stdin (standard input)
  `static final int`
  `FD_STDOUT`
  The default file descriptor for stdout (standard output)

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `close()`
  Close this descriptor
  `T`
  `getOffset()`
  Get the current offset of the file, or 0 if not applicable
  `T`
  `read(T buf)`
  Read from the file opened by this handle
  `void`
  `seek(T offset)`
  See to the given offset
  `EmuUnixFileStat`
  `stat()`
  Obtain the `stat` structure of the file opened by this handle
  `T`
  `write(T buf)`
  Read into the file opened by this handle

- ## Field Details

  - ### FD_STDIN

    static final int FD_STDIN
    The default file descriptor for stdin (standard input)
    See Also:
      - Constant Field Values

  - ### FD_STDOUT

    static final int FD_STDOUT
    The default file descriptor for stdout (standard output)
    See Also:
      - Constant Field Values

  - ### FD_STDERR

    static final int FD_STDERR
    The default file descriptor for stderr (standard error output)
    See Also:
      - Constant Field Values

- ## Method Details

  - ### getOffset

    T getOffset()
    Get the current offset of the file, or 0 if not applicable
    Returns:
      the offset

  - ### seek

    void seek(T offset) throws EmuIOException
    See to the given offset
    Parameters:
      `offset` - the desired offset
    Throws:
      `EmuIOException` - if an error occurred

  - ### read

    T read(T buf) throws EmuIOException
    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

    T write(T buf) throws EmuIOException
    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

  - ### stat

    EmuUnixFileStat stat()
    Obtain the `stat` structure of the file opened by this handle

  - ### close

    void close()
    Close this descriptor