@Override public ChannelBuffer getEncodedMessage() { ChannelBuffer encodedMessage = ChannelBuffers.dynamicBuffer(); encodedMessage.writeBytes("Command: StatusList\n".getBytes(CharsetUtil.UTF_8)); for (ExtensionStatus es : statuses) { encodedMessage.writeBytes( ("ExtensionStatus: " + new StringBuilder() .append(es.getExtension()) .append(" ") .append( es.getStatus() == null ? DEFAULT_STATUS : new StringBuilder() .append(es.getStatus()) .append(" ") .append(this.dateFormat.format(es.getSince())) .toString()) .toString() + "\n") .getBytes(CharsetUtil.UTF_8)); } encodedMessage.writeBytes("\n".getBytes(CharsetUtil.UTF_8)); encodedMessage = encodedMessage.slice(0, encodedMessage.writerIndex()); return encodedMessage; }
@Override public String toString() { String toReturn = "Command: StatusList\n"; for (ExtensionStatus extensionStatus : statuses) { toReturn += extensionStatus.toString(); } return toReturn; }