de.sciss.net
Interface OSCChannel

All Known Subinterfaces:
OSCBidi
All Known Implementing Classes:
OSCClient, OSCReceiver, OSCServer, OSCTransmitter

public interface OSCChannel

A collection of common constants and methods that apply to all kinds of OSC communicators. Formely being abstract superclass AbstractOSCCommunicator of OSCTransmitter and OSCReceiver, the functionality has been reduced and converted to an interface as of v0.30.

The method for getting a socket's DatagramChannel has been removed in the course of TCP integration, also with keeping in mind the possible future integration of other channel types such as FileChannel or PipeChannel.

Since:
NetUtil 0.30
Version:
0.37, 12-May-09
Author:
Hanns Holger Rutz

Field Summary
static int DEFAULTBUFSIZE
          The default buffer size (in bytes) and maximum OSC packet size (8K at the moment).
static int kDumpBoth
          Dump mode: dump messages both in text and hex view
static int kDumpHex
          Dump mode: dump messages in hex (binary) view
static int kDumpOff
          Dump mode: do not dump messages
static int kDumpText
          Dump mode: dump messages in text formatting
static String TCP
          Protocol type : transmission control protocol.
static String UDP
          Protocol type : user datagram protocol.
 
Method Summary
 void dispose()
          Disposes the resources associated with the OSC communicator.
 void dumpOSC(int mode, PrintStream stream)
          Changes the way processed OSC messages are printed to the standard err console.
 int getBufferSize()
          Queries the buffer size used for coding or decoding OSC messages.
 OSCPacketCodec getCodec()
          Queries the codec used in packet coding and decoding.
 InetSocketAddress getLocalAddress()
          Queries the communicator's local socket address.
 String getProtocol()
          Queries the transport protocol used by this communicator.
 void setBufferSize(int size)
          Adjusts the buffer size for OSC messages.
 void setCodec(OSCPacketCodec c)
          Specifies which codec is used in packet coding and decoding.
 

Field Detail

UDP

static final String UDP
Protocol type : user datagram protocol. en.wikipedia.org/wiki/User_Datagram_Protocol for explanation

See Also:
Constant Field Values

TCP

static final String TCP
Protocol type : transmission control protocol. en.wikipedia.org/wiki/Transmission_Control_Protocol for explanation

See Also:
Constant Field Values

kDumpOff

static final int kDumpOff
Dump mode: do not dump messages

See Also:
Constant Field Values

kDumpText

static final int kDumpText
Dump mode: dump messages in text formatting

See Also:
Constant Field Values

kDumpHex

static final int kDumpHex
Dump mode: dump messages in hex (binary) view

See Also:
Constant Field Values

kDumpBoth

static final int kDumpBoth
Dump mode: dump messages both in text and hex view

See Also:
Constant Field Values

DEFAULTBUFSIZE

static final int DEFAULTBUFSIZE
The default buffer size (in bytes) and maximum OSC packet size (8K at the moment).

See Also:
Constant Field Values
Method Detail

getProtocol

String getProtocol()
Queries the transport protocol used by this communicator.

Returns:
the protocol, such as UDP or TCP
See Also:
UDP, TCP

getLocalAddress

InetSocketAddress getLocalAddress()
                                  throws IOException
Queries the communicator's local socket address. You can determine the host and port from the returned address by calling getHostName() (or for the IP getAddress().getHostAddress()) and getPort().

Returns:
the address of the communicator's local socket.
Throws:
IOException - if the local host could not be resolved
See Also:
InetSocketAddress.getHostName(), InetSocketAddress.getAddress(), InetSocketAddress.getPort(), getProtocol()

setBufferSize

void setBufferSize(int size)
Adjusts the buffer size for OSC messages. This is the maximum size an OSC packet (bundle or message) can grow to.

Parameters:
size - the new size in bytes.
See Also:
getBufferSize()

getBufferSize

int getBufferSize()
Queries the buffer size used for coding or decoding OSC messages. This is the maximum size an OSC packet (bundle or message) can grow to.

Returns:
the buffer size in bytes.
See Also:
setBufferSize( int )

dumpOSC

void dumpOSC(int mode,
             PrintStream stream)
Changes the way processed OSC messages are printed to the standard err console. By default messages are not printed.

Parameters:
mode - one of kDumpOff (don't dump, default), kDumpText (dump human readable string), kDumpHex (hexdump), or kDumpBoth (both text and hex)
stream - the stream to print on, or null which is shorthand for System.err
See Also:
kDumpOff, kDumpText, kDumpHex, kDumpBoth

dispose

void dispose()
Disposes the resources associated with the OSC communicator. The object should not be used any more after calling this method.


setCodec

void setCodec(OSCPacketCodec c)
Specifies which codec is used in packet coding and decoding.

Parameters:
c - the codec to use
Since:
NetUtil 0.33

getCodec

OSCPacketCodec getCodec()
Queries the codec used in packet coding and decoding.

Returns:
the current codec of this channel
Since:
NetUtil 0.33
See Also:
OSCPacketCodec.getDefaultCodec()