Interface EmuUnixFileDescriptor<T>

Type Parameters:
T - the type of values stored in the file
All Known Implementing Classes:
AbsEmuUnixFileHandle, AbstractEmuUnixFileHandle, AbstractStreamEmuUnixFileHandle, DefaultEmuUnixFileHandle, IOStreamEmuUnixFileHandle

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

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

    Change
    Modifier and Type
    Method
    Description
    void
    Close this descriptor
    Returns the current offset of the file, or 0 if not applicable.
    long
    Returns the current offset of the file, or 0 if not applicable.
    int
    read(T buf)
    Read from the file opened by this handle
    Read from the file opened by this handle
    void
    seek(long offset)
    Seek to the given offset
    void
    seek(T offset)
    Seek to the given offset
    Returns the stat structure of the file opened by this handle.
    int
    write(T buf)
    Write into the file opened by this handle
    Write 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

    • getAbstractOffset NEW

      T getAbstractOffset()
      Returns the current offset of the file, or 0 if not applicable.
      Returns:
      the current offset of the file, or 0 if not applicable
    • getOffset MODIFIED

      long getOffset()
      return type: T → long
      -T getOffset()
      +long getOffset()
      Returns the current offset of the file, or 0 if not applicable.
      Returns:
      the current offset of the file, or 0 if not applicable
    • seek

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

      void seek(long offset) throws EmuIOException
      Seek to the given offset
      Parameters:
      offset - the desired offset
      Throws:
      EmuIOException - if an error occurred
    • readAbstract NEW

      T readAbstract(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
    • read MODIFIED

      int read(T buf) throws EmuIOException
      return type: T → int
      -T read(T buf) throws EmuIOException
      +int 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
    • writeAbstract NEW

      T writeAbstract(T buf) throws EmuIOException
      Write into the file opened by this handle
      Parameters:
      buf - the source buffer
      Returns:
      the number of bytes written
      Throws:
      EmuIOException - if an error occurred
    • write MODIFIED

      int write(T buf) throws EmuIOException
      return type: T → int
      -T write(T buf) throws EmuIOException
      +int write(T buf) throws EmuIOException
      Write 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

      Returns the stat structure of the file opened by this handle.
      Returns:
      the stat structure of the file opened by this handle
    • close

      void close()
      Close this descriptor