Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NetworkedGraphicsMV3500
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Savage
NetworkedGraphicsMV3500
Commits
86a71f82
Commit
86a71f82
authored
2 years ago
by
Brutzman, Don
Browse files
Options
Downloads
Patches
Plain Diff
descriptor and TRACE_PREFIX handling
parent
8122ff0b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/edu/nps/moves/dis7/utilities/stream/PduRecorder.java
+13
-8
13 additions, 8 deletions
src/edu/nps/moves/dis7/utilities/stream/PduRecorder.java
with
13 additions
and
8 deletions
src/edu/nps/moves/dis7/utilities/stream/PduRecorder.java
+
13
−
8
View file @
86a71f82
...
...
@@ -98,7 +98,7 @@ public class PduRecorder // implements PduReceiver
private
String
encodingPduLog
=
ENCODING_PLAINTEXT
;
// default, TODO change to ENCODING_BINARY
private
boolean
includeHeaders
=
encodingPduLog
.
equals
(
ENCODING_PLAINTEXT
);
private
String
TRACE_PREFIX
=
(
"[
p
duRecorder "
+
getDescriptor
()).
trim
()
+
"] "
;
private
String
TRACE_PREFIX
=
(
"[
P
duRecorder "
+
getDescriptor
()).
trim
()
+
"] "
;
private
String
descriptor
=
new
String
();
private
Writer
logFileWriter
;
...
...
@@ -320,7 +320,7 @@ public class PduRecorder // implements PduReceiver
// DIS timestamp is 8 bytes in length, converted from Java long time into byte array
byte
[]
timeByteArray
=
Longs
.
toByteArray
(
packetReceivedNanoTime
-
startNanoTime
);
//System.out.println("wrote time "+(packetReceivedNanoTime - startNanoTime)); // debug
//System.out.println(
TRACE_PREFIX +
"wrote time "+(packetReceivedNanoTime - startNanoTime)); // debug
byte
[]
byteBufferSized
=
Arrays
.
copyOf
(
newBuffer
,
newLength
);
DisPduType
pduType
;
...
...
@@ -401,7 +401,7 @@ public class PduRecorder // implements PduReceiver
}
pduCount
=
pduCount
+
1
;
// if (false) // debug
// System.out.println("PduRecorder: pduCount="+ pduCount);
// System.out.println(
TRACE_PREFIX +
"PduRecorder: pduCount="+ pduCount);
sb
.
setLength
(
0
);
}
...
...
@@ -496,11 +496,11 @@ public class PduRecorder // implements PduReceiver
if
(
newFile
.
createNewFile
())
{
System
.
out
.
println
(
"Recorder log file open: "
+
newFile
.
getCanonicalPath
());
System
.
out
.
println
(
TRACE_PREFIX
+
"Recorder log file open: "
+
newFile
.
getCanonicalPath
());
}
else
{
System
.
out
.
println
(
"Cannot create dis log file at "
+
newFile
.
getAbsolutePath
());
System
.
out
.
println
(
TRACE_PREFIX
+
"Cannot create dis log file at "
+
newFile
.
getAbsolutePath
());
throw
new
RuntimeException
(
"File creation error"
);
}
return
newFile
;
...
...
@@ -646,6 +646,8 @@ public class PduRecorder // implements PduReceiver
* @return simple descriptor name
*/
public
String
getDescriptor
()
{
if
(
descriptor
==
null
)
descriptor
=
""
;
return
descriptor
;
}
...
...
@@ -655,9 +657,12 @@ public class PduRecorder // implements PduReceiver
* @return same object to permit progressive setters */
public
PduRecorder
setDescriptor
(
String
newDescriptor
)
{
if
(
newDescriptor
!=
null
)
this
.
descriptor
=
newDescriptor
.
trim
();
TRACE_PREFIX
=
"["
+
DisThreadedNetworkInterface
.
class
.
getSimpleName
()
+
" "
+
descriptor
+
"] "
;
if
(
newDescriptor
!=
null
)
this
.
descriptor
=
newDescriptor
.
trim
();
else
descriptor
=
""
;
if
(
descriptor
.
isBlank
())
TRACE_PREFIX
=
"["
+
PduRecorder
.
class
.
getSimpleName
()
+
"] "
;
else
TRACE_PREFIX
=
"["
+
PduRecorder
.
class
.
getSimpleName
()
+
" "
+
descriptor
+
"] "
;
return
this
;
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment