public class RabbitMQUtils extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.apache.jena.riot.Lang |
DEFAULT_RDF_LANG |
private static org.slf4j.Logger |
LOGGER |
| Constructor and Description |
|---|
RabbitMQUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
readByteArray(ByteBuffer buffer)
Reads a byte array from the given buffer assuming that it is preceded by
an int value containing the length of the byte array.
|
static long |
readLong(byte[] data)
Reads a long value from the given byte array.
|
static long |
readLong(byte[] data,
int offset,
int length)
Reads a long value from the given byte array.
|
static org.apache.jena.rdf.model.Model |
readModel(byte[] data)
Reads an RDF model from the given byte array.
|
static org.apache.jena.rdf.model.Model |
readModel(byte[] data,
int offset,
int length)
Reads an RDF model from the given byte array.
|
static org.apache.jena.rdf.model.Model |
readModel(ByteBuffer buffer)
Reads an RDF model from the given byte buffer assuming that the byte
array containing the model is preceded by an int containing its length.
|
static org.apache.jena.rdf.model.Model |
readModel(String string)
Reads an RDF model from the given String.
|
static String |
readString(byte[] data)
Transforms the given byte data into a String using the UTF-8 encoding.
|
static String |
readString(byte[] data,
int offset,
int length)
Transforms the given byte data into a String using the UTF-8 encoding.
|
static String |
readString(ByteBuffer buffer)
Reads a String from the given buffer assuming that it is preceded by an
int value containing the length of the String.
|
static byte[] |
writeByteArrays(byte[][] arrays)
writes the given byte arrays and puts their length in front of them.
|
static byte[] |
writeByteArrays(byte[] precedingData,
byte[][] arrays,
byte[] subsequentData)
writes the given byte arrays and puts their length in front of them.
|
static byte[] |
writeLong(long value)
Creates a byte array representing the given long value.
|
static byte[] |
writeModel(org.apache.jena.rdf.model.Model model)
Creates a byte array containing the serialized RDF model using the
DEFAULT_RDF_LANG. |
static String |
writeModel2String(org.apache.jena.rdf.model.Model model)
Creates a String containing the serialized RDF model using the
DEFAULT_RDF_LANG. |
static byte[] |
writeString(String string)
Creates a byte array representation of the given String using UTF-8
encoding.
|
private static final org.slf4j.Logger LOGGER
public static final org.apache.jena.riot.Lang DEFAULT_RDF_LANG
public static byte[] readByteArray(ByteBuffer buffer)
buffer - the buffer containing an int containing the length of the byte
array followed by the byte array itselfpublic static org.apache.jena.rdf.model.Model readModel(byte[] data)
data - the byte array containing the serialized RDF modelpublic static org.apache.jena.rdf.model.Model readModel(byte[] data,
int offset,
int length)
data - the byte array containing the serialized RDF modeloffset - position at which the parsing will startlength - number of bytes that should be parsedpublic static org.apache.jena.rdf.model.Model readModel(String string)
string - the String containing the serialized RDF modelpublic static org.apache.jena.rdf.model.Model readModel(ByteBuffer buffer)
buffer - the buffer containing the length of the serialized model (as
int) and the byte array containing the serialized modelpublic static String readString(byte[] data)
data - the byte array that should be transformedpublic static String readString(byte[] data, int offset, int length)
data - the byte array that should be transformedoffset - position at which the parsing will startlength - number of bytes that should be parsedpublic static String readString(ByteBuffer buffer)
buffer - the buffer that contains the byte data of the Stringpublic static byte[] writeByteArrays(byte[][] arrays)
readByteArray(ByteBuffer) method.arrays - arrays that should be written to a single arraypublic static byte[] writeByteArrays(byte[] precedingData,
byte[][] arrays,
byte[] subsequentData)
readByteArray(ByteBuffer) method.precedingData - data that should be written before the arrays are written.
Note that this data is not preceded with the byte array
length.arrays - arrays that should be written to a single arraysubsequentData - data that should be written after the arrays are written.
Note that this data is not preceded with the byte array
length.public static byte[] writeString(String string)
string - the String that should be transformed into a byte arraypublic static String writeModel2String(org.apache.jena.rdf.model.Model model)
DEFAULT_RDF_LANG.model - the model that should be serializedpublic static byte[] writeModel(org.apache.jena.rdf.model.Model model)
DEFAULT_RDF_LANG.model - the model that should be serializedpublic static byte[] writeLong(long value)
value - the value that should be serializedpublic static long readLong(byte[] data)
data - a serialized long valuepublic static long readLong(byte[] data,
int offset,
int length)
data - a serialized long valueoffset - position at which the parsing will startlength - number of bytes that should be parsed (should equal
Long.BYTES)Copyright © 2017–2018. All rights reserved.