From 169735fabe01f9cf06fe7c13207cac25e29d9f30 Mon Sep 17 00:00:00 2001
From: brutzman <brutzman@nps.edu>
Date: Tue, 19 Dec 2023 21:56:31 -0800
Subject: [PATCH] updated marshal() method in opendis7-java library returns
 ByteBuffer, handle accordingly

---
 .../DisDemo/src/DisDemo/DisDemonstration.java |  2 +-
 .../src/DisShooting/NetworkComms.java         |  8 +++--
 .../src/OpenDis7Examples/AllPduSenderLog.txt  |  2 +-
 .../src/OpenDis7Examples/EspduSender.java     |  2 +-
 .../src/OpenDis7Examples/EspduSenderLog.txt   | 30 +++++++++----------
 .../ExampleSimulationProgramLog.txt           | 14 ++++-----
 .../ExampleTrackInterpolationLog.txt          |  4 +--
 examples/src/OpenDis7Examples/PduTrack.java   |  6 ++--
 8 files changed, 35 insertions(+), 33 deletions(-)

diff --git a/examples/otherProjects/DisDemo/src/DisDemo/DisDemonstration.java b/examples/otherProjects/DisDemo/src/DisDemo/DisDemonstration.java
index bd52fd8017..55b51d26af 100644
--- a/examples/otherProjects/DisDemo/src/DisDemo/DisDemonstration.java
+++ b/examples/otherProjects/DisDemo/src/DisDemo/DisDemonstration.java
@@ -104,7 +104,7 @@ public class DisDemonstration
                
                // Marshall it, send it
                espdu.setTimestamp(DisTime.getCurrentDisTimestamp());
