ConstBytePtr¶
Methods¶
copyTo¶
-
public void
copyTo
(byte[] dest)¶ Copies elements from the pointer to the specified array. The number of elements copied is equal to the size of the array.
When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - dest – non-null array to copy into
copyTo¶
-
public void
copyTo
(byte[] dest, int length)¶ Copies elements from the pointer to the specified array.
When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - dest – non-null array to copy into
- length – number of elements to copy
copyTo¶
-
public void
copyTo
(int srcOffset, byte[] dest, int destOffset, int length)¶ Copies elements from the pointer to the specified array.
When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - srcOffset – offset of the element in the source
- dest – non-null array to copy to
- destOffset – offset of the first element in the destination
- length – number of elements to copy
getGuarded¶
-
public ConstBytePtr
getGuarded
(int length)¶
getGuarded¶
-
public ConstBytePtr
getGuarded
(int fromIndex, int toIndex)¶
getValue¶
-
public byte
getValue
()¶ Returns the value at location 0 of the pointer. This call is equivalent to
get(0)
.When the pointer is not guarded, accessing elements out of range could result in a program crash!
Returns: the value at location 0 of the pointer
getValue¶
-
public byte
getValue
(int idx)¶ Returns the value at the specified location in this pointer.
When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - idx – index of the value to return
Returns: the value at the specified location in this pointer
ofs¶
-
public ConstBytePtr
ofs
(int elemOffset)¶
toASCIIString¶
toByteArray¶
-
public byte[]
toByteArray
(int length)¶ Returns an array containing all of the elements (from
0
tolength
) in this pointer in proper sequence. The array will be newly allocated and no references to it will be maintained. This call is equivalent totoArray(0, length)
.When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - length – number of elements to copy
Returns: an array containing all of the elements (from 0 to length) in this pointer in proper sequence
toByteArray¶
-
public byte[]
toByteArray
(int fromIndex, int toIndex)¶ Returns an array containing all of the elements (from
fromIndex
totoIndex
) in this pointer in proper sequence. The array will be newly allocated and no references to it will be maintained.When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - fromIndex – low endpoint (inclusive) of the pointer
- toIndex – high endpoint (exclusive) of the pointer
Returns: an array containing all of the elements (from fromIndex to toIndex) in this pointer in proper sequence
toString¶
-
public String
toString
(int length)¶ Creates a new String from this pointer with a given length. This method assumes that the encoding of the string is UTF-8.
When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - length – number of bytes to put into the string
Returns: new String from this pointer
toString¶
-
public String
toString
(int length, String charset)¶ Creates a new string from this pointer with a given length and charset.
When the pointer is not guarded, accessing elements out of range could result in a program crash!
Parameters: - length – number of bytes to put into the string
- charset – the charset to be used to decode the bytes
Throws: - UnsupportedEncodingException – In case of not supported charset
Returns: new String from this pointer