/** * Convert the arguments into a byte array. * Used internally only. * @param stream where to write the arguments to */ private void computeArgumentsByteArray(final OSCJavaToByteArrayConverter stream) { stream.write(','); stream.writeTypes(arguments); for (final Object argument : arguments) { stream.write(argument); } }
/** * Convert the address into a byte array. * Used internally only. * @param stream where to write the address to */ private void computeAddressByteArray(final OSCJavaToByteArrayConverter stream) { stream.write(address); }
/** * Convert the time-tag (a Java Date) into the OSC byte stream. * Used Internally. * @param stream where to write the time-tag to */ private void computeTimeTagByteArray(final OSCJavaToByteArrayConverter stream) { if ((null == timestamp) || (timestamp.equals(TIMESTAMP_IMMEDIATE))) { stream.write((int) 0); stream.write((int) 1); return; } final long millisecs = timestamp.getTime(); final long secsSince1970 = (long) (millisecs / 1000); final long secs = secsSince1970 + SECONDS_FROM_1900_TO_1970; // this line was cribbed from jakarta commons-net's NTP TimeStamp code final long fraction = ((millisecs % 1000) * 0x100000000L) / 1000; stream.write((int) secs); stream.write((int) fraction); }
@SuppressWarnings("unchecked") final Collection<Object> theArray = (Collection<Object>) anObject; for (final Object entry : theArray) { write(entry); write((Float) anObject); } else if (anObject instanceof Double) { write((Double) anObject); } else if (anObject instanceof String) { write((String) anObject); } else if (anObject instanceof byte[]) { write((byte[]) anObject); } else if (anObject instanceof Character) { write((Character) anObject); } else if (anObject instanceof Integer) { write((Integer) anObject); } else if (anObject instanceof Long) { write((Long) anObject); } else if (anObject instanceof Date) { write((Date) anObject); } else if (!isNoDataObject(anObject)) { throw new UnsupportedOperationException("Do not know how to write an object of class: "