From 10bbd93daa77a966055cda4735a987948964ceba Mon Sep 17 00:00:00 2001 From: Anders Blomdell <anders.blomdell@control.lth.se> Date: Tue, 14 Oct 2014 20:09:07 +0200 Subject: [PATCH] Removed optional version preamble. Since we don't flatten signatures in 20141009, this is not needed any more. --- .../se/lth/control/labcomm/EncoderChannel.cs | 14 ++++------- .../lth/control/labcomm/EncoderChannel.java | 23 +++++-------------- .../control/labcomm2006/DecoderChannel.java | 2 +- .../control/labcomm2006/EncoderChannel.java | 17 ++------------ 4 files changed, 14 insertions(+), 42 deletions(-) diff --git a/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs b/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs index 92c9070..8284ff9 100644 --- a/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs +++ b/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs @@ -13,17 +13,13 @@ namespace se.lth.control.labcomm { byte[] buf = new byte[8]; private int current_tag; - public EncoderChannel(Stream writer, bool emitVersion) { + public EncoderChannel(Stream writer) { this.writer = writer; - if (emitVersion) { - encodeString(Constant.VERSION); - bytes.WriteTo(writer); - bytes.SetLength(0); - writer.Flush(); - } - } - public EncoderChannel(Stream writer) : this(writer, true) { + encodeString(Constant.VERSION); + bytes.WriteTo(writer); + bytes.SetLength(0); + writer.Flush(); } public void register(SampleDispatcher dispatcher) { diff --git a/lib/java/se/lth/control/labcomm/EncoderChannel.java b/lib/java/se/lth/control/labcomm/EncoderChannel.java index 1bde995..16755b8 100644 --- a/lib/java/se/lth/control/labcomm/EncoderChannel.java +++ b/lib/java/se/lth/control/labcomm/EncoderChannel.java @@ -13,31 +13,20 @@ public class EncoderChannel implements Encoder { private EncoderRegistry registry; private int current_tag; - public EncoderChannel(Writer writer, - boolean emitVersion) throws IOException { + public EncoderChannel(Writer writer) throws IOException { this.writer = writer; bytes = new ByteArrayOutputStream(); data = new DataOutputStream(bytes); registry = new EncoderRegistry(); - if (emitVersion) { - encodeString(Constant.VERSION); - data.flush(); - writer.write(bytes.toByteArray()); - bytes.reset(); - } - } - public EncoderChannel(Writer writer) throws IOException { - this(writer, true); - } - - public EncoderChannel(OutputStream writer, - boolean emitVersion) throws IOException { - this(new WriterWrapper(writer), emitVersion); + encodeString(Constant.VERSION); + data.flush(); + writer.write(bytes.toByteArray()); + bytes.reset(); } public EncoderChannel(OutputStream writer) throws IOException { - this(new WriterWrapper(writer), true); + this(new WriterWrapper(writer)); } public void register(SampleDispatcher dispatcher) throws IOException { diff --git a/lib/java/se/lth/control/labcomm2006/DecoderChannel.java b/lib/java/se/lth/control/labcomm2006/DecoderChannel.java index 77a96f1..95f237e 100644 --- a/lib/java/se/lth/control/labcomm2006/DecoderChannel.java +++ b/lib/java/se/lth/control/labcomm2006/DecoderChannel.java @@ -24,7 +24,7 @@ public class DecoderChannel implements Decoder { int index = decodePacked32(); String name = decodeString(); ByteArrayOutputStream signature = new ByteArrayOutputStream(); - collectFlatSignature(new EncoderChannel(signature, false)); + collectFlatSignature(new EncoderChannel(signature)); registry.add(index, name, signature.toByteArray()); } break; default: { diff --git a/lib/java/se/lth/control/labcomm2006/EncoderChannel.java b/lib/java/se/lth/control/labcomm2006/EncoderChannel.java index b6c8ab7..18fbc33 100644 --- a/lib/java/se/lth/control/labcomm2006/EncoderChannel.java +++ b/lib/java/se/lth/control/labcomm2006/EncoderChannel.java @@ -12,28 +12,15 @@ public class EncoderChannel implements Encoder { private DataOutputStream data; private EncoderRegistry registry; - public EncoderChannel(Writer writer, - boolean emitVersion) throws IOException { + public EncoderChannel(Writer writer) throws IOException { this.writer = writer; bytes = new ByteArrayOutputStream(); data = new DataOutputStream(bytes); registry = new EncoderRegistry(); - if (emitVersion) { - throw new IllegalArgumentException("Labcomm 2006 does not support emitVersion"); - } - } - - public EncoderChannel(Writer writer) throws IOException { - this(writer, false); - } - - public EncoderChannel(OutputStream writer, - boolean emitVersion) throws IOException { - this(new WriterWrapper(writer), emitVersion); } public EncoderChannel(OutputStream writer) throws IOException { - this(new WriterWrapper(writer), false); + this(new WriterWrapper(writer)); } public void register(SampleDispatcher dispatcher) throws IOException { -- GitLab