/**
  * Write an object into the byte stream.
  *
  * @param anObject one of Float, String, Integer, BigInteger, or array of these.
  */
 public void write(Object anObject) {
   // Can't do switch on class
   if (null == anObject) return;
   if (anObject instanceof Object[]) {
     Object[] theArray = (Object[]) anObject;
     for (int i = 0; i < theArray.length; ++i) {
       write(theArray[i]);
     }
     return;
   }
   if (anObject instanceof Float) {
     write((Float) anObject);
     return;
   }
   if (anObject instanceof String) {
     write((String) anObject);
     return;
   }
   if (anObject instanceof Integer) {
     write((Integer) anObject);
     return;
   }
   if (anObject instanceof BigInteger) {
     write((BigInteger) anObject);
     return;
   }
 }
Exemple #2
0
 /**
  * Convert the arguments into a byte array. Used internally.
  *
  * @param stream OscPacketByteArrayConverter
  */
 protected void computeArgumentsByteArray(OSCJavaToByteArrayConverter stream) {
   stream.write(',');
   if (null == arguments) return;
   stream.writeTypes(arguments);
   Enumeration enume = arguments.elements();
   while (enume.hasMoreElements()) {
     stream.write(enume.nextElement());
   }
 }
Exemple #3
0
 /**
  * Convert the address into a byte array. Used internally.
  *
  * @param stream OscPacketByteArrayConverter
  */
 protected void computeAddressByteArray(OSCJavaToByteArrayConverter stream) {
   stream.write(address);
 }