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(nbrBits, 0); // Direct bit access.
}
public boolean get(int i) { ... }
public void set(int i, boolean value) { ...}
}
}
Modifier | Constructor and Description |
---|---|
protected |
Member(int bitLength,
int wordSize)
Base constructor for custom member types.
|
Modifier and Type | Method and Description |
---|---|
int |
bitIndex()
Holds the bit offset of this member (if any).
|
int |
bitLength()
Returns the number of bits in this member.
|
int |
offset()
Returns the byte offset of this member in its struct.
|
Struct |
struct()
Returns the outer
struct container. |
protected Member(int bitLength, int wordSize)
offset()
of the member does not change, only bitIndex()
is
incremented.bitLength
- the number of bits or 0
to force next member on next word boundary.wordSize
- the word size in bytes used when accessing
this member data or 0
if the data is accessed
at the bit level.public final int offset()
offsetof(struct(), this)
public final int bitIndex()
public final int bitLength()
Copyright © 2005 - 2007 Javolution.