front_processing/extern/TUIO_JAVA/src/com/illposed/osc/OSCPacket.java
changeset 0 6fefd4afe506
child 9 0f44b7360c8d
equal deleted inserted replaced
-1:000000000000 0:6fefd4afe506
       
     1 /**
       
     2  * @author cramakrishnan
       
     3  *
       
     4  * Copyright (C) 2003, C. Ramakrishnan / Illposed Software
       
     5  * All rights reserved.
       
     6  * 
       
     7  * See license.txt (or license.rtf) for license information.
       
     8  * 
       
     9  * 
       
    10  * OscPacket is the abstract superclass for the various
       
    11  * kinds of OSC Messages. Its direct subclasses are:
       
    12  *  OscMessage, OscBundle
       
    13  *
       
    14  * Subclasses need to know how to produce a byte array
       
    15  * in the format specified by the OSC spec (or SuperCollider
       
    16  * documentation, as the case may be).
       
    17  *
       
    18  * This implementation is based on Markus Gaelli and
       
    19  * Iannis Zannos' OSC implementation in Squeak:
       
    20  * http://www.emergent.de/Goodies/
       
    21  */
       
    22 
       
    23 package com.illposed.osc;
       
    24 
       
    25 import com.illposed.osc.utility.*;
       
    26 
       
    27 public abstract class OSCPacket {
       
    28 
       
    29 	protected byte[] byteArray;
       
    30 
       
    31 	public OSCPacket() {
       
    32 		super();
       
    33 	}
       
    34 
       
    35 	protected void computeByteArray() {
       
    36 		OSCJavaToByteArrayConverter stream = new OSCJavaToByteArrayConverter();
       
    37 		computeByteArray(stream);
       
    38 	}
       
    39 
       
    40 	/**
       
    41 	 * @param stream OscPacketByteArrayConverter
       
    42 	 *
       
    43 	 * Subclasses should implement this method to product a byte array
       
    44 	 * formatted according to the OSC/SuperCollider specification.
       
    45 	 */
       
    46 	protected abstract void computeByteArray(OSCJavaToByteArrayConverter stream);
       
    47 
       
    48 	/**
       
    49 	 * @return byte[]
       
    50 	 */
       
    51 	public byte[] getByteArray() {
       
    52 		computeByteArray();
       
    53 		return byteArray;
       
    54 	}
       
    55 
       
    56 	protected void init() {
       
    57 		
       
    58 	}
       
    59 
       
    60 }