Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
LabComm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Anders Blomdell
LabComm
Commits
b638d1b1
Commit
b638d1b1
authored
10 years ago
by
Sven Gestegård Robertz
Browse files
Options
Downloads
Patches
Plain Diff
refactored out decodeBytes and decodeIntentions
parent
4822f9c3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/java/se/lth/control/labcomm2014/DecoderChannel.java
+27
-27
27 additions, 27 deletions
lib/java/se/lth/control/labcomm2014/DecoderChannel.java
with
27 additions
and
27 deletions
lib/java/se/lth/control/labcomm2014/DecoderChannel.java
+
27
−
27
View file @
b638d1b1
...
...
@@ -16,17 +16,33 @@ public class DecoderChannel implements Decoder {
this
.
in
=
new
DataInputStream
(
in
);
}
private
void
processSampleDef
()
throws
IOException
{
int
index
=
decodePacked32
();
private
byte
[]
decodeBytes
()
throws
IOException
{
int
len
=
decodePacked32
();
byte
result
[]
=
new
byte
[
len
];
for
(
int
i
=
0
;
i
<
len
;
i
++)
{
result
[
i
]
=
decodeByte
();
}
return
result
;
}
private
String
decodeIntentions
()
throws
IOException
{
int
numIntentions
=
decodePacked32
();
if
(
numIntentions
!=
1
)
{
System
.
out
.
println
(
"WARNING: #intentions == "
+
numIntentions
);
String
name
=
""
;
for
(
int
i
=
0
;
i
<
numIntentions
;
i
++)
{
byte
key
[]
=
decodeBytes
();
byte
val
[]
=
decodeBytes
();
if
(
key
.
length
==
0
)
{
name
=
new
String
(
val
);
}
}
int
keylen
=
decodePacked32
();
if
(
keylen
!=
0
)
{
System
.
out
.
println
(
"WARNING: keylen == "
+
keylen
);
return
name
;
}
String
name
=
decodeString
();
private
void
processSampleDef
()
throws
IOException
{
int
index
=
decodePacked32
();
String
name
=
decodeIntentions
();
int
signature_length
=
decodePacked32
();
byte
[]
signature
=
new
byte
[
signature_length
];
ReadBytes
(
signature
,
signature_length
);
...
...
@@ -35,15 +51,7 @@ public class DecoderChannel implements Decoder {
private
void
processSampleRef
()
throws
IOException
{
int
index
=
decodePacked32
();
int
numIntentions
=
decodePacked32
();
if
(
numIntentions
!=
1
)
{
System
.
out
.
println
(
"WARNING: #intentions == "
+
numIntentions
);
}
int
keylen
=
decodePacked32
();
if
(
keylen
!=
0
)
{
System
.
out
.
println
(
"WARNING: keylen == "
+
keylen
);
}
String
name
=
decodeString
();
String
name
=
decodeIntentions
();
int
signature_length
=
decodePacked32
();
byte
[]
signature
=
new
byte
[
signature_length
];
ReadBytes
(
signature
,
signature_length
);
...
...
@@ -55,15 +63,7 @@ public class DecoderChannel implements Decoder {
processSample
(
Constant
.
TYPE_DEF
);
}
catch
(
Exception
ex
)
{
int
idx
=
decodePacked32
();
int
numIntentions
=
decodePacked32
();
if
(
numIntentions
!=
1
)
{
System
.
out
.
println
(
"WARNING: #intentions == "
+
numIntentions
);
}
int
keylen
=
decodePacked32
();
if
(
keylen
!=
0
)
{
System
.
out
.
println
(
"WARNING: keylen == "
+
keylen
);
}
String
name
=
decodeString
();
String
name
=
decodeIntentions
();
int
siglen
=
decodePacked32
();
for
(
int
i
=
0
;
i
<
siglen
;
i
++)
{
byte
b
=
decodeByte
();
...
...
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