public static class Message.Frame extends Object
ByteBuffer
.Constructor and Description |
---|
Frame(byte[] data)
Construct a frame with the given bytes.
|
Frame(String data)
Construct a frame with the given String, using the configured
Charset . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
byte[] |
getBlob()
Returns a byte array encoded into the buffer as an int and bytes.
|
byte |
getByte()
Returns the next
byte of data from the buffer. |
byte[] |
getBytes()
Returns a byte array encoded into the buffer as a byte and bytes.
|
String |
getChars()
Deprecated.
Use
getString() instead. |
String |
getClob()
Returns a String value encoded into the buffer as a short and bytes
using the default character set.
|
List<String> |
getClobs()
Returns a list String values encoded into the buffer as a short and
a sequence of strings using the default character set.
|
byte[] |
getData()
Returns the data contained in this frame, as bytes.
|
int |
getInt()
Returns the next 4 bytes of data, as a
int . |
long |
getLong()
Returns the next 8 bytes of data, as a
long . |
Map<String,String> |
getMap()
Returns a list String values encoded into the buffer as an int and
a sequence of pairs of strings using the default character set.
|
short |
getShort()
Returns the next 2 bytes of data, as a
short . |
String |
getString()
Returns a String value encoded into the buffer as a byte and bytes
using the default character set.
|
List<String> |
getStrings()
Returns a list String values encoded into the buffer as a short and
a sequence of strings using the default character set.
|
int |
hashCode() |
boolean |
isBlank()
Returns true if the buffer contains no data.
|
static Message.Frame |
of(byte value)
Create a frame containing a single
byte value. |
static Message.Frame |
of(byte[] value)
Create a frame containing a single
byte[] value. |
static Message.Frame |
of(ByteBuffer buffer)
Create a frame containing the given buffer.
|
static Message.Frame |
of(int value)
Create a frame containing a single
int value. |
static Message.Frame |
of(List<String> values)
Create a frame containing a single List of String values.
|
static Message.Frame |
of(long value)
Create a frame containing a single
long value. |
static Message.Frame |
of(Map<String,String> values)
Create a frame containing a single Map of String pairs.
|
static Message.Frame |
of(short value)
Create a frame containing a single
short value. |
static Message.Frame |
of(String value)
Create a frame containing a single String value.
|
int |
size()
Returns the size of the underlying byte array.
|
String |
toString()
Convert the data to a string using the configured
Charset . |
public Frame(String data)
Charset
.data
- The String dataMessage.CHARSET
public Frame(byte[] data)
data
- The datapublic byte[] getData()
public int size()
public String getString()
Message.CHARSET
public byte getByte()
byte
of data from the buffer.public short getShort()
short
.public int getInt()
int
.public long getLong()
long
.public byte[] getBytes()
@Deprecated public String getChars()
getString()
instead.public List<String> getStrings()
getString()
public byte[] getBlob()
public String getClob()
public List<String> getClobs()
getClob()
public Map<String,String> getMap()
getString()
,
getClob()
public boolean isBlank()
public static Message.Frame of(byte value)
byte
value.value
- The byte
valuepublic static Message.Frame of(short value)
short
value.value
- The short
valuepublic static Message.Frame of(int value)
int
value.value
- The int
valuepublic static Message.Frame of(long value)
long
value.value
- The long
valuepublic static Message.Frame of(String value)
value
- The String valuepublic static Message.Frame of(byte[] value)
byte[]
value.value
- The byte[]
valuepublic static Message.Frame of(List<String> values)
values
- The List of String valuespublic static Message.Frame of(Map<String,String> values)
values
- The Map of String pairspublic static Message.Frame of(ByteBuffer buffer)
buffer
- The bufferCopyright © 2019. All rights reserved.