-               buffer = ByteBuffer.wrap(espdu.marshal());
+               buffer = espdu.marshal();
                
                for(InetAddress aBcast: allBcasts)
                {
diff --git a/examples/otherProjects/DisShooting/src/DisShooting/NetworkComms.java b/examples/otherProjects/DisShooting/src/DisShooting/NetworkComms.java
index 014c1a139c..392bc1277e 100644
--- a/examples/otherProjects/DisShooting/src/DisShooting/NetworkComms.java
+++ b/examples/otherProjects/DisShooting/src/DisShooting/NetworkComms.java
@@ -114,10 +114,12 @@ public class NetworkComms implements Runnable
     {
         aPdu.setTimestamp(DisTime.getCurrentDisTimestamp());
         try {
-            sendPacket.setData(aPdu.marshal());
-            if (!socket.isClosed())
+            if (!socket.isClosed() && (aPdu.marshal() != null))
+            {
+                sendPacket.setData(aPdu.marshal().array());
                 socket.send(sendPacket);
-        } catch (IOException ex) {
+            }
+        } catch (Exception ex) {
             Logger.getLogger(NetworkComms.class.getName()).log(Level.SEVERE, null, ex);
         } finally {
             buffSend.clear();
diff --git a/examples/src/OpenDis7Examples/AllPduSenderLog.txt b/examples/src/OpenDis7Examples/AllPduSenderLog.txt
index 627a515c56..2d064757fa 100644
--- a/examples/src/OpenDis7Examples/AllPduSenderLog.txt
+++ b/examples/src/OpenDis7Examples/AllPduSenderLog.txt
@@ -90,4 +90,4 @@ Sent packet #70, DisPduType 70 INFORMATION_OPERATIONS_ACTION      (packet.getLen
 Sent packet #71, DisPduType 71 INFORMATION_OPERATIONS_REPORT      (packet.getLength()= 40) of type InformationOperationsReportPdu
 Sent packet #72, DisPduType 72 ATTRIBUTE                          (packet.getLength()= 32) of type AttributePdu
 OpenDis7Examples.AllPduSender complete, sent 72 PDUs total.
-BUILD SUCCESSFUL (total time: 4 seconds)
+BUILD SUCCESSFUL (total time: 2 seconds)
diff --git a/examples/src/OpenDis7Examples/EspduSender.java b/examples/src/OpenDis7Examples/EspduSender.java
index 610f6b553c..cad28676dd 100644
--- a/examples/src/OpenDis7Examples/EspduSender.java
+++ b/examples/src/OpenDis7Examples/EspduSender.java
@@ -317,7 +317,7 @@ public class EspduSender
 
 				FirePdu firePdu = new FirePdu();
                 firePdu.setLocationInWorldCoordinates(espdu.getEntityLocation());
-				byte[] fireArray = firePdu.marshal();
+				byte[] fireArray = firePdu.marshal().array(); // can also use ByteBuffer
 
 				System.out.println("FirePdu #" + index + " firePdu=[FireMissionIndex=" + firePdu.getFireMissionIndex() + ", descriptor=" + firePdu.getDescriptor()+ "]");
 
diff --git a/examples/src/OpenDis7Examples/EspduSenderLog.txt b/examples/src/OpenDis7Examples/EspduSenderLog.txt
index 6f53027583..147bd57a2f 100644
--- a/examples/src/OpenDis7Examples/EspduSenderLog.txt
+++ b/examples/src/OpenDis7Examples/EspduSenderLog.txt
@@ -26,11 +26,11 @@ Create new PDUs
 Espdu #1 entityID=[1,2,3]
 FirePdu #1 firePdu=[FireMissionIndex=0, descriptor=MunitionDescriptor munitionType:EntityType entityKind:EntityKind 0 OTHER domain:Other country:Country 0 OTHER category:0 subCategory:0 specific:0 extra:0 warhead:MunitionDescriptorWarhead 0 OTHER fuse:MunitionDescriptorFuse 0 OTHER quantity:0 rate:0]
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 127.255.255.255 port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 127.255.255.255 port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 127.255.255.255 port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 172.20.209.15   port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 172.20.209.15   port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 172.20.209.15   port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 10.0.0.255      port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 10.0.0.255      port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 10.0.0.255      port 3000
 ===============
 Create new PDUs
   latitude, longitude:   [36.595517, -121.877]
@@ -38,11 +38,11 @@ Create new PDUs
 Espdu #2 entityID=[1,2,3]
 FirePdu #2 firePdu=[FireMissionIndex=0, descriptor=MunitionDescriptor munitionType:EntityType entityKind:EntityKind 0 OTHER domain:Other country:Country 0 OTHER category:0 subCategory:0 specific:0 extra:0 warhead:MunitionDescriptorWarhead 0 OTHER fuse:MunitionDescriptorFuse 0 OTHER quantity:0 rate:0]
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 127.255.255.255 port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 127.255.255.255 port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 127.255.255.255 port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 172.20.209.15   port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 172.20.209.15   port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 172.20.209.15   port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 10.0.0.255      port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 10.0.0.255      port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 10.0.0.255      port 3000
 ===============
 Create new PDUs
   latitude, longitude:   [36.595517, -121.87706]
@@ -50,11 +50,11 @@ Create new PDUs
 Espdu #3 entityID=[1,2,3]
 FirePdu #3 firePdu=[FireMissionIndex=0, descriptor=MunitionDescriptor munitionType:EntityType entityKind:EntityKind 0 OTHER domain:Other country:Country 0 OTHER category:0 subCategory:0 specific:0 extra:0 warhead:MunitionDescriptorWarhead 0 OTHER fuse:MunitionDescriptorFuse 0 OTHER quantity:0 rate:0]
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 127.255.255.255 port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 127.255.255.255 port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 127.255.255.255 port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 172.20.209.15   port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 172.20.209.15   port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 172.20.209.15   port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 10.0.0.255      port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 10.0.0.255      port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 10.0.0.255      port 3000
 ===============
 Create new PDUs
   latitude, longitude:   [36.595517, -121.877]
@@ -62,11 +62,11 @@ Create new PDUs
 Espdu #4 entityID=[1,2,3]
 FirePdu #4 firePdu=[FireMissionIndex=0, descriptor=MunitionDescriptor munitionType:EntityType entityKind:EntityKind 0 OTHER domain:Other country:Country 0 OTHER category:0 subCategory:0 specific:0 extra:0 warhead:MunitionDescriptorWarhead 0 OTHER fuse:MunitionDescriptorFuse 0 OTHER quantity:0 rate:0]
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 127.255.255.255 port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 127.255.255.255 port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 127.255.255.255 port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 172.20.209.15   port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 172.20.209.15   port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 172.20.209.15   port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 10.0.0.255      port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 10.0.0.255      port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 10.0.0.255      port 3000
 ===============
 Create new PDUs
   latitude, longitude:   [36.595517, -121.87706]
@@ -74,11 +74,11 @@ Create new PDUs
 Espdu #5 entityID=[1,2,3]
 FirePdu #5 firePdu=[FireMissionIndex=0, descriptor=MunitionDescriptor munitionType:EntityType entityKind:EntityKind 0 OTHER domain:Other country:Country 0 OTHER category:0 subCategory:0 specific:0 extra:0 warhead:MunitionDescriptorWarhead 0 OTHER fuse:MunitionDescriptorFuse 0 OTHER quantity:0 rate:0]
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 127.255.255.255 port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 127.255.255.255 port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 127.255.255.255 port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 172.20.209.15   port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 172.20.209.15   port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 172.20.209.15   port 3000
 [OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 01 ENTITY_STATE] packet.getLength()=144, to 10.0.0.255      port 3000
-[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 96, to 10.0.0.255      port 3000
+[OpenDis7Examples.EspduSender] sending datagram packet [DisPduType 02 FIRE        ] packet.getLength()= 1500, to 10.0.0.255      port 3000
 ===============
 [OpenDis7Examples.EspduSender] complete.
 BUILD SUCCESSFUL (total time: 8 seconds)
diff --git a/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt b/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt
index 4293475b69..405384bbb8 100644
--- a/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt
+++ b/examples/src/OpenDis7Examples/ExampleSimulationProgramLog.txt
@@ -15,7 +15,7 @@ run-single:
 [DisThreadedNetworkInterface] createThreads() receiveThread.isAlive()=true
 [DisChannel ExampleSimulationProgram] Network confirmation: address=239.1.2.3 port=3000
 [DisChannel ExampleSimulationProgram] Beginning pdu save to directory ./pduLog
-[PduRecorder] Recorder log file open: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog.dislog
+[PduRecorder] Recorder log file open: C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog3.dislog
 [DisThreadedNetworkInterface] using network interface PANGP Virtual Ethernet Adapter Secure
 [DisThreadedNetworkInterface] datagramSocket.joinGroup  address=239.1.2.3 port=3000 isConnected()=false createDatagramSocket() complete.
 [DisThreadedNetworkInterface] createThreads() sendingThread.isAlive()=true
@@ -23,8 +23,8 @@ run-single:
 [PduRecorder PduRecorder] listening to IP address 239.1.2.3 on port 3000
 [DisChannel ExampleSimulationProgram] just checking: disChannel.getNetworkAddress()=239.1.2.3, getNetworkPort()=3000
 [DisChannel ExampleSimulationProgram] just checking: hasVerboseSending()=true, hasVerboseReceipt()=true
-[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt  1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [sending  1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
+[DisThreadedNetworkInterface ExampleSimulationProgram] [receipt  1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [sending  2] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [receipt  2] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [sending  3] DisPduType 22 COMMENT, size 80 bytes)
@@ -37,13 +37,13 @@ run-single:
 [DisThreadedNetworkInterface ExampleSimulationProgram] [sending  4] DisPduType 22 COMMENT, size 112 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [receipt  4] DisPduType 22 COMMENT, size 112 bytes)
 [DisThreadedNetworkInterface PduRecorder] [receipt  4] DisPduType 22 COMMENT, size 112 bytes)
-[DisChannel ExampleSimulationProgram] *** [CommentPdu TIME] [Simulation time 0.0 at LocalDateTime 2023-12-18T21:40:29.203159300]
+[DisChannel ExampleSimulationProgram] *** [CommentPdu TIME] [Simulation time 0.0 at LocalDateTime 2023-12-19T21:27:41.865637800]
 ... My simulation just did something, no really...
 ... [Pausing for 1.0 seconds]
 ... sending PDUs of interest for simulation step 1, monitor loopback to confirm sent
+[DisThreadedNetworkInterface ExampleSimulationProgram] [sending  5] DisPduType 01 ENTITY_STATE  Entity #53, size 144 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [receipt  5] DisPduType 01 ENTITY_STATE  Entity #53, size 144 bytes)
 [DisThreadedNetworkInterface PduRecorder] [receipt  5] DisPduType 01 ENTITY_STATE  Entity #53, size 144 bytes)
-[DisThreadedNetworkInterface ExampleSimulationProgram] [sending  5] DisPduType 01 ENTITY_STATE  Entity #53, size 144 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [sending  6] DisPduType 02 FIRE, size 96 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [receipt  6] DisPduType 02 FIRE, size 96 bytes)
 [DisThreadedNetworkInterface PduRecorder] [receipt  6] DisPduType 02 FIRE, size 96 bytes)
@@ -85,9 +85,9 @@ run-single:
 [DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
 [DisThreadedNetworkInterface PduRecorder] [receipt 15] DisPduType 22 COMMENT, size 104 bytes)
 [DisChannel ExampleSimulationProgram] *** [CommentPdu APPLICATION_STATUS] [MV3500 ExampleSimulationProgram, runSimulation() loop 3]
+[DisThreadedNetworkInterface ExampleSimulationProgram] [sending 16] DisPduType 01 ENTITY_STATE   Entity #2, size 144 bytes)
 [DisThreadedNetworkInterface ExampleSimulationProgram] [receipt 16] DisPduType 01 ENTITY_STATE   Entity #2, size 144 bytes)
 [DisThreadedNetworkInterface PduRecorder] [receipt 16] DisPduType 01 ENTITY_STATE   Entity #2, size 144 bytes)
-[DisThreadedNetworkInterface ExampleSimulationProgram] [sending 16] DisPduType 01 ENTITY_STATE   Entity #2, size 144 bytes)
 ... [PDUs of interest successfully sent for this loop]
 ... My simulation just did something, no really...
 ... [Pausing for 1.0 seconds]
@@ -136,6 +136,6 @@ run-single:
 *** Thread close status: sendingThread.isAlive()=false receiveThread.isAlive()=false
 
 PduRecorder.stop() closing recorder log file:
-   C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog.dislog
+   C:\x3d-nps-gitlab\NetworkedGraphicsMV3500\examples\pduLog\PduCaptureLog3.dislog
 [DisChannel ExampleSimulationProgram] complete.
-BUILD SUCCESSFUL (total time: 14 seconds)
+BUILD SUCCESSFUL (total time: 13 seconds)
diff --git a/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt b/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt
index 2386e59c16..ebb2d4ed33 100644
--- a/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt
+++ b/examples/src/OpenDis7Examples/ExampleTrackInterpolationLog.txt
@@ -23,8 +23,8 @@ run-single:
 [PduRecorder PduRecorder] listening to IP address 239.1.2.3 on port 3000
 [DisChannel ExampleTrackInterpolation] just checking: disChannel.getNetworkAddress()=239.1.2.3, getNetworkPort()=3000
 [DisChannel ExampleTrackInterpolation] just checking: hasVerboseSending()=true, hasVerboseReceipt()=true
-[DisThreadedNetworkInterface ExampleTrackInterpolation] [sending  1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleTrackInterpolation] [receipt  1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
+[DisThreadedNetworkInterface ExampleTrackInterpolation] [sending  1] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleTrackInterpolation] [sending  2] DisPduType 11 CREATE_ENTITY, size 28 bytes)
 [DisThreadedNetworkInterface ExampleTrackInterpolation] [sending  3] DisPduType 22 COMMENT, size 80 bytes)
 [DisThreadedNetworkInterface ExampleTrackInterpolation] [receipt  2] DisPduType 11 CREATE_ENTITY, size 28 bytes)
