From 32bcdfe686fb1a171df50a35192ab606e2c25db6 Mon Sep 17 00:00:00 2001 From: Erik Jansson <erikjansson90@gmail.com> Date: Fri, 23 Jan 2015 14:31:29 +0100 Subject: [PATCH] Open up EncoderChannel and DecoderChannel for extension. We need our subclasses of EncoderChannel and DecoderChannel to access the def_registry field when using Firefly in order to short-circuit the registration of Firefly's protocol types. We also need access to the writer field from one of our subclasses of EncoderChannel since we collect the data from one encoded sample and flush the writer when it's done, placing the encoded data into a Firefly data sample which is sent on the wire. --- lib/java/se/lth/control/labcomm/DecoderChannel.java | 2 +- lib/java/se/lth/control/labcomm/EncoderChannel.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/java/se/lth/control/labcomm/DecoderChannel.java b/lib/java/se/lth/control/labcomm/DecoderChannel.java index dc25d23..926dbb9 100644 --- a/lib/java/se/lth/control/labcomm/DecoderChannel.java +++ b/lib/java/se/lth/control/labcomm/DecoderChannel.java @@ -9,7 +9,7 @@ import java.io.EOFException; public class DecoderChannel implements Decoder { private DataInputStream in; - private DecoderRegistry def_registry = new DecoderRegistry(); + protected DecoderRegistry def_registry = new DecoderRegistry(); private DecoderRegistry ref_registry = new DecoderRegistry(); public DecoderChannel(InputStream in) throws IOException { diff --git a/lib/java/se/lth/control/labcomm/EncoderChannel.java b/lib/java/se/lth/control/labcomm/EncoderChannel.java index 08f9c87..fa63b86 100644 --- a/lib/java/se/lth/control/labcomm/EncoderChannel.java +++ b/lib/java/se/lth/control/labcomm/EncoderChannel.java @@ -7,10 +7,10 @@ import java.io.OutputStream; public class EncoderChannel implements Encoder { - private Writer writer; + protected Writer writer; private ByteArrayOutputStream bytes = new ByteArrayOutputStream(); private DataOutputStream data = new DataOutputStream(bytes); - private EncoderRegistry def_registry = new EncoderRegistry(); + protected EncoderRegistry def_registry = new EncoderRegistry(); private EncoderRegistry ref_registry = new EncoderRegistry(); private int current_tag; -- GitLab