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 Link icon

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The default file descriptor for stderr (standard error output)
    static final int
    The default file descriptor for stdin (standard input)
    static final int
    The default file descriptor for stdout (standard output)
  • Method Summary Link icon

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

    • FD_STDIN Link icon

      static final int FD_STDIN
      The default file descriptor for stdin (standard input)
      See Also:
    • FD_STDOUT Link icon

      static final int FD_STDOUT
      The default file descriptor for stdout (standard output)
      See Also:
    • FD_STDERR Link icon

      static final int FD_STDERR
      The default file descriptor for stderr (standard error output)
      See Also:
  • Method Details Link icon

    • getOffset Link icon

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

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

      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 Link icon

      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 Link icon

      Obtain the stat structure of the file opened by this handle
    • close Link icon

      void close()
      Close this descriptor