public class Offset<T> extends Pointer<T>
Area
. Offsets can be typed, e.g.,
Offset<FixedBin>
or Offset<MyLevel1>
,
or generic, e.g, Offset<Object>
or Offset<?>
.
The epli compiler may produce generic offsets with their contents known to be
specific in which case Java casts are used to "dereference". The ref()
method is used to "dereference" an Offset. Dereferencing NULL offsets will throw
the NULLPOINTER
ERROR Condition
.
PL/I OFFSETs when generated as Java Offsets hold references to standard Java
objects allocated on the Java heap but are associated with an Area
to
use that class's facilities to marshal and un-marshal associated objects
"within" Area for I/O operations. It has less to do with actually allocating
the alloted space defined for an Area.
PL/I code
DCL A AREA(32000); DCL O OFFSET(A); DCL 1 W BASED(O), 2 X FIXED BIN(15) 2 Y FIXED BIN(31) 2 Z CHAR(10); ALLOCATE W IN(A) SET(O); O->Y = 11;
Java code
class W extends Group {This is a wrapper class of either a specific or generic object class primarily to cover throw the PL/I@OFFSET(0)
x Short = new Short((short)0);@OFFSET(2)
y Integer = new Integer((int)0);@OFFSET(6)
@CHAR(10) z String = new String(" "); } Area a = new Area("A", 32000); Offset<A> o = new Offset<A>(new W(), a); o.ref() = 11;
NULLPOINTER
ERROR Condition
instead
of Java NullPointerExceptionModifier and Type | Field and Description |
---|---|
static int |
BYTES
size in bytes if converted to a byte array
|
static Offset<java.lang.Object> |
NULL
an undefined OFFSET
|
Constructor and Description |
---|
Offset(T ref,
Area inArea)
Construct an Offset referencing another object in an area
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Invalidate the offset reference.
|
void |
free(boolean ignore)
Invalidate the offset reference ignoring invalid Offsets.
|
Pointer<T> |
fromBytes(byte[] bytes)
turn a sequence of bytes into a Pointer
|
byte[] |
toBytes()
turn a Pointer into a sequence of bytes
|
public static final int BYTES
public static final Offset<java.lang.Object> NULL
public void free()
Area
will cause the Java JVM to remove itpublic void free(boolean ignore)
Area
will cause the Java JVM to remove itpublic byte[] toBytes()