|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.vishia.byteData.ByteDataAccess
public abstract class ByteDataAccess
This class is a base class to control the access to binary data.
The binary data may typically used or produced from a part of software written in C or C++.
There the binary data are struct-constructs.
It is able to support several kinds of struct constructs:
struct are adequate mapped with a derivated class of this class,
using the protected commonly access methods like _getInt(int, int) with predefined indexes
in special methods like getValueXyz().struct with nested struct inside are mapped
with one derivated class per struct, define one reference per nested struct
and overwriting the method assignDataToFixChilds()struct inside a struct (inherition in C) can be mapped with
extra derivated classes for the base struct and usind the
assignCasted_i(ByteDataAccess, int)-method.next() sets the indices to a possible but not yet defined current child:
addChild() or its adequate addChildXY() sets the indices to the given current child:
specifyLengthElement() if this method returns >=0.
specifyLengthElementHead() if this method returns >=0.
setLengthElement(int) with the child
or setLengthCurrentChildElement(int) with the parent, respectively with this.
specifyLengthCurrentChildElement() supplied the number of bytes.
But if this method is not overwritten in the inherited class, an exception is thrown.
<+>---> is a composition,
<>---> is a aggregation, <|---- is a inherition.
+-------------------------------+ +----------+
| ByteDataAccess |----data-------->| byte[] |
|-------------------------------| +----------+
|idxBegin:int |
|idxChild:int |<---------------+ a known parent
+-------------+ |idxEnd:int |---parent-------+ setted in addChild()
| derivated | |-------------------------------|
| user |---|>|specifyLengthElement() |
| classes | |specifyLengthElementHead() |--currentChild--+ the actual child element
+-------------+ |specifyLengthCurrentChild() |<---------------+
+-------------------------------+
| Field Summary | |
|---|---|
static int |
_version_
The version. |
protected boolean |
bBigEndian
Flag is set or get data in big endian or little endian (if false) |
protected boolean |
bExpand
|
(package private) java.lang.String |
charset
The charset. |
private ByteDataAccess |
currentChild
The child on end to add() something |
protected byte[] |
data
The array containing the binary data. |
protected int |
idxBegin
Index of the beginning of the actual element in data |
protected int |
idxCurrentChild
Index within the at position of the current child element. |
protected int |
idxCurrentChildEnd
Index of the currents child end. |
protected int |
idxEnd
Index of the end of the actual element in data |
protected int |
idxFirstChild
Index of the first child element, it is after the head. |
static byte |
kEndOfElements
Definition of the code of end of information, return from next() |
protected static int |
kIdxElementCode
Index in the data, position of element code |
static byte |
kNothing
Definition of the code of no information, return from next() |
static byte |
kText
Aussage: es ist ein String (XML: text()), kein Tag im String |
static byte |
kUndefined
coding: the value is undefined |
private ByteDataAccess |
parent
The parent XmlBinCodeElement, necessary only for add() and expand(). |
| Constructor Summary | |
|---|---|
ByteDataAccess()
Constructs a new empty instance. |
|
| Method Summary | |
|---|---|
protected long |
_getLong(int idxInChild,
int nrofBytesAndSign)
Returns the content of 1 to 8 bytes inside the actual element as a long number, big- or little-endian depending on setBigEndian(). |
protected java.lang.String |
_getString(int idx,
int nrofBytes)
sets the content inside the acutal element with the character bytes from the given String. |
protected void |
_setLong(int idx,
int nrofBytes,
long val)
sets the content of 1 to 8 bytes inside the actual element as a long number, big- or little-endian depending on setBigEndian(). |
protected void |
_setString(int idx,
int nrofBytes,
java.lang.String value,
java.lang.String sEncoding,
boolean preventCtrlChars)
sets the content inside the actual element with the character bytes from the given String. |
boolean |
addChild(ByteDataAccess child)
adds an child Element after the current child or as first child after head. |
void |
addChildEmpty(ByteDataAccess child)
Adds a child Element at current end of data to write data. |
void |
addChildFloat(float value)
Adds a child for 1 integer value without a child instance, and sets the value as integer. |
void |
addChildInteger(int nrofBytes,
long value)
Adds a child for 1 integer value without a child instance, and sets the value as integer. |
void |
addChildString(java.lang.CharSequence value)
Adds a child with String value. |
void |
addChildString(java.lang.CharSequence value,
java.lang.String sEncoding)
Adds a child with String value. |
void |
addChildString(java.lang.String value)
Adds a child with String value. |
void |
addChildString(java.lang.String value,
java.lang.String sEncoding,
boolean preventCtrlChars)
Adds a child with String value. |
int |
addText(java.lang.String ss)
Deprecated. |
void |
assignAsChild(ByteDataAccess parent)
Deprecated. use addChild() |
void |
assignAtIndex(int idxChildInParent,
ByteDataAccess parent)
assigns the element to the given position of the parents data to present a child of the parent. |
void |
assignAtIndex(int idxChildInParent,
int lengthChild,
ByteDataAccess parent)
assigns the element to the given position of the parents data to present a child of the parent with a defined length. |
protected void |
assignCasted_i(ByteDataAccess src,
int offsetCastToInput,
int lengthDst)
Assigns this element to the same position in data, but it is another view. |
void |
assignData(byte[] data,
int length)
Assigns new data to this element. |
void |
assignData(byte[] data,
int lengthData,
int index)
Assigns new data to this element at given index in data. |
protected void |
assignDataToFixChilds()
This method is called inside all assign...() methods. |
protected void |
assignDowncast_i(ByteDataAccess input)
Older form, see protected method assignCasted_i(ByteDataAccess, int )
If a cast is possible, it should be programmed in the derivated class. |
void |
assignEmpty(byte[] data)
Initializes a top level, the data are considered as non initalized. |
void |
copyData(int[] dst)
copies some data to a int[], primarily to debug a content. |
void |
copyDataFrom(ByteDataAccess src)
Copies the data into a byte[] |
protected void |
correctCurrentChildEnd(int idxEndNew)
Increments the idxEnd and the idxCurrentChildEnd if a new child is added. |
private void |
correctIdxChildEnd(int idxCurrentChildEndNew)
Increments the idxEnd if a new child is added. |
void |
detach()
Remove all connections. |
void |
elementAt(int indexObjectArray)
Counts the idxChild by given index, idxChild is ByteCount from idxBegin |
void |
expandParent()
Expands the end index of the parent, it means the management of the expanse of the data. |
protected char |
getChar(int idx)
Returns the content of 1 bytes as ASCII inside the actual element. |
double |
getChildDouble()
Adds a child for 1 double value without a child instance, but returns the value as integer. |
float |
getChildFloat()
Adds a child for 1 float value without a child instance, but returns the value as integer. |
long |
getChildInteger(int nrofBytes)
Adds a child for 1 integer value without a child instance, but returns the value as integer. |
java.lang.String |
getChildString(int nrofBytes)
Adds a child for a String value without a child instance, but returns the value as String. |
ByteDataAccess |
getCurrentChild()
|
byte[] |
getData()
Returns the data buffer itself. |
protected double |
getDouble(int idx)
|
protected float |
getFloat(int idx)
Gets a float value from the content of 4 byte. |
protected float |
getFloat(int idxBytes,
int idxArray,
int lengthArray)
|
protected short |
getInt16(int idx)
Returns the content of 2 bytes as a positive nr between 0..65535 inside the actual element. |
protected int |
getInt16(int idxBytes,
int idxArray,
int lengthArray)
|
int |
getInt32(int idx)
Returns the content of 4 bytes inside the actual element as a integer number between -2147483648 and 2147483647, big- or little-endian depending on setBigEndian(). |
protected int |
getInt32(int idxBytes,
int idxArray,
int lengthArray)
|
protected long |
getInt64(int idx)
|
protected byte |
getInt8(int idx)
Returns the content of 1 bytes as a positive or negative nr between -128..127 inside the actual element. |
protected int |
getInt8(int idxBytes,
int idxArray,
int lengthArray)
|
int |
getLength()
Returns the length of the existing actual element. |
int |
getLengthCurrentChildElement()
Returns the length of the current child element. |
int |
getLengthHead()
returns the length of the head. |
int |
getLengthTotal()
Returns the length of the data. |
int |
getMaxNrofBytes()
returns the number number of bytes there are max available from position of the current child |
int |
getMaxNrofBytesForNextChild()
returns the number number of bytes there are max available from position of a next current child |
int |
getPositionInBuffer()
Returns the position of the Element data in the assigned buffer. |
int |
getPositionNextChildInBuffer()
Returns the position of the current child in the assigned buffer. |
protected java.lang.String |
getString(int idx,
int nmax)
Returns a String from the given position inside the actual element . |
java.lang.String |
getText()
Returns the current string or null on end |
protected int |
getUint16(int idx)
Returns the content of 2 bytes as a positive nr between 0..65535, big-endian inside the actual element. |
protected int |
getUint16(int idxBytes,
int idxArray,
int lengthArray)
|
int |
getUint32(int idx)
|
protected int |
getUint32(int idxBytes,
int idxArray,
int lengthArray)
|
protected int |
getUint8(int idx)
Returns the content of 1 bytes as a positive or negative nr between -128..127 inside the actual element. |
protected int |
getUint8(int idxBytes,
int idxArray,
int lengthArray)
|
boolean |
isTextByte(byte nn)
Returns true if the current child element represents a TEXT(), direct ASCII chars, false if the element is a complex element. |
int |
next()
Sets the data index to the position after the current child element and returns its code. |
protected void |
notifyAddChild()
Notifies, that a child is added. |
void |
removeChild()
remove the current child to assign another current child instead of the first one. |
void |
removeChildren()
Remove all children. |
void |
rewind()
starts the calling loop of next(). |
void |
setBigEndian(boolean val)
Sets the big or little endian mode. |
protected void |
setDouble(int idx,
double value)
Set the content of 8 byte from a double variable. |
protected void |
setFloat(int idx,
float value)
Set the content of 4 byte from a float variable. |
protected void |
setFloat(int idxBytes,
int idxArray,
int lengthArray,
float val)
|
protected boolean |
setIdxCurrentChildEnd(int nrofBytes)
sets the idxCurrentChildEnd and idxEnd. |
private void |
setIdxtoNextCurrentChild()
sets the idxCurrentChild to the known idxCurrentChildEnd. |
protected void |
setInt16(int idx,
int value)
Set the content of 2 bytes from an integer between -32768..32768, or from an integer number between 0..65535. |
protected void |
setInt16(int idxBytes,
int idxArray,
int lengthArray,
int val)
|
protected void |
setInt32(int idx,
int value)
Set the content of 4 bytes as a integer number between -2147483648 and 2147483647, big- or little-endian depended from setBigEndian(). |
protected void |
setInt32(int idxBytes,
int idxArray,
int lengthArray,
int val)
|
protected void |
setInt8(int idx,
int value)
Set the content of 1 bytes as a positive nr between 0..256. |
protected void |
setInt8(int idxBytes,
int idxArray,
int lengthArray,
int val)
|
void |
setLengthCurrentChildElement(int lengthOfCurrentChild)
Sets the length of the current child element after calling next(). |
void |
setLengthElement(int length)
Sets the length of the current element, considering all children. |
protected int |
setString(int idx,
int nmax,
java.lang.String ss)
Sets a String to the the given position inside the actual element . |
protected void |
setUint16(int idx,
int value)
Set the content of 2 bytes as a positive nr between 0..65535, big- or little-endian. |
protected void |
setUint16(int idxBytes,
int idxArray,
int lengthArray,
int val)
|
protected void |
setUint32(int idxBytes,
int idxArray,
int lengthArray,
int val)
|
protected void |
setUint32(int idx,
long value)
Set the content of 4 bytes as a positive nr between 0..2pow32-1, big- or little-endian. |
protected void |
setUint8(int idx,
int value)
Set the content of 1 bytes as a positive nr between 0..255, big- or little-endian. |
protected void |
setUint8(int idxBytes,
int idxArray,
int lengthArray,
int val)
|
protected abstract void |
specifyEmptyDefaultData()
Sets the elements data to the default empty data. |
protected int |
specifyLengthCurrentChildElement()
Returns the length of a child element at current position specified in the derivated class. |
protected abstract int |
specifyLengthElement()
Returns the actual length of the whole element presenting with this class. |
abstract int |
specifyLengthElementHead()
Specifies the length of the head data. |
boolean |
sufficingBytesForNextChild(int nrofBytes)
returns true if the given number of bytes is sufficing in the data from position of next child. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int _version_
protected byte[] data
protected int idxBegin
protected int idxEnd
protected boolean bExpand
protected int idxFirstChild
protected int idxCurrentChild
protected int idxCurrentChildEnd
protected boolean bBigEndian
private ByteDataAccess parent
private ByteDataAccess currentChild
java.lang.String charset
public static final byte kEndOfElements
public static final byte kNothing
public static final byte kText
public static final byte kUndefined
protected static final int kIdxElementCode
| Constructor Detail |
|---|
public ByteDataAccess()
| Method Detail |
|---|
public final int getLengthHead()
specifyLengthElementHead()
of the derivated class.
protected abstract void specifyEmptyDefaultData()
protected void specifyEmptyDefaultData()
{ data[idxBegin + 0] = 0;
data[idxBegin + kIdxMid] = 0;
data[idxBegin + kIdxMin] = kNotAValue;
data[idxBegin + kIdxMax] = kNotAValue;
}
public abstract int specifyLengthElementHead()
protected void specifyLengthElementHead()
{ return kIdxFirstChild; //kIdxFistChild should be defined as static final int.
}
protected abstract int specifyLengthElement()
throws java.lang.IllegalArgumentException
idxEnd.
XmlBinCodeElementException - If the data inside are corrupted, the user can throw this exception.
java.lang.IllegalArgumentException
protected int specifyLengthCurrentChildElement()
throws java.lang.IllegalArgumentException
int eChildCode = dataCode.next();
switch(eChildCode)
{ case ...:
{ child.assignAsChild(dataCode); //the child is known yet!
dataCode.setLengthCurrentChildElement(child.getLength());
....
}
If the user always calls setLengthCurrentChildElement in this manner,
he don't need to overwrite specifyLengthCurrentChildElement.
java.lang.IllegalArgumentException
public void assignData(byte[] data,
int length)
throws java.lang.IllegalArgumentException
assign(null, 0);.
data - The data. The length of data may be greater as
the number of the significant bytes.length - Number of significant bytes in data.
If length is > data.length, an exception may be thrown
in any state of the evaluation.
java.lang.IllegalArgumentException - if the length is > data.length
public void assignData(byte[] data,
int lengthData,
int index)
throws java.lang.IllegalArgumentException
assign(null, 0);.
data - The data. The length of data may be greater as
the number of the significant bytes.lengthData - absolute Number of significant bytes in data from idx=0.
If length is > data.length, an exception is thrown.
If the length is <0 (especially -1), it means, it is not known outside.
Than the element is initialized with its known head length.
The length mustn't not ==0, it is tested. Use -1 also if the head length is 0.index - Start position in data
java.lang.IllegalArgumentExceptionpublic final void assignEmpty(byte[] data)
specifyLengthElementHead(). The child Positions
are set to the end of head, no childs are presumed.
The head should be filled with data after that calling some methods like
setInt32(int, int).addChild(ByteDataAccess)
and filled with data after that.
...........the data undefined with defined length.........
+++++ Head, the length should be known.
####****#####**** Space for children,
data - The data. The reference should be initialized, it means
the data have a defined maximum of length. But it is not tested here.
java.lang.IllegalArgumentExceptionpublic final void removeChildren()
public final void detach()
protected final void assignCasted_i(ByteDataAccess src,
int offsetCastToInput,
int lengthDst)
throws java.lang.IllegalArgumentException
src - The known data accessoffsetCastToInput - typical 0 if single inherition is used.
java.lang.IllegalArgumentException - if a length of the new type is specified but the byte[]-data are shorter.
The length of byte[] is tested.
protected final void assignDowncast_i(ByteDataAccess input)
throws java.lang.IllegalArgumentException
assignCasted_i(ByteDataAccess, int )
If a cast is possible, it should be programmed in the derivated class.
input -
java.lang.IllegalArgumentException
public final void assignAsChild(ByteDataAccess parent)
throws java.lang.IllegalArgumentException
next() should be called before. The pattern of using is:
int nWhat; //code of the element
while( (nWhat = dataElement.next()) != ByteDataAccess.kEndOfElements )
{ switch(nWhat) //test the first byte of the current element
{ case ByteDataAccess.kText:
{ sText = dataElement.getText();
} break;
case code1:
{ code1Element.assignAsChild(dataElement);
evaluateValue(code1Element);
} break:
case code2:
{ code1Element.assignAsChild(dataElement);
evaluateValue(code1Element);
} break:
default: throw new IllegalArgumentException("unknown Element", dataElement);
}
}
The difference to addChild(ByteDataAccess) is: addChild() is used
to writeout to data, addChild() appends the child always after idxEnd,
but this method is used to read from data and appends the child at position of the current child.
specifyLengthElementHead(): idxChild
and specifyLengthElement(): idxEnd.
The idxChildEnd of parent is setted, so calling next() after this operation
increments in data after this new child.
parent - The parent. It should reference data, and a current child position
should be set by calling next() before. See sample at next().
java.lang.IllegalArgumentException - If the data are wrong. The exception is thrown
orginal from specifyLengthElement().
public final void assignAtIndex(int idxChildInParent,
int lengthChild,
ByteDataAccess parent)
throws java.lang.IllegalArgumentException
addChild(ByteDataAccess) is: The position is given here
directly, it should not be the current child but a free child.
specifyLengthElementHead(): idxChild
and specifyLengthElement(): idxEnd.
parent - The parent. It should reference data.lengthChild - Number of the bytes of the free child.idxChildInParent - The index of the free child in the data.
java.lang.IllegalArgumentException - If the indices are wrong in respect to the data.
public final void assignAtIndex(int idxChildInParent,
ByteDataAccess parent)
throws java.lang.IllegalArgumentException
parent - The parent. It should reference data.idxChildInParent - The index of the free child in the data.
java.lang.IllegalArgumentException - If the indices are wrong in respect to the data.
protected void assignDataToFixChilds()
throws java.lang.IllegalArgumentException
assignDataAtIndex(byte[], int) should be called for the fix childs.
example:java.lang.IllegalArgumentException
public final boolean addChild(ByteDataAccess child)
throws java.lang.IllegalArgumentException
ByteAccessDerivation child = new ByteAccessDerivation(); //empty and unassigned. parent.addChild(child); //The byte[] data of parent are assigned, index after current child index of parent. child.addChild(grandchild); //By adding a child to this child, also the parent's index is corrected.
child - The child will be assigned with the data of this at index after the current child's end-index.
java.lang.IllegalArgumentException - if the length of the old current child is not determined yet.
Either the method specifyLengthElement() should be overwritten or the method
setLengthElement(int) for the child or setLengthCurrentChildElement(int)
should be called to prevent this exception.
java.lang.IllegalArgumentException - if the length of the head of the new current child is to far for the data.
It means, child.idxEnd > data.length.
public final void removeChild()
throws java.lang.IllegalArgumentException
child -
java.lang.IllegalArgumentExceptionprivate final void setIdxtoNextCurrentChild()
next()
was called before. Than this operation is done already, a second call does nothing.
protected final boolean setIdxCurrentChildEnd(int nrofBytes)
throws java.lang.IllegalArgumentException
nrofBytes - of the child
java.lang.IllegalArgumentException - if there are not enough data.
In expanded mode the data.length are to less.
In using existing data: idxEnd are to less.
public final void addChildEmpty(ByteDataAccess child)
throws java.lang.IllegalArgumentException
child.specifyEmptyDefaultData().
child - The child will associated to this and should be used
to add some content.
java.lang.IllegalArgumentExceptionprotected void notifyAddChild()
protected final void correctCurrentChildEnd(int idxEndNew)
private final void correctIdxChildEnd(int idxCurrentChildEndNew)
public final void expandParent()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public final long getChildInteger(int nrofBytes)
throws java.lang.IllegalArgumentException
nrofBytes - of the integer
java.lang.IllegalArgumentException - if not data has not enaught bytes.
public final float getChildFloat()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if not data has not enaught bytes.
public final double getChildDouble()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if not data has not enaught bytes.
public final void addChildInteger(int nrofBytes,
long value)
throws java.lang.IllegalArgumentException
nrofBytes - of the integer
java.lang.IllegalArgumentException
public final void addChildFloat(float value)
throws java.lang.IllegalArgumentException
nrofBytes - of the integer
java.lang.IllegalArgumentException
public final java.lang.String getChildString(int nrofBytes)
throws java.lang.IllegalArgumentException,
java.io.UnsupportedEncodingException
nrofBytes - of the integer
java.lang.IllegalArgumentException - if not data has not enaught bytes.
java.io.UnsupportedEncodingException
public final void addChildString(java.lang.String value,
java.lang.String sEncoding,
boolean preventCtrlChars)
throws java.lang.IllegalArgumentException,
java.io.UnsupportedEncodingException
value - String to addsEncoding - If null then use the standard encoding of the system-environment.preventCtrlChars - true then values < 0x20 are not set.
If the String value contain a control character with code < 0x20,
a '?' is written. This behavior guarantees, that byte-values < 0x20
can use to detect no-String elements, see getByteNextChild().
java.lang.IllegalArgumentException
java.io.UnsupportedEncodingException
public final void addChildString(java.lang.String value)
throws java.lang.IllegalArgumentException
value - String to add
java.lang.IllegalArgumentException
public final void addChildString(java.lang.CharSequence value,
java.lang.String sEncoding)
throws java.lang.IllegalArgumentException,
java.io.UnsupportedEncodingException
value - String to add, @pjava2c=nonPersistent.
java.lang.IllegalArgumentException
java.io.UnsupportedEncodingException
public final void addChildString(java.lang.CharSequence value)
throws java.lang.IllegalArgumentException
value - String to add, @pjava2c=nonPersistent.
java.lang.IllegalArgumentException
public final int addText(java.lang.String ss)
throws java.lang.IllegalArgumentException
ss - The String to writecolor - The color
java.lang.IllegalArgumentExceptionpublic final void rewind()
public final int next()
throws java.lang.IllegalArgumentException
while( (eElement = code.next()) != kEndOfElements)
{ switch(eElement) { ... }
}
java.lang.IllegalArgumentException
public final boolean sufficingBytesForNextChild(int nrofBytes)
throws java.lang.IllegalArgumentException
nrofBytes - that should fitting in the given data range from current child position
to the end of data determines by calling assingData(...)
or by calling addChild() with a known size of child or setLengthElement() .
java.lang.IllegalArgumentException - see getMaxNrofBytesForNextChild()
public final int getMaxNrofBytesForNextChild()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if the length of the current child is not determined yet.
Either the method specifyLengthElement() should be overwritten or the method
setLengthElement(int) for the child or setLengthCurrentChildElement(int)
should be called to prevent this exception.public final int getMaxNrofBytes()
public final int getLength()
public final int getLengthTotal()
public final byte[] getData()
public final int getPositionInBuffer()
public final int getPositionNextChildInBuffer()
public final int getLengthCurrentChildElement()
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException - if the user has not defined a overloaded methode specifyLengthCurrentChildElement()
or this method has thrown the exception because the length is not determinable.public final void setLengthCurrentChildElement(int lengthOfCurrentChild)
public final void setLengthElement(int length)
length - The length inclusive all children.public final boolean isTextByte(byte nn)
public final java.lang.String getText()
protected java.lang.String getString(int idx,
int nmax)
idx - The start position inside the child.nmax - Maximal number of bytes
protected int setString(int idx,
int nmax,
java.lang.String ss)
idx - The start position inside the child.nmax - Maximal number of bytesss - The String representation of the bytes.
public void setBigEndian(boolean val)
val - true if big endian, hi byte at lower adress, false if little endian.
protected final long _getLong(int idxInChild,
int nrofBytesAndSign)
idxInChild - The position of leading byte in the actual element, the data are taken from data[idxBegin+idx].nrofBytesAndSign - If positiv, than the method returns the unsigned interpretation of the bytes.
If negative, than the return value is negative, if the last significant bit of the given number of bytes is set.
The value represents the number of bytes to interprete as integer. It may be 1..8 respectively -1...-8.
protected final void _setLong(int idx,
int nrofBytes,
long val)
idx - the position of leading byte in the actual element, the data are set to data[idxBegin+idx].nrofBytes - The number of bytes of the value.val - the long value in range adequate nrof bytes.
protected final java.lang.String _getString(int idx,
int nrofBytes)
throws java.io.UnsupportedEncodingException
getByteNextChild().
This method is protected because at user level its using is a prone to errors because the idx is free related.
idx - the position in the actual element, the data are set to data[idxBegin+idx].nrofBytes - The length of the byte[] area to set.
If the String value is longer as nrofBytes, it will be truncated. No exception occurs.
If the String is shorter as nrofBytes, the rest is filled with 0.value - The String value.
java.io.UnsupportedEncodingException
protected final void _setString(int idx,
int nrofBytes,
java.lang.String value,
java.lang.String sEncoding,
boolean preventCtrlChars)
throws java.io.UnsupportedEncodingException
idx - the position in the actual element, the data are set to data[idxBegin+idx].nrofBytes - The length of the byte[] area to set.
If the String value is longer as nrofBytes, it will be truncated. No exception occurs.
If the String is shorter as nrofBytes, the rest is filled with 0.value - The String value.sEncoding - The encoding of the String. null: Use standard encoding.preventCtrlChars - true then values < 0x20 are not set.
If the String value contain a control character with code < 0x20,
a '?' is written. This behavior guarantees, that byte-values < 0x20
can use to detect no-String elements, see getByteNextChild().
java.io.UnsupportedEncodingExceptionpublic final void copyData(int[] dst)
dst - This array is field, but only from data of the current element between idxBegin and idxEndprotected final float getFloat(int idx)
protected final double getDouble(int idx)
protected final long getInt64(int idx)
public final int getInt32(int idx)
idx - the position of leading byte in the actual element, the data are raken from data[idxBegin+idx].
This is not the absolute position in data, idxBegin is added.public final int getUint32(int idx)
protected final int getUint16(int idx)
idx - the position of leading byte in the actual element, the data are raken from data[idxBegin+idx].
This is not the absolute position in data, idxBegin is added.protected final short getInt16(int idx)
idx - the position of leading byte in the actual element, the data are raken from data[idxBegin+idx].
This is not the absolute position in data, idxBegin is added.protected final char getChar(int idx)
idx - the position of char in the actual element, the data are raken from data[idxBegin+idx].
This is not the absolute position in data, idxBegin is added.protected final byte getInt8(int idx)
idx - the position of leading byte in the actual element, the data are raken from data[idxBegin+idx].
This is not the absolute position in data, idxBegin is added.protected final int getUint8(int idx)
idx - the position of leading byte in the actual element, the data are raken from data[idxBegin+idx].
This is not the absolute position in data, idxBegin is added.
protected final int getUint32(int idxBytes,
int idxArray,
int lengthArray)
protected final int getInt32(int idxBytes,
int idxArray,
int lengthArray)
protected final int getInt16(int idxBytes,
int idxArray,
int lengthArray)
protected final int getInt8(int idxBytes,
int idxArray,
int lengthArray)
protected int getUint16(int idxBytes,
int idxArray,
int lengthArray)
protected int getUint8(int idxBytes,
int idxArray,
int lengthArray)
protected float getFloat(int idxBytes,
int idxArray,
int lengthArray)
protected final void setFloat(int idx,
float value)
protected final void setDouble(int idx,
double value)
protected final void setInt32(int idx,
int value)
idx - The position of leading byte in the current elements data.
This is not the absolute position in data, idxBegin is added.value - The value in range 0..65535. The value is taken modulo 0xffffffff.
protected final void setUint8(int idx,
int value)
idx - The position of leading byte in the current elements data.
This is not the absolute position in data, idxBegin is added.value - The value in range 0..65535. The value is taken modulo 0xff.
protected final void setUint16(int idx,
int value)
idx - The position of leading byte in the current elements data.
This is not the absolute position in data, idxBegin is added.value - The value in range 0..65535. The value is taken modulo 0xffff.
protected final void setUint32(int idx,
long value)
idx - The position of leading byte in the current elements data.
This is not the absolute position in data, idxBegin is added.value - The value as long. The value is taken modulo 0xffffffff.
protected final void setInt16(int idx,
int value)
idx - The position of leading byte in the current elements data.
This is not the absolute position in data, idxBegin is added.value - The value in range 0..65535. The value is taken modulo 0xffff.
protected final void setInt8(int idx,
int value)
idx - The position of leading byte in the current elements data.
This is not the absolute position in data, idxBegin is added.value - The value in range 0..65535. The value is taken modulo 0xffff.
protected final void setUint32(int idxBytes,
int idxArray,
int lengthArray,
int val)
protected final void setInt32(int idxBytes,
int idxArray,
int lengthArray,
int val)
protected final void setInt16(int idxBytes,
int idxArray,
int lengthArray,
int val)
protected final void setInt8(int idxBytes,
int idxArray,
int lengthArray,
int val)
protected final void setUint16(int idxBytes,
int idxArray,
int lengthArray,
int val)
protected final void setUint8(int idxBytes,
int idxArray,
int lengthArray,
int val)
protected final void setFloat(int idxBytes,
int idxArray,
int lengthArray,
float val)
public final void copyDataFrom(ByteDataAccess src)
throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentExceptionpublic final void elementAt(int indexObjectArray)
indexObjectArray - Index of Arraypublic final ByteDataAccess getCurrentChild()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||