Class CXUnsavedFile

All Implemented Interfaces:
AutoCloseable, NativeResource, Pointer

public class CXUnsavedFile extends Struct<CXUnsavedFile> implements NativeResource

 struct CXUnsavedFile {
     char const * Filename;
     char const * Contents;
     unsigned long Length;
 }
  • Field Details

    • SIZEOF

      public static final int SIZEOF
      The struct size in bytes.
    • ALIGNOF

      public static final int ALIGNOF
      The struct alignment in bytes.
    • FILENAME

      public static final int FILENAME
      The struct member offsets.
    • CONTENTS

      public static final int CONTENTS
      The struct member offsets.
    • LENGTH

      public static final int LENGTH
      The struct member offsets.
  • Constructor Details

    • CXUnsavedFile

      public CXUnsavedFile(ByteBuffer container)
      Creates a CXUnsavedFile 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 Details

    • sizeof

      public int sizeof()
      Description copied from class: Struct
      Returns sizeof(struct).
      Specified by:
      sizeof in class Struct<CXUnsavedFile>
    • Filename

      public ByteBuffer Filename()
      Returns:
      a ByteBuffer view of the null-terminated string pointed to by the Filename field.
    • FilenameString

      public String FilenameString()
      Returns:
      the null-terminated string pointed to by the Filename field.
    • Contents

      public ByteBuffer Contents()
      Returns:
      a ByteBuffer view of the data pointed to by the Contents field.
    • Length

      public long Length()
      Returns:
      the value of the Length field.
    • Filename

      public CXUnsavedFile Filename(ByteBuffer value)
      Sets the address of the specified encoded string to the Filename field.
    • Contents

      public CXUnsavedFile Contents(ByteBuffer value)
      Sets the address of the specified ByteBuffer to the Contents field.
    • set

      public CXUnsavedFile set(ByteBuffer Filename, ByteBuffer Contents)
      Initializes this struct with the specified values.
    • set

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

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

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

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

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

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

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

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

      public static CXUnsavedFile.Buffer create(int capacity)
      Returns a new CXUnsavedFile.Buffer instance allocated with BufferUtils.
      Parameters:
      capacity - the buffer capacity
    • create

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

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

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

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

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

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

      public static ByteBuffer nFilename(long struct)
      Unsafe version of Filename().
    • nFilenameString

      public static String nFilenameString(long struct)
      Unsafe version of FilenameString().
    • nContents

      public static ByteBuffer nContents(long struct)
      Unsafe version of Contents.
    • nLength

      public static long nLength(long struct)
      Unsafe version of Length().
    • nFilename

      public static void nFilename(long struct, ByteBuffer value)
      Unsafe version of Filename.
    • nContents

      public static void nContents(long struct, ByteBuffer value)
      Unsafe version of Contents.
    • nLength

      public static void nLength(long struct, long value)
      Sets the specified value to the Length field of the specified struct.
    • validate

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