Class CString

  • All Implemented Interfaces:

    public class CString
    extends com.sun.jna.PointerType
    Represents an allocated C-String.

    Either call toString() or free(). Both methods make sure to reclaim the memory allocated for the string by calling

    • Constructor Summary

      Constructor Description
      CString​(com.sun.jna.Pointer p)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void free()
      Free the memory used by this C-String
      CString fromNative​(java.lang.Object nativeValue, com.sun.jna.FromNativeContext context)  
      java.lang.String toString()
      Returns a String representing the value of this C-String
      • Methods inherited from class com.sun.jna.PointerType

        equals, getPointer, hashCode, nativeType, setPointer, toNative
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • CString

        public CString()
      • CString

        public CString​(com.sun.jna.Pointer p)
    • Method Detail

      • toString

        public java.lang.String toString()
        Returns a String representing the value of this C-String

        Side-effect: frees the memory of the C-String.

        toString in class com.sun.jna.PointerType
        String represented by C-String or "(null)"
      • fromNative

        public CString fromNative​(java.lang.Object nativeValue,
                                  com.sun.jna.FromNativeContext context)
        Specified by:
        fromNative in interface com.sun.jna.NativeMapped
        fromNative in class com.sun.jna.PointerType
      • free

        public void free()
        Free the memory used by this C-String