Class AIFile

  • All Implemented Interfaces:
    java.lang.AutoCloseable, NativeResource, Pointer

    public class AIFile
    extends Struct
    implements NativeResource
    Actually, it's a data structure to wrap a set of fXXXX (e.g fopen) replacement functions.

    The default implementation of the functions utilizes the fXXX functions from the CRT. However, you can supply a custom implementation to Assimp by delivering a custom AIFileIO. Use this to enable reading from other sources, such as ZIP archives or memory locations.

    Member documentation

    • ReadProc – Callback to read from a file
    • WriteProc – Callback to write to a file
    • TellProc – Callback to retrieve the current position of the file cursor (ftell())
    • FileSizeProc – Callback to retrieve the size of the file, in bytes
    • SeekProc – Callback to set the current position of the file cursor (fseek())
    • FlushProc – Callback to flush the file contents
    • UserData – User-defined, opaque data

    Layout

    
     struct aiFile {
         aiFileReadProc ReadProc;
         aiFileWriteProc WriteProc;
         aiFileTellProc TellProc;
         aiFileTellProc FileSizeProc;
         aiFileSeek SeekProc;
         aiFileFlushProc FlushProc;
         aiUserData UserData;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • READPROC, WRITEPROC, TELLPROC, FILESIZEPROC, SEEKPROC, FLUSHPROC, USERDATA

        The struct member offsets.
    • Constructor Detail

      • AIFile

        public AIFile​(java.nio.ByteBuffer container)
        Creates a AIFile instance at the current position of the specified ByteBuffer container. Changes to the buffer's content will be visible to the struct instance and vice versa.

        The created instance holds a strong reference to the container object.

    • Method Detail

      • sizeof

        public int sizeof()
        Description copied from class: Struct
        Returns sizeof(struct).
        Specified by:
        sizeof in class Struct
      • ReadProc

        public AIFileReadProc ReadProc()
        Returns the value of the ReadProc field.
      • WriteProc

        public AIFileWriteProc WriteProc()
        Returns the value of the WriteProc field.
      • TellProc

        public AIFileTellProc TellProc()
        Returns the value of the TellProc field.
      • FileSizeProc

        public AIFileTellProc FileSizeProc()
        Returns the value of the FileSizeProc field.
      • SeekProc

        public AIFileSeek SeekProc()
        Returns the value of the SeekProc field.
      • FlushProc

        public AIFileFlushProc FlushProc()
        Returns the value of the FlushProc field.
      • UserData

        public long UserData()
        Returns the value of the UserData field.
      • ReadProc

        public AIFile ReadProc​(AIFileReadProcI value)
        Sets the specified value to the ReadProc field.
      • WriteProc

        public AIFile WriteProc​(AIFileWriteProcI value)
        Sets the specified value to the WriteProc field.
      • TellProc

        public AIFile TellProc​(AIFileTellProcI value)
        Sets the specified value to the TellProc field.
      • FileSizeProc

        public AIFile FileSizeProc​(AIFileTellProcI value)
        Sets the specified value to the FileSizeProc field.
      • SeekProc

        public AIFile SeekProc​(AIFileSeekI value)
        Sets the specified value to the SeekProc field.
      • FlushProc

        public AIFile FlushProc​(AIFileFlushProcI value)
        Sets the specified value to the FlushProc field.
      • UserData

        public AIFile UserData​(long value)
        Sets the specified value to the UserData field.
      • set

        public AIFile set​(AIFile src)
        Copies the specified struct data to this struct.
        Parameters:
        src - the source struct
        Returns:
        this struct
      • malloc

        public static AIFile malloc()
        Returns a new AIFile instance allocated with memAlloc. The instance must be explicitly freed.
      • calloc

        public static AIFile calloc()
        Returns a new AIFile instance allocated with memCalloc. The instance must be explicitly freed.
      • create

        public static AIFile create​(long address)
        Returns a new AIFile instance for the specified memory address.
      • createSafe

        @Nullable
        public static AIFile createSafe​(long address)
        Like create, but returns null if address is NULL.
      • malloc

        public static AIFile.Buffer malloc​(int capacity)
        Returns a new AIFile.Buffer instance allocated with memAlloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • calloc

        public static AIFile.Buffer calloc​(int capacity)
        Returns a new AIFile.Buffer instance allocated with memCalloc. The instance must be explicitly freed.
        Parameters:
        capacity - the buffer capacity
      • create

        public static AIFile.Buffer create​(long address,
                                           int capacity)
        Create a AIFile.Buffer instance at the specified memory.
        Parameters:
        address - the memory address
        capacity - the buffer capacity
      • createSafe

        @Nullable
        public static AIFile.Buffer createSafe​(long address,
                                               int capacity)
        Like create, but returns null if address is NULL.
      • mallocStack

        public static AIFile mallocStack()
        Returns a new AIFile instance allocated on the thread-local MemoryStack.
      • callocStack

        public static AIFile callocStack()
        Returns a new AIFile instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
      • mallocStack

        public static AIFile mallocStack​(MemoryStack stack)
        Returns a new AIFile instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • callocStack

        public static AIFile callocStack​(MemoryStack stack)
        Returns a new AIFile instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • mallocStack

        public static AIFile.Buffer mallocStack​(int capacity)
        Returns a new AIFile.Buffer instance allocated on the thread-local MemoryStack.
        Parameters:
        capacity - the buffer capacity
      • callocStack

        public static AIFile.Buffer callocStack​(int capacity)
        Returns a new AIFile.Buffer instance allocated on the thread-local MemoryStack and initializes all its bits to zero.
        Parameters:
        capacity - the buffer capacity
      • mallocStack

        public static AIFile.Buffer mallocStack​(int capacity,
                                                MemoryStack stack)
        Returns a new AIFile.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • callocStack

        public static AIFile.Buffer callocStack​(int capacity,
                                                MemoryStack stack)
        Returns a new AIFile.Buffer instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • nUserData

        public static long nUserData​(long struct)
        Unsafe version of UserData().
      • nSeekProc

        public static void nSeekProc​(long struct,
                                     AIFileSeekI value)
        Unsafe version of SeekProc.
      • nUserData

        public static void nUserData​(long struct,
                                     long value)
        Unsafe version of UserData.
      • validate

        public static void validate​(long struct)
        Validates pointer members that should not be NULL.
        Parameters:
        struct - the struct to validate
      • validate

        public static void validate​(long array,
                                    int count)
        Calls validate(long) for each struct contained in the specified struct array.
        Parameters:
        array - the struct array to validate
        count - the number of structs in array