@@ -130,7 +130,7 @@ pduTrack_1 duration = 42.0 seconds = 0 ticks
     <meta content='ExampleTrackInterpolation.x3d' name='title'/>
     <meta content='Conversion of ESPDU track into X3D animation interpolators and LineSet.' name='description'/>
     <meta content='1 January 2022' name='created'/>
-    <meta content='18 December 2023' name='modified'/>
+    <meta content='19 December 2023' name='modified'/>
     <meta content='Don Brutzman' name='creator'/>
     <meta content='https://gitlab.nps.edu/Savage/NetworkedGraphicsMV3500/-/blob/master/examples/src/OpenDis7Examples/ExampleTrackInterpolation.x3d' name='identifier'/>
     <meta content='PduTrack utility, opendis7-java Library https://github.com/open-dis/opendis7-java' name='generator'/>
diff --git a/examples/src/OpenDis7Examples/PduTrack.java b/examples/src/OpenDis7Examples/PduTrack.java
index ac793abf33..5773fe5737 100644
--- a/examples/src/OpenDis7Examples/PduTrack.java
+++ b/examples/src/OpenDis7Examples/PduTrack.java
@@ -954,7 +954,7 @@ public class PduTrack
                 EntityStatePdu espdu = (EntityStatePdu) pdu;
                 System.out.println("espdu from pduTrack pduList");
                 reportPdu(espdu);
