diff --git a/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs b/lib/csharp/se/lth/control/labcomm/EncoderChannel.cs index 92c9070c65b5af2897226902eb1af0d3f4664218..8284ff97ce6b41309df030aebf7628b614958308 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 1bde995a249a3da8e867888d5ff34ccdc95ec8d6..16755b85e08f8a56f58e0135b966bae03fd12ac7 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 77a96f1e90bde2fcf8bf418aefdc3af7d67cd32a..95f237ee2bbceed75949ac33f8ad1907649c2018 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 b6c8ab715627215bdfd22afb8e08735811faf573..18fbc33e234aac24f8ed9d01c7ab6bec1961f943 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 {