@Override final public void write(ObjectOutput out) throws IOException { super.write(out); Map<String, String> map = getPayload(); if (map != null) { out.writeInt(map.size()); for (Map.Entry<String, String> e : map.entrySet()) { out.writeUTF(e.getKey()); out.writeUTF(e.getValue()); } } else { out.writeInt(0); } }
@Override final public void write(ObjectOutput out) throws IOException { super.write(out); Map<String, String> map = getPayload(); if (map != null) { out.writeInt(map.size()); for (Map.Entry<String, String> e : map.entrySet()) { out.writeUTF(e.getKey()); out.writeUTF(e.getValue()); } } else { out.writeInt(0); } }
public void execute(Lookup ctx, StringMapDataCommand cmd) { PrintWriter pw = ctx.lookup(PrintWriter.class); if (pw != null) { pw.println("String map [" + cmd.getName() + "]"); StringBuilder sb = new StringBuilder(); int maxSize = 0; for(Map.Entry<String, String> e : cmd.getPayload().entrySet()) { sb.append(e.getKey()).append(" = ").append(e.getValue()).append("\n"); maxSize = Math.max(maxSize, e.getKey().length() + e.getValue().length() + 3); } sb.insert(0, "\n"); for(int i=0;i<maxSize;i++) { sb.insert(0, "="); } pw.print(sb); } } }
public void execute(Lookup ctx, StringMapDataCommand cmd) { PrintWriter pw = ctx.lookup(PrintWriter.class); if (pw != null) { pw.println("String map [" + cmd.getName() + "]"); StringBuilder sb = new StringBuilder(); int maxSize = 0; for(Map.Entry<String, String> e : cmd.getPayload().entrySet()) { sb.append(e.getKey()).append(" = ").append(e.getValue()).append("\n"); maxSize = Math.max(maxSize, e.getKey().length() + e.getValue().length() + 3); } sb.insert(0, "\n"); for(int i=0;i<maxSize;i++) { sb.insert(0, "="); } pw.print(sb); } } }