Class OpusFileCallbacks

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

    public class OpusFileCallbacks
    extends org.lwjgl.system.Struct
    implements org.lwjgl.system.NativeResource
    The callbacks used to access non-FILE stream resources.

    The function prototypes are basically the same as for the stdio functions fread(), fseek(), ftell(), and fclose(). The differences are that the FILE * arguments have been replaced with a void *, which is to be used as a pointer to whatever internal data these functions might need, that seek and tell take and return 64-bit offsets, and that seek must return -1 if the stream is unseekable.

    Layout

    
     struct OpusFileCallbacks {
         op_read_func read();
         op_seek_func seek();
         op_tell_func tell();
         op_close_func close;
     }
    • Field Detail

      • SIZEOF

        The struct size in bytes.
      • ALIGNOF

        The struct alignment in bytes.
      • READ, SEEK, TELL, CLOSE

        The struct member offsets.
    • Constructor Detail

      • OpusFileCallbacks

        public OpusFileCallbacks​(java.nio.ByteBuffer container)
        Creates a OpusFileCallbacks 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()
        Specified by:
        sizeof in class org.lwjgl.system.Struct
      • read

        public OPReadFunc read()
        used to read data from the stream. This must not be NULL.
      • seek

        @Nullable
        public OPSeekFunc seek()
        used to seek in the stream. This may be NULL if seeking is not implemented.
      • tell

        @Nullable
        public OPTellFunc tell()
        used to return the current read position in the stream. This may be NULL if seeking is not implemented.
      • close$

        @Nullable
        public OPCloseFunc close$()
        used to close the stream when the decoder is freed. This may be NULL to leave the stream open.
      • malloc

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

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

        public static OpusFileCallbacks create()
        Returns a new OpusFileCallbacks instance allocated with BufferUtils.
      • create

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

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

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

        public static OpusFileCallbacks malloc​(org.lwjgl.system.MemoryStack stack)
        Returns a new OpusFileCallbacks instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
      • calloc

        public static OpusFileCallbacks calloc​(org.lwjgl.system.MemoryStack stack)
        Returns a new OpusFileCallbacks instance allocated on the specified MemoryStack and initializes all its bits to zero.
        Parameters:
        stack - the stack from which to allocate
      • malloc

        public static OpusFileCallbacks.Buffer malloc​(int capacity,
                                                      org.lwjgl.system.MemoryStack stack)
        Returns a new OpusFileCallbacks.Buffer instance allocated on the specified MemoryStack.
        Parameters:
        stack - the stack from which to allocate
        capacity - the buffer capacity
      • calloc

        public static OpusFileCallbacks.Buffer calloc​(int capacity,
                                                      org.lwjgl.system.MemoryStack stack)
        Returns a new OpusFileCallbacks.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
      • nread

        public static OPReadFunc nread​(long struct)
        Unsafe version of read().
      • nseek

        @Nullable
        public static OPSeekFunc nseek​(long struct)
        Unsafe version of seek().
      • ntell

        @Nullable
        public static OPTellFunc ntell​(long struct)
        Unsafe version of tell().
      • nclose$

        @Nullable
        public static OPCloseFunc nclose$​(long struct)
        Unsafe version of close$().
      • nread

        public static void nread​(long struct,
                                 OPReadFuncI value)
        Unsafe version of read.
      • nseek

        public static void nseek​(long struct,
                                 @Nullable
                                 OPSeekFuncI value)
        Unsafe version of seek.
      • ntell

        public static void ntell​(long struct,
                                 @Nullable
                                 OPTellFuncI value)
        Unsafe version of tell.
      • nclose$

        public static void nclose$​(long struct,
                                   @Nullable
                                   OPCloseFuncI value)
        Unsafe version of close$.
      • validate

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