Class ByteBufResponseWriter
java.lang.Object
org.infinispan.server.resp.serialization.bytebuf.ByteBufResponseWriter
- All Implemented Interfaces:
ResponseWriter
-
Field Summary
Fields inherited from interface org.infinispan.server.resp.serialization.ResponseWriter
ARRAY_BULK_STRING, ARRAY_DOUBLE, ARRAY_INTEGER, ARRAY_STRING, BULK_STRING, BULK_STRING_BYTES, CUSTOM, DOUBLE, INTEGER, MAP_BULK_STRING_KV, OK, SET_BULK_STRING, SIMPLE_STRING, UNKNOWN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidarray(Collection<?> collection, Resp3Type contentType) Serializes a collection in the array format with elements of a specified type.<T> voidarray(Collection<T> collection, JavaObjectSerializer<T> serializer) Serializes the collection by delegating the serialization of the elements to the provided serializer.voidSerializes a collection in the array format.voidarrayEnd()Finish writing an arrayvoidStart writing a new array elementvoidarrayStart(int size) Start writing an arrayvoidbooleans(boolean value) Serializes a boolean value in the RESP3 format.voidSerializes a double-precision floating point into the doubles format.voidemptySet()Serializes a setvoiderror(CharSequence value) Serializes an error message.voidSerializes the exception message in the RESP3 error format.voidSerializes a 64-bit number in the integer format.booleanvoidSerializes a map.voidSerializes a map with key and values of the same specified type.voidSerializes a map in the RESP3 map format with keys and values of a specified format.voidmap(Map<?, ?> map, SerializationHint.KeyValueHint keyValueHint) voidnulls()Writes the null value.voidok()Serializes a simple string with the"OK"content.voidSerializes a simple string with the"QUEUED"content.voidGeneric method to serialize an object of unknown type.<T> voidset(Set<?> set, JavaObjectSerializer<T> serializer) voidSerializes a set with elements of a specified type.voidsimpleString(CharSequence value) Serializes a char sequence in a simple string format.voidstring(byte[] value) Serializes the binary blob in a bulk string format.voidstring(CharSequence value) Serializes a char sequence in a bulk string format.version()voidversion(RespVersion version) <T> voidwrite(JavaObjectSerializer<T> serializer) Invokes the callback to write a response with the serializer.<T> voidwrite(T object, JavaObjectSerializer<T> serializer) Writes an object utilizing the specific serializer.voidwriteNumericPrefix(byte symbol, long number) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.infinispan.server.resp.serialization.ResponseWriter
customError, indexOutOfRange, minOrMaxNotAValidFloat, minOrMaxNotAValidStringRange, mustBePositive, mustBePositive, nanOrInfinity, noSuchKey, syntaxError, transactionAborted, unauthorized, unknownCommand, valueNotAValidFloat, valueNotInteger, wrongArgumentCount, wrongArgumentNumber, wrongType
-
Constructor Details
-
ByteBufResponseWriter
-
-
Method Details
-
version
- Specified by:
versionin interfaceResponseWriter
-
version
- Specified by:
versionin interfaceResponseWriter
-
isInternal
public boolean isInternal()- Specified by:
isInternalin interfaceResponseWriter
-
nulls
public void nulls()Description copied from interface:ResponseWriterWrites the null value.- Specified by:
nullsin interfaceResponseWriter
-
ok
public void ok()Description copied from interface:ResponseWriterSerializes a simple string with the"OK"content.- Specified by:
okin interfaceResponseWriter
-
queued
Description copied from interface:ResponseWriterSerializes a simple string with the"QUEUED"content.- Specified by:
queuedin interfaceResponseWriter- Parameters:
ignore- Content to ignore.
-
simpleString
Description copied from interface:ResponseWriterSerializes a char sequence in a simple string format.- Specified by:
simpleStringin interfaceResponseWriter- Parameters:
value- The ASCII string to serialize.
-
string
Description copied from interface:ResponseWriterSerializes a char sequence in a bulk string format.- Specified by:
stringin interfaceResponseWriter- Parameters:
value- The string to serialize.
-
string
public void string(byte[] value) Description copied from interface:ResponseWriterSerializes the binary blob in a bulk string format.- Specified by:
stringin interfaceResponseWriter- Parameters:
value- The binary blob to serialize.
-
integers
Description copied from interface:ResponseWriterSerializes a 64-bit number in the integer format.- Specified by:
integersin interfaceResponseWriter- Parameters:
value- Number to serialize.
-
doubles
Description copied from interface:ResponseWriterSerializes a double-precision floating point into the doubles format.- Specified by:
doublesin interfaceResponseWriter- Parameters:
value- The floating point to serialize.
-
booleans
public void booleans(boolean value) Description copied from interface:ResponseWriterSerializes a boolean value in the RESP3 format.- Specified by:
booleansin interfaceResponseWriter- Parameters:
value- Boolean value to serialize.
-
arrayEmpty
public void arrayEmpty()Description copied from interface:ResponseWriterSerializes a collection in the array format.- Specified by:
arrayEmptyin interfaceResponseWriter
-
array
Description copied from interface:ResponseWriterSerializes the collection by delegating the serialization of the elements to the provided serializer.- Specified by:
arrayin interfaceResponseWriter- Type Parameters:
T- The type of the elements in the collection and the serializer handles.- Parameters:
collection- Collection of elements to serialize.serializer- Serializer for a single element in the collection.
-
array
Description copied from interface:ResponseWriterSerializes a collection in the array format with elements of a specified type.- Specified by:
arrayin interfaceResponseWriter- Parameters:
collection- Collection of heterogeneous values to serialize.contentType- The type of elements contained by the sequence.
-
emptySet
public void emptySet()Description copied from interface:ResponseWriterSerializes a set- Specified by:
emptySetin interfaceResponseWriter
-
set
Description copied from interface:ResponseWriterSerializes a set with elements of a specified type.- Specified by:
setin interfaceResponseWriter- Parameters:
set- Set of heterogeneous values to serialize.contentType- The type of elements contained by the set.
-
set
- Specified by:
setin interfaceResponseWriter
-
map
Description copied from interface:ResponseWriterSerializes a map.- Specified by:
mapin interfaceResponseWriter- Parameters:
value- A map with heterogeneous key-value tuples to serialize.
-
map
Description copied from interface:ResponseWriterSerializes a map with key and values of the same specified type.- Specified by:
mapin interfaceResponseWriter- Parameters:
value- A map with heterogeneous key-value tuples to serialize.contentType- The type of key and value elements.
-
map
Description copied from interface:ResponseWriterSerializes a map in the RESP3 map format with keys and values of a specified format.- Specified by:
mapin interfaceResponseWriter- Parameters:
value- A map with heterogeneous key-value tuples to serialize.keyType- The type of keys in the map.valueType- The type of values in the map.
-
map
- Specified by:
mapin interfaceResponseWriter
-
error
Description copied from interface:ResponseWriterSerializes an error message.The first character in the error message must be the
'-'symbol.- Specified by:
errorin interfaceResponseWriter- Parameters:
value- An ASCII char sequence with the error message.
-
error
Description copied from interface:ResponseWriterSerializes the exception message in the RESP3 error format.- Specified by:
errorin interfaceResponseWriter- Parameters:
t- The throwable to serialize.
-
write
Description copied from interface:ResponseWriterWrites an object utilizing the specific serializer.Implementors do not need to check for nullability in the implementation. Null response values are handled by native RESP3 serializers before passing the serialization ahead.
- Specified by:
writein interfaceResponseWriter- Type Parameters:
T- The type of the object.- Parameters:
object- The element to serialize.serializer- The serializer to utilize.
-
write
Description copied from interface:ResponseWriterInvokes the callback to write a response with the serializer.- Specified by:
writein interfaceResponseWriter- Parameters:
serializer- Serializer to write.
-
serialize
Description copied from interface:ResponseWriterGeneric method to serialize an object of unknown type.This method searches all serializers available in the registry.
- Specified by:
serializein interfaceResponseWriter- Parameters:
object- The object to serialize in RESP3 format.
-
writeNumericPrefix
public void writeNumericPrefix(byte symbol, long number) - Specified by:
writeNumericPrefixin interfaceResponseWriter
-
arrayStart
public void arrayStart(int size) Description copied from interface:ResponseWriterStart writing an array- Specified by:
arrayStartin interfaceResponseWriter- Parameters:
size- the number of elements
-
arrayEnd
public void arrayEnd()Description copied from interface:ResponseWriterFinish writing an array- Specified by:
arrayEndin interfaceResponseWriter
-
arrayNext
public void arrayNext()Description copied from interface:ResponseWriterStart writing a new array element- Specified by:
arrayNextin interfaceResponseWriter
-