protected class Struct.Member
extends java.lang.Object
Struct
members. It allows applications to define additional member types.
For example:
public class MyStruct extends Struct {
BitSet bits = new BitSet(256);
...
public BitSet extends Member {
public BitSet(int nbrBits) {
super(1, (nbrBits+7)>>3);
}
public boolean get(int i) { ... }
public void set(int i, boolean value) { ...}
}
}
Modifier | Constructor and Description |
---|---|
protected |
Member(int alignment,
int size)
Base constructor for custom member types.
|
Modifier and Type | Method and Description |
---|---|
int |
offset()
Returns the relative offset of this member within its struct.
|
int |
position()
Returns the absolute position of this member in the
byte buffer.
|
Struct |
struct()
Returns the outer
struct container. |
protected Member(int alignment, int size)
alignment
- the desired alignment in bytes.size
- the size of this member in bytes.