Class WasiDirStub

  • All Implemented Interfaces:
    WasiDir, WasiIO, WasiConstants, java.io.Closeable, java.lang.AutoCloseable

    public class WasiDirStub
    extends java.lang.Object
    implements WasiDir
    • Constructor Detail

      • WasiDirStub

        public WasiDirStub​(java.lang.String dir)
                    throws java.io.IOException
        Throws:
        java.io.IOException
    • Method Detail

      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Throws:
        java.io.IOException
      • getCanonicalPath

        public java.lang.String getCanonicalPath()
                                          throws java.io.IOException
        Specified by:
        getCanonicalPath in interface WasiDir
        Throws:
        java.io.IOException
      • openFile

        public WasiFile openFile​(java.lang.String filename)
                          throws java.io.IOException
        Specified by:
        openFile in interface WasiDir
        Throws:
        java.io.IOException
      • getType

        public FileType getType()
        Description copied from interface: WasiIO
        Gets the WasiIO file descriptor type.
        Specified by:
        getType in interface WasiIO
        Returns:
        the WasiIO file descriptor type.
      • getDirname

        public java.lang.String getDirname()
        Specified by:
        getDirname in interface WasiDir
      • wasiReadDir

        public int wasiReadDir​(int bufPtr,
                               int bufLen,
                               long cookie,
                               int resPtr,
                               byte[] memory)
        Specified by:
        wasiReadDir in interface WasiDir
      • wasigetPathFileStat

        public int wasigetPathFileStat​(int flags,
                                       int pathPtr,
                                       int pathLen,
                                       int filestatPtr,
                                       byte[] memory)
        Specified by:
        wasigetPathFileStat in interface WasiDir
      • wasiFilestatsSetTimes

        public int wasiFilestatsSetTimes​(int flags,
                                         int pathPtr,
                                         int pathLen,
                                         long accessTime,
                                         long modifiedTime,
                                         int fstFlags,
                                         byte[] memory)
        Adjust the timestamps of a file or directory. Note: This is similar to utimensat in POSIX. Note: Currently only sets the modified time, and does nothing when trying to change access time.
        Specified by:
        wasiFilestatsSetTimes in interface WasiDir
        Parameters:
        flags - Flags determining the method of how the path is resolved.
        pathPtr - pointer to path string
        pathLen - length of path
        accessTime - The desired values of the data access timestamp.
        modifiedTime - The desired values of the data modification timestamp.
        fstFlags - A bitmask indicating which timestamps to adjust. Bit 0 = Adjust the last data access timestamp to the value stored in accessTime Bit 1 = Adjust the last data access timestamp to the time of clock Bit 2 = Adjust the last data modification timestamp to the value stored in modifiedTime Bit 3 = Adjust the last data modification timestamp to the time of clock
        memory - WASI memory
        Returns:
        an ERRNO.
      • wasiOpenPath

        public int wasiOpenPath​(WasiIORegistry registry,
                                int dirflags,
                                int pathPtr,
                                int pathLen,
                                int oflags,
                                int fdPtr,
                                byte[] memory)
        Specified by:
        wasiOpenPath in interface WasiDir
      • wasiCreateDirectory

        public int wasiCreateDirectory​(int pathPtr,
                                       int pathLen,
                                       byte[] memory)
        Creates a directory in the same way that the posix mkdir() function would
        Specified by:
        wasiCreateDirectory in interface WasiDir
        Parameters:
        pathPtr - Pointer to a null-terminated string.
        pathLen - The length of the path string.
        memory - WASI memory
        Returns:
        Errno number.
      • openDir

        public WasiDir openDir​(java.lang.String path)
                        throws java.io.IOException
        Specified by:
        openDir in interface WasiDir
        Throws:
        java.io.IOException
      • openFileOrDir

        public WasiIO openFileOrDir​(java.lang.String path)
                             throws java.io.IOException
        Specified by:
        openFileOrDir in interface WasiDir
        Throws:
        java.io.IOException
      • renameTo

        public void renameTo​(WasiDir newFile)
                      throws java.io.IOException
        Specified by:
        renameTo in interface WasiDir
        Throws:
        java.io.IOException