public class ValuePtr extends Object implements Comparable
Modifier and Type | Field and Description |
---|---|
static ValuePtr |
N
Value pointer to a byte array encoded from string "N".
|
static ValuePtr |
ONE
Value pointer to a byte array encoded from string "1".
|
static ValuePtr |
Y
Value pointer to a byte array encoded from string "Y".
|
static ValuePtr |
ZERO
Value pointer to a byte array encoded from string "0".
|
Constructor and Description |
---|
ValuePtr()
Creates undefined value pointer.
|
ValuePtr(byte[] value)
Creates the value pointer.
|
ValuePtr(byte[] buffer,
int length)
Creates the value pointer.
|
ValuePtr(byte[] buffer,
int offset,
int length)
Creates the value pointer.
|
ValuePtr(String str)
Creates the value pointer on whole byte array encoded from string.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(Object vp) |
boolean |
contentEquals(byte[] buffer,
int offset)
Compares with byte array from the specified offset.
|
boolean |
contentEquals(String str)
Compares with the value pointer on whole byte array encoded from string.
|
boolean |
equals(Object obj) |
byte[] |
getData()
Returns whole byte array containing the value.
|
int |
getLength()
Returns length of the value in the array from offset.
|
int |
getOffset()
Returns offset of the value in the array.
|
byte[] |
getSpecifiedData()
Returns copy of pointed value as a byte array.
|
int |
hashCode() |
boolean |
isEmpty()
Is value empty.
|
boolean |
isSet()
Returns whether value pointer is set/defined.
|
void |
reset()
Resets value pointer to the undefined state.
|
void |
set(byte[] buffer,
int offset,
int length)
Sets value pointer.
|
int |
toInt()
Converts pointed value into integer.
|
long |
toLong()
Converts pointed value into long.
|
String |
toString() |
void |
write(OutputStream outputStream)
Writes pointed value into output stream.
|
public static final ValuePtr Y
public static final ValuePtr N
public static final ValuePtr ZERO
public static final ValuePtr ONE
public ValuePtr()
public ValuePtr(byte[] buffer, int offset, int length)
buffer
- byte array containing the valueoffset
- offset of the value in the arraylength
- length of the value in the array from offsetpublic ValuePtr(byte[] buffer, int length)
buffer
- byte array containing the value which offset is equal to 0length
- length of the value in the array from offsetpublic ValuePtr(byte[] value)
value
- byte array containing the value which offset is equal to 0 and length is equal to value.lengthpublic ValuePtr(String str)
str
- string from which byte array is encoded using String.getBytes()public boolean isSet()
public void reset()
public byte[] getSpecifiedData()
public byte[] getData()
public int getOffset()
public int getLength()
public void set(byte[] buffer, int offset, int length)
buffer
- byte array containing the valueoffset
- offset of the value in the arraylength
- length of the value in the array from offsetNullPointerException
- if (buffer == null)
IllegalArgumentException
- if (buffer == null)
or (offset + length > buffer.length)
or (length < 0)
public boolean isEmpty()
public int toInt()
public long toLong()
public void write(OutputStream outputStream) throws IOException
outputStream
- output stream where the pointed value writtenIOException
- if an I/O error occurs. In particular, an IOException
is thrown if the output
stream is closed.public boolean contentEquals(String str)
str
- string from which byte array is encoded using String.getBytes()public boolean contentEquals(byte[] buffer, int offset)
buffer
- byte arrayoffset
- offset in the arraypublic int compareTo(Object vp)
compareTo
in interface Comparable
Copyright © 2005–2024 Onix Solutions. All rights reserved.