public class DefaultBytesValue extends BytesValue
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
value
The BytesValue value
|
| Modifier | Constructor and Description |
|---|---|
|
DefaultBytesValue(byte[] bytes)
Constructs an BytesValue from a byte array value.
|
|
DefaultBytesValue(DefaultBytesValue bytes)
Constructs a BytesValue from a byte array value.
|
|
DefaultBytesValue(int intValue)
Constructs an bytes from a Integer value.
|
|
DefaultBytesValue(long longValue)
Constructs an bytes from a Long value.
|
|
DefaultBytesValue(String string)
Constructs an bytes from a string using UTF-8 encoding.
|
|
DefaultBytesValue(String string,
int radix)
Constructs an bytes from string interpreted as number using given radix.
|
protected |
DefaultBytesValue(String string,
int min,
int max)
Constructs bytes from a string using UTF-8 encoding.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getValue()
Get the bytes value as byte array.
|
String |
getValueAsHex()
Get the bytes value as hexadecimal string.
|
long |
getValueAsNumber()
Get the bytes value as long.
|
String |
getValueAsString()
Get bytes value as UTF-8 string.
|
static DefaultBytesValue |
valueOf(byte[] bytes)
Static function that creates bytes from byte array.
|
static DefaultBytesValue |
valueOf(int intValue)
Static function that creates bytes from Integer.
|
static DefaultBytesValue |
valueOf(long longValue)
Static function that creates bytes from Long.
|
static DefaultBytesValue |
valueOf(String string)
Static function that creates bytes from string using utf-8 representation.
|
static DefaultBytesValue |
valueOf(String string,
int radix)
Static function that creates bytes from string interpreted as number using given radix.
|
compareTo, equals, hashCode, toStringpublic DefaultBytesValue(DefaultBytesValue bytes)
bytes - The bytes valueepublic DefaultBytesValue(byte[] bytes)
bytes - The byte array containing the BytesValue valuepublic DefaultBytesValue(String string) throws OptionValueException
string - contains the string representation of the bytes value.OptionValueException - when given string cannot be converted to bytes.protected DefaultBytesValue(String string, int min, int max) throws OptionValueException
string - contains the string representation of the bytes value.OptionValueException - when given string does not result in min..max bytespublic DefaultBytesValue(String string, int radix) throws OptionValueException
string - contains the string representation of the bytes value.OptionValueException - when given string does not represent a bytes length of 1..8 bytespublic DefaultBytesValue(int intValue)
intValue - The value to create an bytes from.public DefaultBytesValue(long longValue)
longValue - The value to create an bytes from.public byte[] getValue()
getValue in class BytesValuepublic long getValueAsNumber()
getValueAsNumber in class BytesValuepublic String getValueAsString()
getValueAsString in class BytesValuepublic String getValueAsHex()
getValueAsHex in class BytesValuepublic static DefaultBytesValue valueOf(byte[] bytes) throws OptionValueException
bytes - The byte array containing bytes value.OptionValueException - when byte array was empty or too large.public static DefaultBytesValue valueOf(int intValue) throws OptionValueException
intValue - The integer value to create bytes from.OptionValueException - when byte array was empty or too large.public static DefaultBytesValue valueOf(long longValue) throws OptionValueException
longValue - The long value to create bytes from.OptionValueException - When longValue <= 0.public static DefaultBytesValue valueOf(String string) throws OptionValueException
string - the string to create bytes from.OptionValueException - when given string was too large.public static DefaultBytesValue valueOf(String string, int radix) throws OptionValueException
string - the string to create bytes from.OptionValueException - when given string cannot be converted.Copyright © 2019–2025 Teslanet.nl. All rights reserved.