diff options
author | Alex Clayton <alex.clayton@isode.com> | 2016-02-15 17:24:49 (GMT) |
---|---|---|
committer | Alex Clayton <alex.clayton@isode.com> | 2016-02-29 10:39:49 (GMT) |
commit | 3bfe54c141dd3fa20e391312a0a84c75731e2b2a (patch) | |
tree | 4de10e954ff540fa6e1b70c8735ac5da14b19743 /src/com/isode/stroke/streamstack | |
parent | 2ebf488dfee7156fbbe0b3d3eccebe13d86a8634 (diff) | |
download | stroke-3bfe54c141dd3fa20e391312a0a84c75731e2b2a.zip stroke-3bfe54c141dd3fa20e391312a0a84c75731e2b2a.tar.bz2 |
Add Network Bosh Classes
Add the missing Bosh classes to the network packages (BoshConnection
and BoshConnectionPool), plus tests for the classes and any other
classes required by the new classes.
Test-information:
Units tests all pass ok.
Change-Id: I5c2e05bae9e678ac10d2601c7fdbdccd68d66b71
Diffstat (limited to 'src/com/isode/stroke/streamstack')
-rw-r--r-- | src/com/isode/stroke/streamstack/DummyStreamLayer.java | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/com/isode/stroke/streamstack/DummyStreamLayer.java b/src/com/isode/stroke/streamstack/DummyStreamLayer.java new file mode 100644 index 0000000..7f3dd15 --- /dev/null +++ b/src/com/isode/stroke/streamstack/DummyStreamLayer.java @@ -0,0 +1,51 @@ +/* Copyright (c) 2016, Isode Limited, London, England. + * All rights reserved. + * + * Acquisition and use of this software and related materials for any + * purpose requires a written license agreement from Isode Limited, + * or a written license from an organisation licensed by Isode Limited + * to grant such a license. + * + */ +package com.isode.stroke.streamstack; + +import com.isode.stroke.base.SafeByteArray; + +/** + * The {@link DummyStreamLayer} can be used to use a {@link LowLayer} on its own, + * without a functioning parent layer. The {@link DummyStreamLayer} will serve as the + * parent layer to the {@link LowLayer} and is called when the {@link LowLayer} wants + * to write data to its parent layer. + */ +public class DummyStreamLayer implements HighLayer { + + private LowLayer childLayer; + + public DummyStreamLayer(LowLayer lowLayer) { + childLayer = lowLayer; + childLayer.setParentLayer(this); + } + + @Override + public void handleDataRead(SafeByteArray data) { + // Empty Method + } + + @Override + public LowLayer getChildLayer() { + return childLayer; + } + + @Override + public void setChildLayer(LowLayer childLayer) { + this.childLayer = childLayer; + } + + @Override + public void writeDataToChildLayer(SafeByteArray data) { + if (childLayer != null) { + childLayer.writeData(data); + } + } + +} |