Class RESPWriter
java.lang.Object
com.blackrook.redis.io.RESPWriter
- All Implemented Interfaces:
Closeable, AutoCloseable
-
Constructor Summary
ConstructorsConstructorDescriptionRESPWriter(OutputStream out) Opens a RedisWriter attached to an output stream.RESPWriter(Writer out) Opens a RedisWriter attached to a writer. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidwriteArray(Iterable<Object> iterable) Writes a bulk string array.voidwriteArray(Object... objects) Writes a bulk string array.voidwriteArray(String... strings) Writes a bulk string array.voidWrites a bulk string to output.protected voidwriteBulkString(String s, boolean flush) Writes a bulk string.voidwriteChar(char c) Writes a character to output.voidwriteCommand(String commandString) Writes a Redis command as though it will be executed from a REPL-like command prompt.voidwriteError(String s) Writes an error to output.voidWrites a null object.protected voidwriteNull(boolean flush) Writes a null object.voidWrites a null object.voidWrites a number to output.protected voidwriteNumber(Number n, boolean flush) Writes a number to output.voidwriteObject(RedisObject object) Writes a full object that represents a Redis request.voidWrites raw content into this writer and flushes it.voidWrites a simple string to output.protected voidwriteSimpleString(String s, boolean flush) Writes a bulk string to output.
-
Constructor Details
-
RESPWriter
Opens a RedisWriter attached to an output stream.- Parameters:
out- theOutputStreamto use.
-
RESPWriter
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
writeNull
public void writeNull()Writes a null object. -
writeNullArray
public void writeNullArray()Writes a null object. -
writeNumber
-
writeSimpleString
Writes a simple string to output.- Parameters:
s- the string to write.
-
writeBulkString
Writes a bulk string to output.- Parameters:
s- the string to write.
-
writeArray
-
writeArray
Writes a bulk string array.- Parameters:
objects- the objects to write.
-
writeArray
Writes a bulk string array.- Parameters:
strings- the series of strings.
-
writeObject
Writes a full object that represents a Redis request.- Parameters:
object- the Redis object to write.
-
writeChar
public void writeChar(char c) Writes a character to output.- Parameters:
c- the character.
-
writeError
Writes an error to output.- Parameters:
s- the error string to write.
-
writeCommand
Writes a Redis command as though it will be executed from a REPL-like command prompt. The full command is sent to the server as a raw request.- Parameters:
commandString- the command to send to the server.
-
writeRaw
Writes raw content into this writer and flushes it.- Parameters:
rawcontent- the content to send.
-
writeNull
protected void writeNull(boolean flush) Writes a null object.- Parameters:
flush- if true, flushes the stream.
-
writeNumber
Writes a number to output.- Parameters:
n- the number to write.flush- if true, flushes the stream.
-
writeSimpleString
Writes a bulk string to output.- Parameters:
s- the string to write.flush- if true, flushes the stream.
-
writeBulkString
Writes a bulk string.- Parameters:
s- the string to write.flush- if true, flushes the stream.
-