Beispiel #1
0
 public CharBuffer encodeListCmd(Mode mode) {
   charBuffer.clear();
   jsonWriter
       .startObject()
       .writeString(FIELD.type.name(), TYPE.listCmd.name())
       .next()
       .writeString(FIELD.data.name(), mode.name())
       .endObject();
   charBuffer.flip();
   return charBuffer;
 }
Beispiel #2
0
 public CharBuffer encodeUnregCmd(Mode mode, String[] names) {
   charBuffer.clear();
   jsonWriter
       .startObject()
       .writeString(FIELD.type.name(), TYPE.unregCmd.name())
       .next()
       .writeFieldName(FIELD.data.name())
       .startObject()
       .writeString(FIELD.mode.name(), mode.name())
       .next()
       .writeFieldName(FIELD.names.name())
       .startArray();
   int i = 0;
   for (String name : names) {
     if (i > 0) jsonWriter.next();
     jsonWriter.writeString(name);
     i++;
   }
   jsonWriter.endArray().endObject().endObject();
   charBuffer.flip();
   return charBuffer;
 }