| java.lang.Object org.apache.harmony.awt.nativebridge.ByteBase
ByteBase | public class ByteBase (Code) | | |
Method Summary | |
final void | checkArraysBounds(int toIdx, int srcDstLength, int copyLength, int bytesInData) | final void | checkIndex(int index, int numBytes) | void | copy(ByteBase src, int dstOffset, int length) Copies length bytes from src byteBase to this byteBase.
Offset in destination base is dstOffset. | public void | fill(byte value, int size) | public void | free() | public byte | get(int index) Returns the element at the specified position. | public void | get(byte[] dst, int from, int length) This method transfers bytes into the given destination array. | public long | getAddress(int index) Returns native pointer value from the specified index. | ByteBase | getBytesBaseElementPointer(int index, int numBytes) | public long | getCLong(int index) | public void | getCLong(long[] dst, int offset, int length) This method transfers C long values into the given destination array. | public char | getChar(int index) Reads two bytes at the given index, composing them into a char value
according. | public void | getChar(char[] dst, int offset, int length) This method transfers chars into the given destination array. | char | getCharFromArray(int index) Gets char from the internal array reordering bytes according platform byte order. | public double | getDouble(int index) | public void | getDouble(double[] dst, int offset, int length) This method transfers double values into the given destination array. | public Int8Pointer | getElementPointer(int index) | public float | getFloat(int index) | public void | getFloat(float[] dst, int offset, int length) This method transfers float values into the given destination array. | public short | getInt16(int index) | public void | getInt16(short[] dst, int offset, int length) This method transfers short values into the given destination array. | short | getInt16FromArray(int index) | public int | getInt32(int index) | public void | getInt32(int[] dst, int offset, int length) This method transfers int values into the given destination array. | int | getInt32FromArray(int index) | public long | getInt64(int index) | public void | getInt64(long[] dst, int offset, int length) This method transfers long values into the given destination array. | long | getInt64FromArray(int index) | public String | getString() Creates String from 0 terminated UTF16 (Unicode) string. | public String | getString(long strlen) Creates String from 0 terminated UTF16 (Unicode) string of max
strlen length in bytes. | String | getStringFromArray(int length) | public String | getStringUTF() Creates String from 0 terminated modified UTF8 string. | public String | getStringUTF(long strlen) Creates String from 0 terminated modified UTF8 native string of max
strlen length in bytes. | public boolean | isDirect() | public long | longLockPointer() | public void | set(byte[] src, int offset, int length) This method transfers bytes from the given destination array. | public void | set(int index, byte value) Sets the element at the specified position. | public void | setAddress(int index, long value) Sets the native address to the specified index. | public void | setCLong(int index, long value) | public void | setCLong(long[] src, int offset, int length) This method transfers C long values from the given destination array. | public void | setChar(int index, char value) | public void | setChar(char[] src, int offset, int length) This method transfers chars from the given destination array. | void | setCharInArray(int index, char value) Sets char in the internal array reordering bytes according platform byte order. | public void | setDouble(int index, double value) | public void | setDouble(double[] src, int offset, int length) This method transfers double values from the given destination array. | public void | setFloat(int index, float value) | public void | setFloat(float[] src, int offset, int length) This method transfers float values from the given destination array. | public void | setInt16(int index, short value) | public void | setInt16(short[] src, int offset, int length) This method transfers short values from the given destination array. | void | setInt16InArray(int index, short value) | public void | setInt32(int index, int value) | public void | setInt32(int[] src, int offset, int length) This method transfers int values from the given destination array. | void | setInt32InArray(int index, int value) | public void | setInt64(int index, long value) | public void | setInt64(long[] src, int offset, int length) This method transfers long values from the given destination array. | void | setInt64InArray(int index, long value) | public void | setPointer(int index, VoidPointer p) | public void | setString(String str) Convert String to 0 terminated UTF16 (Unicode) string.
And set it to the internal buffer.
TODO: 1. | void | setStringInArray(String str) | public void | setStringUTF(String str) Convert String to 0 terminated UTF8 (Unicode) string. | long | shortLockPointer() | public int | size() returns the number of elements in memeory referenced by this pointer. | void | unlock() | void | unlockNoCopy() |
CLONG_SIZE | final public static int CLONG_SIZE(Code) | | size of C long type, in bytes.
|
JAVA_BYTE_ORDER | final static int JAVA_BYTE_ORDER(Code) | | |
NATIVE_BYTE_ORDER | final static int NATIVE_BYTE_ORDER(Code) | | |
POINTER_SIZE | final public static int POINTER_SIZE(Code) | | size of C pointer type, in bytes.
|
ByteBase | ByteBase(int size, boolean direct)(Code) | | |
ByteBase | ByteBase(byte[] arr, int offset, int size)(Code) | | |
ByteBase | ByteBase(long addr)(Code) | | |
checkArraysBounds | final void checkArraysBounds(int toIdx, int srcDstLength, int copyLength, int bytesInData)(Code) | | |
copy | void copy(ByteBase src, int dstOffset, int length)(Code) | | Copies length bytes from src byteBase to this byteBase.
Offset in destination base is dstOffset. Starting offset in src base
is always 0;
Parameters: src - source byte base Parameters: dstOffset - destination Parameters: length - |
fill | public void fill(byte value, int size)(Code) | | |
get | public void get(byte[] dst, int from, int length)(Code) | | This method transfers bytes into the given destination array.
Parameters: dst - - The array into which bytes are to be written Parameters: from - - Initial offset in the destination array.Must be non-negative and no larger than dst.length Parameters: length - - The maximum number of bytes to be written to the given array;must be non-negative and no larger than dst.length - from throws: IndexOutOfBoundsException - if from < 0 || from > dst.length throws: IndexOutOfBoundsException - if length < 0 || length > dst.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getAddress | public long getAddress(int index)(Code) | | Returns native pointer value from the specified index.
throws: IndexOutOfBoundsException - if index is out of range |
getBytesBaseElementPointer | ByteBase getBytesBaseElementPointer(int index, int numBytes)(Code) | | |
getCLong | public long getCLong(int index)(Code) | | Reads 4/8 bytes (depending of C long type size on current platform) at
the given index, composing them into a long value according
Parameters: index - - The index from which the bytes will be read The long value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getCLong | public void getCLong(long[] dst, int offset, int length)(Code) | | This method transfers C long values into the given destination array.
Parameters: dst - - The array into which values are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getChar | public char getChar(int index)(Code) | | Reads two bytes at the given index, composing them into a char value
according.
Parameters: index - - The index from which the bytes will be read The char value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getChar | public void getChar(char[] dst, int offset, int length)(Code) | | This method transfers chars into the given destination array.
Parameters: dst - - The array into which chars are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getCharFromArray | char getCharFromArray(int index)(Code) | | Gets char from the internal array reordering bytes according platform byte order.
It is convinient method to be used in subclasses
|
getDouble | public double getDouble(int index)(Code) | | Reads four bytes at the given index, composing them into a double value
according
Parameters: index - - The index from which the bytes will be read The double value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getDouble | public void getDouble(double[] dst, int offset, int length)(Code) | | This method transfers double values into the given destination array.
Parameters: dst - - The array into which values are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getFloat | public float getFloat(int index)(Code) | | Reads four bytes at the given index, composing them into a float value
according
Parameters: index - - The index from which the bytes will be read The float value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getFloat | public void getFloat(float[] dst, int offset, int length)(Code) | | This method transfers float values into the given destination array.
Parameters: dst - - The array into which values are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getInt16 | public short getInt16(int index)(Code) | | Reads two bytes at the given index, composing them into a short value
according
Parameters: index - - The index to which the bytes will be write The short value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getInt16 | public void getInt16(short[] dst, int offset, int length)(Code) | | This method transfers short values into the given destination array.
Parameters: dst - - The array into which values are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getInt16FromArray | short getInt16FromArray(int index)(Code) | | |
getInt32 | public int getInt32(int index)(Code) | | Reads four bytes at the given index, composing them into a int value
according
Parameters: index - - The index from which the bytes will be read The int value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getInt32 | public void getInt32(int[] dst, int offset, int length)(Code) | | This method transfers int values into the given destination array.
Parameters: dst - - The array into which values are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getInt32FromArray | int getInt32FromArray(int index)(Code) | | |
getInt64 | public long getInt64(int index)(Code) | | Reads 8 bytes at the given index, composing them into a long value
according
Parameters: index - - The index from which the bytes will be read The long value at the given index throws: IndexOutOfBoundsException - if index is out of range |
getInt64 | public void getInt64(long[] dst, int offset, int length)(Code) | | This method transfers long values into the given destination array.
Parameters: dst - - The array into which values are to be written Parameters: offset - - The offset within the array of the first element to be written;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be written to the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
getInt64FromArray | long getInt64FromArray(int index)(Code) | | |
getString | public String getString()(Code) | | Creates String from 0 terminated UTF16 (Unicode) string.
convert UTF16 bytes to String
|
getString | public String getString(long strlen)(Code) | | Creates String from 0 terminated UTF16 (Unicode) string of max
strlen length in bytes.
|
getStringFromArray | String getStringFromArray(int length)(Code) | | |
getStringUTF | public String getStringUTF()(Code) | | Creates String from 0 terminated modified UTF8 string.
|
getStringUTF | public String getStringUTF(long strlen)(Code) | | Creates String from 0 terminated modified UTF8 native string of max
strlen length in bytes.
TODO bounds check for Modified UTF-8 strings?
|
set | public void set(byte[] src, int offset, int length)(Code) | | This method transfers bytes from the given destination array.
Parameters: src - - The array from which bytes are to be read Parameters: offset - - The offset within the array of the first byte to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of bytes to be read from the given array;must be non-negative and no larger than array.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setAddress | public void setAddress(int index, long value)(Code) | | Sets the native address to the specified index.
throws: IndexOutOfBoundsException - if index is out of range |
setCLong | public void setCLong(int index, long value)(Code) | | Writes 4/8 bytes (depending of C long type size on current platform) to
the given index, decomposing them from a long value according
Parameters: index - - The index from which the bytes will be write Parameters: value - - long value throws: IndexOutOfBoundsException - if index is out of range |
setCLong | public void setCLong(long[] src, int offset, int length)(Code) | | This method transfers C long values from the given destination array.
Parameters: src - - The array from which values are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setChar | public void setChar(int index, char value)(Code) | | Writes two bytes to the given index, decomposing them from a char value
according
Parameters: index - - The index from which the bytes will be read Parameters: value - - char value throws: IndexOutOfBoundsException - if index is out of range |
setChar | public void setChar(char[] src, int offset, int length)(Code) | | This method transfers chars from the given destination array.
Parameters: src - - The array from which chars are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setCharInArray | void setCharInArray(int index, char value)(Code) | | Sets char in the internal array reordering bytes according platform byte order.
It is convinient method to be used in subclasses
|
setDouble | public void setDouble(int index, double value)(Code) | | Writes four bytes to the given index, decomposing them from a double value
according
Parameters: index - - The index from which the bytes will be write Parameters: value - - double value throws: IndexOutOfBoundsException - if index is out of range |
setDouble | public void setDouble(double[] src, int offset, int length)(Code) | | This method transfers double values from the given destination array.
Parameters: src - - The array from which values are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setFloat | public void setFloat(int index, float value)(Code) | | Writes four bytes to the given index, decomposing them from a float value
according
Parameters: index - - The index from which the bytes will be write Parameters: value - - float value throws: IndexOutOfBoundsException - if index is out of range |
setFloat | public void setFloat(float[] src, int offset, int length)(Code) | | This method transfers float values from the given destination array.
Parameters: src - - The array from which values are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setInt16 | public void setInt16(int index, short value)(Code) | | Writes two bytes to the given index, decomposing them from a short value
according
Parameters: index - - The index from which the bytes will be write Parameters: value - - short value throws: IndexOutOfBoundsException - if index is out of range |
setInt16 | public void setInt16(short[] src, int offset, int length)(Code) | | This method transfers short values from the given destination array.
Parameters: src - - The array from which values are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setInt16InArray | void setInt16InArray(int index, short value)(Code) | | |
setInt32 | public void setInt32(int index, int value)(Code) | | Writes four bytes to the given index, decomposing them from a int value
according
Parameters: index - - The index from which the bytes will be write Parameters: value - - int value throws: IndexOutOfBoundsException - if index is out of range |
setInt32 | public void setInt32(int[] src, int offset, int length)(Code) | | This method transfers int values from the given destination array.
Parameters: src - - The array from which values are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setInt32InArray | void setInt32InArray(int index, int value)(Code) | | |
setInt64 | public void setInt64(int index, long value)(Code) | | Writes 8 bytes to the given index, decomposing them from a long value
according
Parameters: index - - The index from which the bytes will be write Parameters: value - - long value throws: IndexOutOfBoundsException - if index is out of range |
setInt64 | public void setInt64(long[] src, int offset, int length)(Code) | | This method transfers long values from the given destination array.
Parameters: src - - The array from which values are to be read Parameters: offset - - The offset within the array of the first element to be read;must be non-negative and no larger than dst.length Parameters: length - - The maximum number of elements to be read from the given array;must be non-negative and no larger than dst.length - offset throws: IndexOutOfBoundsException - if from < 0 || from > src.length throws: IndexOutOfBoundsException - if length < 0 || length > src.length - from throws: IndexOutOfBoundsException - if length > this.size() |
setInt64InArray | void setInt64InArray(int index, long value)(Code) | | |
setPointer | public void setPointer(int index, VoidPointer p)(Code) | | Parameters: index - Parameters: p - - pointer to set; should be unlocked in a caller method after usage; |
setString | public void setString(String str)(Code) | | Convert String to 0 terminated UTF16 (Unicode) string.
And set it to the internal buffer.
TODO: 1. if size is unknown
TODO: 2. add convinient method getChars(addr, size, str) to StringAccessor to avoid substringing in it
|
setStringUTF | public void setStringUTF(String str)(Code) | | Convert String to 0 terminated UTF8 (Unicode) string.
And set it to buffer
TODO add convinient method getUTFChars(addr, size, str) to StringAccessor
|
size | public int size()(Code) | | returns the number of elements in memeory referenced by this pointer.
Returns -1 if size is unknown.
|
unlockNoCopy | void unlockNoCopy()(Code) | | |
|
|