public BinkpFrame(BinkpCommand command, String arg) { this.arg = arg; isCommand = true; this.command = command; int arglen = (arg == null) ? 0 : arg.getBytes().length; ByteBuffer buf = ByteBuffer.allocate(1 + arglen); buf.put((byte) command.getCmd()); if (arglen > 0) { buf.put(arg.getBytes()); } this.data = buf.array(); init(); }
@Override public String toString() { return "[ " + ((isCommand) ? command.toString() + " " + arg : " DATA ") + " ]"; }