public class Header extends Object
Modifier and Type | Method and Description |
---|---|
static Header |
createHeader(String name,
boolean value)
Create a header with name of boolean value
|
static Header |
createHeader(String name,
byte value)
Create a header with name of byte or int8 value
|
static Header |
createHeader(String name,
byte[] value)
Create a header with name of byte[] value
|
static Header |
createHeader(String name,
Date value)
Create a header with name of Date (assumed to be UTC) value
|
static Header |
createHeader(String name,
int value)
Create a header with name of int or int32 value
|
static Header |
createHeader(String name,
long value)
Create a header with name of long or int64 value
|
static Header |
createHeader(String name,
short value)
Create a header with name of short or int16 value
|
static Header |
createHeader(String name,
String value)
Create a header with name of String value
|
static Header |
createHeader(String name,
UUID value)
Create a header with name of UUID value
|
boolean |
equals(Object o) |
static Header |
fromByteBuffer(ByteBuffer buffer)
Marshals buffer into a Header instance
|
HeaderType |
getHeaderType()
Gets the header type of the value.
|
String |
getName()
Gets the name of the header as a (UTF-8) string
|
int |
getTotalByteLength() |
boolean |
getValueAsBoolean()
Gets the value as a boolean.
|
byte |
getValueAsByte()
Gets the value as a byte or int8.
|
byte[] |
getValueAsBytes()
Gets the value as a byte[].
|
int |
getValueAsInt()
Gets the value as an int or int32.
|
long |
getValueAsLong()
Gets the value as a long or int64.
|
short |
getValueAsShort()
Gets the value as a short or int16.
|
String |
getValueAsString()
Gets the value as a utf-8 encoded string.
|
Date |
getValueAsTimestamp()
Gets the value as a Date.
|
UUID |
getValueAsUUID()
Gets the value as a UUID.
|
int |
hashCode() |
static byte[] |
marshallHeadersForJNI(List<Header> headers)
Marshals a list of headers into a usable headers block for an event-stream message.
|
void |
writeToByteBuffer(ByteBuffer buffer)
Writes the value of this header into a buffer, using the wire representation of
the header.
|
public static Header createHeader(String name, boolean value)
name
- name for the header.value
- value for the header.public static Header createHeader(String name, byte value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, String value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, short value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, int value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, long value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, Date value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, byte[] value)
name
- name for the headervalue
- value for the headerpublic static Header createHeader(String name, UUID value)
name
- name for the headervalue
- value for the headerpublic static Header fromByteBuffer(ByteBuffer buffer)
buffer
- buffer to read the header data frompublic void writeToByteBuffer(ByteBuffer buffer)
buffer
- buffer to write this header intopublic String getName()
public HeaderType getHeaderType()
public boolean getValueAsBoolean()
public byte getValueAsByte()
public short getValueAsShort()
public int getValueAsInt()
public long getValueAsLong()
public Date getValueAsTimestamp()
public byte[] getValueAsBytes()
public String getValueAsString()
public UUID getValueAsUUID()
public int getTotalByteLength()
public static byte[] marshallHeadersForJNI(List<Header> headers)
headers
- list of headers to write to the headers blockCopyright © 2021. All rights reserved.