int count = in.readInt(); for (int i = 0 ; i < count ; i++) { int length = in.readInt(); byte[] cmd = new byte[length]; in.readByteArray(cmd); commands.add(cmd); }
commands.add(command);
return 0;
return commands;
dest.writeInt(commands.size()); for (byte[] cmd : commands) { dest.writeInt(cmd.length); dest.writeByteArray(cmd); }