com.illposed.osc
Class OSCBundle

java.lang.Object
  extended bycom.illposed.osc.OSCPacket
      extended bycom.illposed.osc.OSCBundle

public class OSCBundle
extends OSCPacket

A bundle represents a collection of osc packets (either messages or other bundles) and has a timetag which can be used by a scheduler to execute a bundle in the future instead of immediately (OSCMessages are executed immediately). Bundles should be used if you want to send multiple messages to be executed atomically together, or you want to schedule one or more messages to be executed in the future.

Internally, I use Vector to maintain jdk1.1 compatability

Copyright (C) 2003-2006, C. Ramakrishnan / Illposed Software. All rights reserved.

See license.txt (or license.rtf) for license information.

Version:
1.0
Author:
Chandrasekhar Ramakrishnan

Field Summary
protected  java.util.Vector packets
           
static java.math.BigInteger SECONDS_FROM_1900_to_1970
          2208988800 seconds -- includes 17 leap years
protected  java.util.Date timestamp
           
static java.util.Date TIMESTAMP_IMMEDIATE
          The Java representation of an OSC timestamp with the semantics of "immediately"
 
Fields inherited from class com.illposed.osc.OSCPacket
byteArray, isByteArrayComputed
 
Constructor Summary
OSCBundle()
          Create a new empty OSCBundle with a timestamp of immediately.
OSCBundle(java.util.Date timestamp)
          Create an OSCBundle with the specified timestamp.
OSCBundle(OSCPacket[] packets)
          Create an OSCBundle made up of the given packets with a timestamp of now.
OSCBundle(OSCPacket[] packets, java.util.Date timestamp)
          Create an OSCBundle, specifying the packets and timestamp.
 
Method Summary
 void addPacket(OSCPacket packet)
          Add a packet to the list of packets in this bundle.
protected  void computeByteArray(OSCJavaToByteArrayConverter stream)
          Compute the OSC byte stream representation of the bundle.
protected  void computeTimeTagByteArray(OSCJavaToByteArrayConverter stream)
          Convert the timetag (a Java Date) into the OSC byte stream.
 OSCPacket[] getPackets()
          Get the packets contained in this bundle.
 java.util.Date getTimestamp()
          Return the time the bundle will execute.
 void setTimestamp(java.util.Date timestamp)
          Set the time the bundle will execute.
 
Methods inherited from class com.illposed.osc.OSCPacket
computeByteArray, getByteArray, init
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SECONDS_FROM_1900_to_1970

public static final java.math.BigInteger SECONDS_FROM_1900_to_1970
2208988800 seconds -- includes 17 leap years


TIMESTAMP_IMMEDIATE

public static final java.util.Date TIMESTAMP_IMMEDIATE
The Java representation of an OSC timestamp with the semantics of "immediately"


timestamp

protected java.util.Date timestamp

packets

protected java.util.Vector packets
Constructor Detail

OSCBundle

public OSCBundle()
Create a new empty OSCBundle with a timestamp of immediately. You can add packets to the bundle with addPacket()


OSCBundle

public OSCBundle(java.util.Date timestamp)
Create an OSCBundle with the specified timestamp.

Parameters:
timestamp - the time to execute the bundle

OSCBundle

public OSCBundle(OSCPacket[] packets)
Create an OSCBundle made up of the given packets with a timestamp of now.

Parameters:
packets - array of OSCPackets to initialize this object with

OSCBundle

public OSCBundle(OSCPacket[] packets,
                 java.util.Date timestamp)
Create an OSCBundle, specifying the packets and timestamp.

Parameters:
packets - the packets that make up the bundle
timestamp - the time to execute the bundle
Method Detail

getTimestamp

public java.util.Date getTimestamp()
Return the time the bundle will execute.

Returns:
a Date

setTimestamp

public void setTimestamp(java.util.Date timestamp)
Set the time the bundle will execute.

Parameters:
timestamp - Date

addPacket

public void addPacket(OSCPacket packet)
Add a packet to the list of packets in this bundle.

Parameters:
packet - OSCMessage or OSCBundle

getPackets

public OSCPacket[] getPackets()
Get the packets contained in this bundle.

Returns:
an array of packets

computeTimeTagByteArray

protected void computeTimeTagByteArray(OSCJavaToByteArrayConverter stream)
Convert the timetag (a Java Date) into the OSC byte stream. Used Internally.


computeByteArray

protected void computeByteArray(OSCJavaToByteArrayConverter stream)
Compute the OSC byte stream representation of the bundle. Used Internally.

Specified by:
computeByteArray in class OSCPacket
Parameters:
stream - OscPacketByteArrayConverter