Class PduRecorder
java.lang.Object
edu.nps.moves.dis7.utilities.stream.PduRecorder
- All Implemented Interfaces:
PduReceiver
Utility to save PDUs received over the network to disk
- Author:
- Mike Bailey, jmbailey@nps.edu
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic String
Character sentinel indicating remainder of line is a comment -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor that uses default values for output directory, multicast address and port.PduRecorder(String directoryPath)
Constructor to let the use specify an output directory.PduRecorder(String outputDirectory, String multicastAddress, int port)
Constructor to let the user specify all required parameters -
Method Summary
Modifier and TypeMethodDescriptionend()
End operation of this instanceRetrieve the path to the log filestatic String
TODO change this to enumeration type for strictnessboolean
static void
Entry point invocation.void
receivePdu(byte[] newBuffer, int newLength)
Receives a PDU and writes its raw contents to an output file for later playback and inspection.static void
setPduLogEncoding(String newPduLogEncoding)
void
Start or resume this instancevoid
Stop or pause this instance
-
Field Details
-
COMMENT_MARKER
Character sentinel indicating remainder of line is a comment- See Also:
- Constant Field Values
-
-
Constructor Details
-
PduRecorder
Default constructor that uses default values for output directory, multicast address and port.- Throws:
IOException
- if something goes wrong during instantiation
-
PduRecorder
Constructor to let the use specify an output directory. Uses default values for multicast address and port.- Parameters:
directoryPath
- the directory to write log files to- Throws:
IOException
- if something goes wrong during instantiation
-
PduRecorder
Constructor to let the user specify all required parameters- Parameters:
outputDirectory
- local path for directory where the log files are writtenmulticastAddress
- multicast group address to receive data from (TODO allow unicast UDP)port
- UDP port to listen for data
-
-
Method Details
-
getPduLogEncoding
TODO change this to enumeration type for strictness- Returns:
- the pduLogEncoding
-
setPduLogEncoding
- Parameters:
newPduLogEncoding
- the pduLogEncoding to set
-
startResume
public void startResume()Start or resume this instance -
stopPause
public void stopPause()Stop or pause this instance -
end
End operation of this instance- Returns:
- recorder logFile
-
receivePdu
public void receivePdu(byte[] newBuffer, int newLength)Description copied from interface:PduReceiver
Receives a PDU and writes its raw contents to an output file for later playback and inspection.- Specified by:
receivePdu
in interfacePduReceiver
- Parameters:
newBuffer
- the array containing raw PDU datanewLength
- the length of the buffer
-
getLogFilePath
Retrieve the path to the log file- Returns:
- the path to the log file
-
getDisThreadedNetIF
- Returns:
- an instance of this DisThreadedNetworkInterface
-
isRunning
public boolean isRunning()- Returns:
- the pduRecorderRunning
-
main
Entry point invocation. Saves a PDU output log to ./pduLog. Invoking the edu.nps.moves.dis7.examples.PduReaderPlayer will playback all logs written to the log directory- Parameters:
args
- none supported, TODO offer path/filename
-