Overview

Tubesock

Overview

Tubesock is a library for passing a reference to an InputStream over the network. Using the tubesock-client allows you to resolve this reference to an InputStream for use on a remote instance.

Components

There are three modules to Tubesock:

  1. tubesock-core
  2. tubesock-api
  3. tubesock-client

tubesock-core

This is the core of the Tubesock library, it is responsible for creating the remote stream reference that can be passed over the wire.

tubesock-api

This is a collection of interfaces and common classes.

tubesock-client

The client is used to dereference a remote stream reference to an InputStream on a client.

Usage

Usage of this library consists of two parts:

  1. Creating the remote stream reference on the source; and
  2. Dereferencing the stream reference and consuming the stream on the client.

Creating a RemoteStreamReference

// Create a new manager that will listen on port 10001
RemoteStreamManager manager = new CoreRemoteStreamManager(10001);

// Initialise the manager, this will start it listening
manager.init();

// Use the `createRemoteStream` method, with an `InputStream` to create the reference
// The reference is `Serializable` so you can pass it over the network
RemoteStreamReference reference = manager.createRemoteStream(inputStream);

// Send the reference to a client on the network
// Stop the manager when you are finished
manager.shutdown();

Dereferencing the stream reference and consuming the InputStream

// Use the reference that has been acquired to get a client
RemoteStreamClient client = RemoteStreamClientFactory.getRemoteStreamClient(reference);

// Get the `InputStream` from this client
InputStream is = client.getInputStream();

// Consume the `InputStream`

License

Tubesock is free to use and is licensed under the GNU LGPLv2.1

Tubesock is used for passing InputStream references over a network.
Copyright (C) 2012 Ryan Thomas

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA