diff --git a/examples/src/OpenDis7Examples/AllPduReceiver.java b/examples/src/OpenDis7Examples/AllPduReceiver.java index fb1c292264e47bfc86478f41958fb0d0c8c65182..fca670c79803bdb31e81bcdf6569dd3b4f93e135 100644 --- a/examples/src/OpenDis7Examples/AllPduReceiver.java +++ b/examples/src/OpenDis7Examples/AllPduReceiver.java @@ -54,16 +54,16 @@ public class AllPduReceiver String currentPduFamilyName = pdu.getClass().getSuperclass().getSimpleName(); StringBuilder message = new StringBuilder(); + message.append(DisTime.timeStampToString(pdu.getTimestamp()) + " "); message.append("received DIS PDU "); - if (currentPduType.getValue() < 10) - message.append(" "); // column spacing - message.append(currentPduType.getValue()); String currentPduTypePadded = String.format("%-34s", currentPduType); // - indicates right padding of whitespace message.append(" " ).append(currentPduTypePadded); - String currentPduTypeNamePadded = String.format("%-49s", currentPduTypeName); // - indicates right padding of whitespace - message.append(" of type ").append(currentPduTypeNamePadded); // package.class name - message.append(" (protocolFamily ").append(currentProtocolFamilyID); - // message.append(" ").append(currentPduFamilyName); // class name is also available + if (currentPduType.getValue() < 10) + message.append(" "); // column spacing +// String currentPduTypeNamePadded = String.format("%-49s", currentPduTypeName); // - indicates right padding of whitespace +// message.append(" of type ").append(currentPduTypeNamePadded); // package.class name + message.append(" (").append(currentProtocolFamilyID); +// message.append(" ").append(currentPduFamilyName); // class name is also available message.append(")"); System.out.println(message.toString()); @@ -72,11 +72,14 @@ public class AllPduReceiver case COMMENT: CommentPdu commentPdu = (CommentPdu)pdu; // cast to precise type ArrayList<VariableDatum> payloadList = (ArrayList)commentPdu.getVariableDatums(); + if (!payloadList.isEmpty()) + System.out.print (" messages: "); for (VariableDatum variableDatum : payloadList) { String nextComment = new String(variableDatum.getVariableDatumValue()); // convert byte[] to String - System.out.println("\"" + nextComment + "\""); + System.out.print (" \"" + nextComment + "\""); } + System.out.println(); } } else