AbstractBytes
, BigEndianBytes
, LittleEndianBytes
public interface Bytes
Modifier and Type | Method | Description |
---|---|---|
byte[] |
empty() |
This method provides a simple empty value.
|
static Bytes |
forByteOrder(ByteOrder byteOrder) |
|
byte[] |
fromBoolean(boolean b) |
This method creates a byte array containing the value of the provided
boolean.
|
byte[] |
fromByte(byte b) |
This method creates a byte array containing the value of the provided byte.
|
byte[] |
fromDouble(double d) |
This method creates a byte array containing the value of the provided 64bit
double.
|
byte[] |
fromFloat(float f) |
This method creates a byte array containing the value of the provided 32bit
float.
|
byte[] |
fromHexString(String hexString) |
|
byte[] |
fromInstant(Instant instant) |
This method converts the provided
Instant into an array of bytes. |
byte[] |
fromInt(int i) |
This method creates a byte array containing the value of the provided 32bit
integer.
|
byte[] |
fromLocalDate(LocalDate localDate) |
This method converts the provided
LocalDate into an array of bytes. |
byte[] |
fromLocalDateTime(LocalDateTime localDateTime) |
This method converts the provided
LocalDateTime into an array of
bytes. |
byte[] |
fromLocalTime(LocalTime localTime) |
This method converts the provided
LocalTime into an array of bytes. |
byte[] |
fromLong(long l) |
This method creates a byte array containing the value of the provided 64bit
long.
|
byte[] |
fromShort(short s) |
This method creates a byte array containing the value of the provided 16bit
short.
|
byte[] |
fromString(String string,
Charset charset) |
This method creates a byte array containing the value of the provided string
using the charset provided.
|
byte[] |
fromUnsignedByte(int b) |
This method creates a byte array containing the value of the provided
unsigned byte.
|
byte[] |
fromUnsignedInt(long i) |
This method creates a byte array containing the value of the provided
unsigned 32bit integer.
|
byte[] |
fromUnsignedShort(int s) |
This method creates a byte array containing the value of the provided
unsigned 16bit short.
|
ByteOrder |
getByteOrder() |
This method returns the used byte order.
|
int |
putBoolean(byte[] bytes,
boolean b,
int offset) |
This method writes the provided boolean value into the given byte array.
|
int |
putByte(byte[] bytes,
byte b,
int offset) |
This method writes the provided byte value into the given byte array.
|
int |
putBytes(byte[] destination,
int destinationOffset,
byte[] source) |
This method writes a byte array into another array.
|
int |
putDouble(byte[] bytes,
double d,
int offset) |
This method writes the provided double value into the given byte array.
|
int |
putFloat(byte[] bytes,
float f,
int offset) |
This method writes the provided float value into the given byte array.
|
int |
putInstant(byte[] bytes,
Instant instant,
int offset) |
This method writes the provided
Instant value into the given byte
array. |
int |
putInt(byte[] bytes,
int i,
int offset) |
This method writes the provided integer value into the given byte array.
|
int |
putLocalDate(byte[] bytes,
LocalDate localDate,
int offset) |
This method writes the provided
LocalDate value into the given byte
array. |
int |
putLocalDateTime(byte[] bytes,
LocalDateTime l,
int offset) |
This method writes the provided
LocalDateTime value into the given
byte array. |
int |
putLocalTime(byte[] bytes,
LocalTime localTime,
int offset) |
This method writes the provided
LocalTime value into the given byte
array. |
int |
putLong(byte[] bytes,
long l,
int offset) |
This method writes the provided long value into the given byte array.
|
int |
putShort(byte[] bytes,
short s,
int offset) |
This method writes the provided short value into the given byte array.
|
int |
putUnsignedByte(byte[] bytes,
int b,
int offset) |
This method writes the provided unsigned byte value into the given byte
array.
|
int |
putUnsignedInt(byte[] bytes,
long i,
int offset) |
This method writes the provided unsigned integer value into the given byte
array.
|
int |
putUnsignedShort(byte[] bytes,
int s,
int offset) |
This method writes the provided unsigned short value into the given byte
array.
|
boolean |
toBoolean(byte[] bytes) |
|
boolean |
toBoolean(byte[] bytes,
int offset) |
|
byte |
toByte(byte[] bytes) |
|
byte |
toByte(byte[] bytes,
int offset) |
|
double |
toDouble(byte[] bytes) |
|
double |
toDouble(byte[] bytes,
int offset) |
|
float |
toFloat(byte[] bytes) |
|
float |
toFloat(byte[] bytes,
int offset) |
|
String |
toHexString(byte[] bytes) |
|
String |
toHumanReadableString(byte[] bytes) |
|
Instant |
toInstant(byte[] bytes) |
Converts the provided array into a
Instant . |
Instant |
toInstant(byte[] bytes,
int offset) |
Converts the provided array into a
Instant . |
int |
toInt(byte[] bytes) |
|
int |
toInt(byte[] bytes,
int offset) |
|
LocalDate |
toLocalDate(byte[] bytes) |
Converts the provided array into a
LocalDate . |
LocalDate |
toLocalDate(byte[] bytes,
int offset) |
Converts the provided array into a
LocalDate . |
LocalDateTime |
toLocalDateTime(byte[] bytes) |
Converts the provided array into a
LocalDateTime . |
LocalDateTime |
toLocalDateTime(byte[] bytes,
int offset) |
Converts the provided array into a
LocalDateTime . |
LocalTime |
toLocalTime(byte[] bytes) |
Converts the provided array into a
LocalTime . |
LocalTime |
toLocalTime(byte[] bytes,
int offset) |
Converts the provided array into a
LocalTime . |
long |
toLong(byte[] bytes) |
|
long |
toLong(byte[] bytes,
int offset) |
|
short |
toShort(byte[] bytes) |
|
short |
toShort(byte[] bytes,
int offset) |
|
String |
toString(byte[] bytes,
Charset charset) |
|
int |
toUnsignedByte(byte[] bytes) |
|
int |
toUnsignedByte(byte[] bytes,
int offset) |
|
long |
toUnsignedInt(byte[] bytes) |
|
long |
toUnsignedInt(byte[] bytes,
int offset) |
|
int |
toUnsignedShort(byte[] bytes) |
|
int |
toUnsignedShort(byte[] bytes,
int offset) |
byte[] empty()
static Bytes forByteOrder(ByteOrder byteOrder)
byteOrder
- is the byte order to be used for reading the input stream.Bytes
for the byte order provided.ByteOrder getByteOrder()
ByteOrder
object is returned.int putBytes(byte[] destination, int destinationOffset, byte[] source) throws IllegalArgumentException
destination
- is the destination array to put the source bytes into.destinationOffset
- is the offset of the destination array where to start writing the
bytes.source
- is the array of bytes to be written.IllegalArgumentException
- is thrown if the remaining destination bytes in the destination
array is too small for the bytes from source.byte[] fromBoolean(boolean b)
b
- is the boolean to be converted.int putBoolean(byte[] bytes, boolean b, int offset)
bytes
- is the byte array to write the converted value into.b
- is the boolean to be converted.offset
- is the offset where to write the converted value to.boolean toBoolean(byte[] bytes)
boolean toBoolean(byte[] bytes, int offset)
byte[] fromByte(byte b)
b
- is the byte to be converted.int putByte(byte[] bytes, byte b, int offset)
bytes
- is the byte array to write the converted value into.b
- is the byte to be converted.offset
- is the offset where to write the converted value to.byte toByte(byte[] bytes)
byte toByte(byte[] bytes, int offset)
byte[] fromUnsignedByte(int b)
b
- is the unsigned byte to be converted.int putUnsignedByte(byte[] bytes, int b, int offset)
bytes
- is the byte array to write the converted value into.b
- is the unsigned byte to be converted.offset
- is the offset where to write the converted value to.int toUnsignedByte(byte[] bytes)
int toUnsignedByte(byte[] bytes, int offset)
byte[] fromShort(short s)
s
- is the short to be converted.int putShort(byte[] bytes, short s, int offset)
bytes
- is the byte array to write the converted value into.s
- is the short to be converted.offset
- is the offset where to write the converted value to.short toShort(byte[] bytes)
short toShort(byte[] bytes, int offset)
byte[] fromUnsignedShort(int s)
s
- is the unsigned short to be converted.int putUnsignedShort(byte[] bytes, int s, int offset)
bytes
- is the byte array to write the converted value into.s
- is the unsigned short to be converted.offset
- is the offset where to write the converted value to.int toUnsignedShort(byte[] bytes)
int toUnsignedShort(byte[] bytes, int offset)
byte[] fromInt(int i)
i
- is the integer to be converted.int putInt(byte[] bytes, int i, int offset)
bytes
- is the byte array to write the converted value into.i
- is the integer to be converted.offset
- is the offset where to write the converted value to.int toInt(byte[] bytes)
int toInt(byte[] bytes, int offset)
byte[] fromUnsignedInt(long i)
i
- is the unsigned integer to be converted.int putUnsignedInt(byte[] bytes, long i, int offset)
bytes
- is the byte array to write the converted value into.i
- is the unsigned integer to be converted.offset
- is the offset where to write the converted value to.long toUnsignedInt(byte[] bytes)
long toUnsignedInt(byte[] bytes, int offset)
byte[] fromLong(long l)
l
- is the long to be converted.int putLong(byte[] bytes, long l, int offset)
bytes
- is the byte array to write the converted value into.l
- is the long to be converted.offset
- is the offset where to write the converted value to.long toLong(byte[] bytes)
long toLong(byte[] bytes, int offset)
byte[] fromFloat(float f)
f
- is the float to be converted.int putFloat(byte[] bytes, float f, int offset)
bytes
- is the byte array to write the converted value into.f
- is the float to be converted.offset
- is the offset where to write the converted value to.float toFloat(byte[] bytes)
float toFloat(byte[] bytes, int offset)
byte[] fromDouble(double d)
d
- is the double to be converted.int putDouble(byte[] bytes, double d, int offset)
bytes
- is the byte array to write the converted value into.d
- is the double to be converted.offset
- is the offset where to write the converted value to.double toDouble(byte[] bytes)
double toDouble(byte[] bytes, int offset)
byte[] fromString(String string, Charset charset)
string
- is the string to be converted.charset
- is a Charset
to be used for byte conversion.String toHumanReadableString(byte[] bytes)
String toHexString(byte[] bytes)
byte[] fromHexString(String hexString)
byte[] fromInstant(Instant instant)
Instant
into an array of bytes.instant
- is an Instant
to be converted.int putInstant(byte[] bytes, Instant instant, int offset)
Instant
value into the given byte
array.bytes
- is the byte array to write the converted value into.instant
- is the Instant
to be converted.offset
- is the offset where to write the converted value to.Instant toInstant(byte[] bytes)
Instant
.bytes
- is the array to be converted.Instant
is returned containing the value out of the array.Instant toInstant(byte[] bytes, int offset)
Instant
.bytes
- is the array to be converted.offset
- is the offset in the array to start reading from.Instant
is returned containing the value out of the array.byte[] fromLocalDate(LocalDate localDate)
LocalDate
into an array of bytes.localDate
- is a LocalDate
to be converted.int putLocalDate(byte[] bytes, LocalDate localDate, int offset)
LocalDate
value into the given byte
array.bytes
- is the byte array to write the converted value into.localDate
- is the LocalDate
to be converted.offset
- is the offset where to write the converted value to.LocalDate toLocalDate(byte[] bytes)
LocalDate
.bytes
- is the array to be converted.LocalDate
is returned containing the value out of the
array.LocalDate toLocalDate(byte[] bytes, int offset)
LocalDate
.bytes
- is the array to be converted.offset
- is the offset in the array to start reading from.LocalDate
is returned containing the value out of the
array.byte[] fromLocalTime(LocalTime localTime)
LocalTime
into an array of bytes.localTime
- is a LocalTime
to be converted.int putLocalTime(byte[] bytes, LocalTime localTime, int offset)
LocalTime
value into the given byte
array.bytes
- is the byte array to write the converted value into.localTime
- is the LocalTime
to be converted.offset
- is the offset where to write the converted value to.LocalTime toLocalTime(byte[] bytes)
LocalTime
.bytes
- is the array to be converted.LocalTime
is returned containing the value out of the
array.LocalTime toLocalTime(byte[] bytes, int offset)
LocalTime
.bytes
- is the array to be converted.offset
- is the offset in the array to start reading from.LocalTime
is returned containing the value out of the
array.byte[] fromLocalDateTime(LocalDateTime localDateTime)
LocalDateTime
into an array of
bytes.localDateTime
- is a LocalDateTime
to be converted.int putLocalDateTime(byte[] bytes, LocalDateTime l, int offset)
LocalDateTime
value into the given
byte array.bytes
- is the byte array to write the converted value into.l
- is the LocalDateTime
to be converted.offset
- is the offset where to write the converted value to.LocalDateTime toLocalDateTime(byte[] bytes)
LocalDateTime
.bytes
- is the array to be converted.LocalDateTime
is returned containing the value out of the
array.LocalDateTime toLocalDateTime(byte[] bytes, int offset)
LocalDateTime
.bytes
- is the array to be converted.offset
- is the offset in the array to start reading from.LocalDateTime
is returned containing the value out of the
array.Copyright © 2017–2018 PureSol Technologies. All rights reserved.