Skip to content
Snippets Groups Projects
Commit 708b7c02 authored by brutzman's avatar brutzman
Browse files

improved output, test with upgraded library

parent 799a512b
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment