/** * Converts a byte array into an {@link OSCPacket} * (either an {@link OSCMessage} or {@link OSCBundle}). * @param bytes the storage containing the raw OSC packet * @param bytesLength indicates how many bytes the package consists of (<code><= bytes.length</code>) * @return the successfully parsed OSC packet; in case of a problem, * a <code>RuntimeException</code> is thrown */ public OSCPacket convert(byte[] bytes, int bytesLength) { final Input rawInput = new Input(bytes, bytesLength); final OSCPacket packet; if (isBundle(rawInput)) { packet = convertBundle(rawInput); } else { packet = convertMessage(rawInput); } return packet; }