Top Description Constructors Methods
com.sun.jna.ptr

public abstract Class ByReference

extends PointerType
Class Inheritance
Known Direct Subclasses
com.sun.jna.ptr.ByteByReference, com.sun.jna.ptr.DoubleByReference, com.sun.jna.ptr.FloatByReference, com.sun.jna.ptr.IntByReference, com.sun.jna.ptr.LongByReference, com.sun.jna.ptr.NativeLongByReference, com.sun.jna.ptr.PointerByReference, com.sun.jna.ptr.ShortByReference
Imports
java.lang.reflect.Method, com.sun.jna.Memory, .Pointer, .PointerType

Provides generic "pointer to type" functionality, often used in C code to return values to the caller in addition to a function result.

Derived classes must define setValue(<T>) and <T> getValue() methods which write to/read from the allocated memory.

This class derives from PointerType instead of Memory in order to restrict the API to only getValue/setValue.

Note

this class would ideally be replaced by a generic.

Constructor Summary

AccessConstructor and Description
protected
ByReference(int
The number of bytes to allocate. Must match the byte size of T in the derived class setValue(<T>) and <T> getValue() methods.
dataSize
)

Allocates memory at this pointer, to contain the pointed-to value.

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides com.sun.jna.PointerType.toString.

Returns a string representation of the object.
Inherited from com.sun.jna.PointerType:
equalsfromNativegetPointerhashCodenativeTypesetPointertoNative

Constructor Detail

ByReferenceback to summary
protected ByReference(int dataSize)

Allocates memory at this pointer, to contain the pointed-to value.

Parameters
dataSize:int

The number of bytes to allocate. Must match the byte size of T in the derived class setValue(<T>) and <T> getValue() methods.

Method Detail

toStringback to summary
public String toString()

Overrides com.sun.jna.PointerType.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override