Package io.permazen.cli.cmd
Class AbstractKVCommand
java.lang.Object
io.permazen.cli.cmd.AbstractCommand
io.permazen.cli.cmd.AbstractKVCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
DecodeKeyCommand,KVGetCommand,KVLoadCommand,KVPutCommand,KVRemoveCommand,KVSaveCommand
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classParsesbyte[]data as hexadecimal or doubly-quoted "C" style string.static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final PatternMatches the doubly-quoted C strings returnd bytoCString().static final PatternMatches hexadecimal byte strings.Fields inherited from class io.permazen.cli.cmd.AbstractCommand
log, name, paramParser -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteDatafromCString(String string) Parsebyte[]data encoded as a double-quoted C-string representation bytoCString().protected Parser<?>Convert parameter spec type name into aParser.static StringConvertbyte[]data into a double-quoted C-string representation, surrounded by double quotes, with non-ASCII bytes, double-quotes, and backslashes escaped with a backslash.Methods inherited from class io.permazen.cli.cmd.AbstractCommand
execute, getAction, getHelpDetail, getHelpSummary, getName, getSessionModes, getUsage
-
Field Details
-
CSTRING_PATTERN
Matches the doubly-quoted C strings returnd bytoCString(). -
HEXBYTES_PATTERN
Matches hexadecimal byte strings.
-
-
Constructor Details
-
AbstractKVCommand
-
-
Method Details
-
getParser
Description copied from class:AbstractCommandConvert parameter spec type name into aParser. Used for custom type names not supported byParamParser.The implementation in
AbstractCommandsupports allEncodings registered with the database, plus:objidfor an object ID of the form64e8f29755302fe1(returnsObjId)
- Overrides:
getParserin classAbstractCommand- Parameters:
typeName- parameter encoding ID or encoding ID alias- Returns:
- parser for parameters of the specified type
-
toCString
Convertbyte[]data into a double-quoted C-string representation, surrounded by double quotes, with non-ASCII bytes, double-quotes, and backslashes escaped with a backslash.Supported escapes are
\\,\",\b,\f,\t,\n,\r, and\xNN.- Parameters:
data- byte array- Returns:
- C string representation
-
fromCString
Parsebyte[]data encoded as a double-quoted C-string representation bytoCString().- Parameters:
string- C string- Returns:
- byte data
- Throws:
IllegalArgumentException- ifstringis malformed
-