-                byte[] byteArray = espdu.marshal();
+                byte[] byteArray = espdu.marshal().array(); // can also use ByteBuffer
                 System.out.println("espdu.marshal() byteArray:                              " + bytesToHex(byteArray));
                 flushBuffers();
                 
@@ -972,7 +972,7 @@ public class PduTrack
                 
                 System.out.println("espdu.copyByteBuffer()");
                 reportPdu(espdu.copyByteBuffer());
-                byte[] byteArrayCopy = espdu.copyByteBuffer().marshal();
+                byte[] byteArrayCopy = espdu.copyByteBuffer().marshal().array(); // can also use ByteBuffer
                 System.out.println("espdu.copyByteBuffer().marshal() byteArray:             " + bytesToHex(byteArrayCopy));
                 flushBuffers();
                 
@@ -990,7 +990,7 @@ public class PduTrack
                 
                 System.out.println("espdu.copyDataOutputStream()");
                 reportPdu(espdu.copyDataOutputStream());
-                byte[] byteArrayCopyDOS = espdu.copyDataOutputStream().marshal();
+                byte[] byteArrayCopyDOS = espdu.copyDataOutputStream().marshal().array(); // can also use ByteBuffer
                 System.out.println("espdu.copyDataOutputStream().marshal() byteArray:       " + bytesToHex(byteArrayCopyDOS));
                 flushBuffers();
                 
-- 
GitLab