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

    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

    • FD_STDIN

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

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

      static final int FD_STDERR
      The default file descriptor for stderr (standard error output)
      See Also:
  • 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

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

      void close()
      Close this descriptor