当前位置: 首页>>代码示例>>Java>>正文


Java OSCByteArrayToJavaConverter类代码示例

本文整理汇总了Java中com.illposed.osc.utility.OSCByteArrayToJavaConverter的典型用法代码示例。如果您正苦于以下问题:Java OSCByteArrayToJavaConverter类的具体用法?Java OSCByteArrayToJavaConverter怎么用?Java OSCByteArrayToJavaConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


OSCByteArrayToJavaConverter类属于com.illposed.osc.utility包,在下文中一共展示了OSCByteArrayToJavaConverter类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testSendBundle

import com.illposed.osc.utility.OSCByteArrayToJavaConverter; //导入依赖的package包/类
public void testSendBundle() {
	Date timestamp = GregorianCalendar.getInstance().getTime();
	OSCBundle bundle =
		new OSCBundle(
			new OSCPacket[] { new OSCMessage("/dummy") },
			timestamp);
	byte[] byteArray = bundle.getByteArray();
	OSCByteArrayToJavaConverter converter = new OSCByteArrayToJavaConverter();
	OSCBundle packet = (OSCBundle) converter.convert(byteArray, byteArray.length);
	if (!packet.getTimestamp().equals(timestamp)) {
		fail("Send Bundle did not receive the correct timestamp " + packet.getTimestamp()
			+ "(" + packet.getTimestamp().getTime() +
			") (should be " + timestamp +"( " + timestamp.getTime() + ")) ");
	}
	OSCPacket[] packets = packet.getPackets();
	OSCMessage msg = (OSCMessage) packets[0];
	if (!msg.getAddress().equals("/dummy")) {
		fail("Send Bundle's message did not receive the correct address");
	}
}
 
开发者ID:juanurgiles,项目名称:breakserverosc,代码行数:21,代码来源:OSCBundleTest.java

示例2: testSendBundleImmediate

import com.illposed.osc.utility.OSCByteArrayToJavaConverter; //导入依赖的package包/类
public void testSendBundleImmediate() {
	OSCBundle bundle =
		new OSCBundle(new OSCPacket[] { new OSCMessage("/dummy") });
	byte[] byteArray = bundle.getByteArray();
	OSCByteArrayToJavaConverter converter = new OSCByteArrayToJavaConverter();
	OSCBundle packet = (OSCBundle) converter.convert(byteArray, byteArray.length);
	if (!packet.getTimestamp().equals(OSCBundle.TIMESTAMP_IMMEDIATE)) {
		fail("Timestamp should have been immediate, not " + packet.getTimestamp()
			+ "(" + packet.getTimestamp().getTime() + ")");
	}
	OSCPacket[] packets = packet.getPackets();
	OSCMessage msg = (OSCMessage) packets[0];
	if (!msg.getAddress().equals("/dummy")) {
		fail("Send Bundle's message did not receive the correct address");
	}
}
 
开发者ID:juanurgiles,项目名称:breakserverosc,代码行数:17,代码来源:OSCBundleTest.java

示例3: testEncodeBigInteger

import com.illposed.osc.utility.OSCByteArrayToJavaConverter; //导入依赖的package包/类
public void testEncodeBigInteger() {
	OSCMessage message = new OSCMessage("/dummy");
	BigInteger one001 = new BigInteger("1001");
	message.addArgument(one001);
	byte[] byteArray = message.getByteArray();
	OSCByteArrayToJavaConverter converter = new OSCByteArrayToJavaConverter();
	OSCMessage packet = (OSCMessage) converter.convert(byteArray, byteArray.length);
	if (!packet.getAddress().equals("/dummy")) {
		fail("Send Big Integer did not receive the correct address");
	}
	Object[] arguments = packet.getArguments();
	if (arguments.length != 1) {
		fail("Send Big Integer should have 1 argument, not " + arguments.length);
	}
	if (!(arguments[0] instanceof BigInteger)) {
		fail("arguments[0] should be a BigInteger, not " + arguments[0]);
	}
	if (!(new BigInteger("1001").equals(arguments[0]))) {
		fail("Instead of BigInteger(1001), received " + arguments[0]);
	}
}
 
开发者ID:juanurgiles,项目名称:breakserverosc,代码行数:22,代码来源:OSCMessageTest.java

示例4: testEncodeArray

import com.illposed.osc.utility.OSCByteArrayToJavaConverter; //导入依赖的package包/类
public void testEncodeArray() {
	OSCMessage message = new OSCMessage("/dummy");
	Float[] floats = {new Float(10.0), new Float(100.0)};
	message.addArgument(floats);
	byte[] byteArray = message.getByteArray();
	OSCByteArrayToJavaConverter converter = new OSCByteArrayToJavaConverter();
	OSCMessage packet = (OSCMessage) converter.convert(byteArray, byteArray.length);
	if (!packet.getAddress().equals("/dummy")) {
		fail("Send Array did not receive the correct address");
	}
	Object[] arguments = packet.getArguments();
	if (arguments.length != 1) {
		fail("Send Array should have 1 argument, not " + arguments.length);
	}
	if (!(arguments[0] instanceof Object[])) {
		fail("arguments[0] should be a Object array, not " + arguments[0]);
	}
	for (int i = 0; i < 2; ++i) {
		Object[] theArray = (Object[]) arguments[0];
		if (!floats[i].equals(theArray[i])) {
			fail("Array element " + i + " should be " + floats[i] + " not " + theArray[i]);
		}
	}
}
 
开发者ID:juanurgiles,项目名称:breakserverosc,代码行数:25,代码来源:OSCMessageTest.java

示例5: OSCPortIn

import com.illposed.osc.utility.OSCByteArrayToJavaConverter; //导入依赖的package包/类
/**
 * Create an OSCPort that listens using a specified socket.
 * @param socket DatagramSocket to listen on.
 */
public OSCPortIn(DatagramSocket socket) {
	super(socket, socket.getLocalPort());

	this.converter = new OSCByteArrayToJavaConverter();
	this.dispatcher = new OSCPacketDispatcher();
}
 
开发者ID:JanKoehnlein,项目名称:XRobot,代码行数:11,代码来源:OSCPortIn.java

示例6: setUp

import com.illposed.osc.utility.OSCByteArrayToJavaConverter; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
	converter = new OSCByteArrayToJavaConverter();
}
 
开发者ID:juanurgiles,项目名称:breakserverosc,代码行数:5,代码来源:OSCByteArrayToJavaConverterTest.java


注:本文中的com.illposed.osc.utility.OSCByteArrayToJavaConverter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。