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


Java Deserializer.deserialize方法代码示例

本文整理汇总了Java中org.red5.io.object.Deserializer.deserialize方法的典型用法代码示例。如果您正苦于以下问题:Java Deserializer.deserialize方法的具体用法?Java Deserializer.deserialize怎么用?Java Deserializer.deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.red5.io.object.Deserializer的用法示例。


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

示例1: decodeResult

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/**
 * Decode response received from remoting server.
 * 
 * @param data
 *            Result data to decode
 * @return Object deserialized from byte buffer data
 */
private Object decodeResult(IoBuffer data) {
	log.debug("decodeResult - data limit: {}", (data != null ? data.limit() : 0));
	processHeaders(data);
	int count = data.getUnsignedShort();
	if (count != 1) {
		throw new RuntimeException("Expected exactly one result but got " + count);
	}

	Input input = new Input(data);
	String target = input.getString(); // expect "/onResult"
	log.debug("Target: {}", target);
	String nullString = input.getString(); // expect "null"
	log.debug("Null string: {}", nullString);

	// Read return value
	Deserializer deserializer = new Deserializer();
	return deserializer.deserialize(input, Object.class);
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:26,代码来源:RemotingClient.java

示例2: testVectorIntInput

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testVectorIntInput() {
	log.debug("Testing Vector<int>");
	//0D090000000002000007D07FFFFFFF80000000
	byte[] v = new byte[] { (byte) 0x0D, (byte) 0x09, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xD0,
			(byte) 0x7F, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x80, (byte) 0x00, (byte) 0x00, (byte) 0x00 };

	in = new Input(IoBuffer.wrap(v));
	List<Object> vectorOut = Deserializer.deserialize(in, null);
	//[2, 2000, 2147483647, -2147483648]
	assertNotNull(vectorOut);
	assertEquals(vectorOut.size(), 4);
	for (int i = 0; i < vectorOut.size(); i++) {
		System.err.println("Vector: " + vectorOut.get(i));
	}
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:18,代码来源:AMF3IOTest.java

示例3: testVectorUIntInput

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testVectorUIntInput() {
	log.debug("Testing Vector<uint>");
	//0E090000000002000007D0FFFFFFFF00000000
	byte[] v = new byte[] { (byte) 0x0E, (byte) 0x09, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x02, (byte) 0x00, (byte) 0x00, (byte) 0x07, (byte) 0xD0,
			(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };
	in = new Input(IoBuffer.wrap(v));
	List<Object> vectorOut = Deserializer.deserialize(in, null);
	//[2, 2000, 4294967295, 0]
	assertNotNull(vectorOut);
	assertEquals(vectorOut.size(), 4);
	for (int i = 0; i < vectorOut.size(); i++) {
		System.err.println("Vector: " + vectorOut.get(i));
	}
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:17,代码来源:AMF3IOTest.java

示例4: testVectorNumberInput

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testVectorNumberInput() {
	log.debug("Testing Vector<Number>");
	//0F0F003FF199999999999ABFF199999999999A7FEFFFFFFFFFFFFF0000000000000001FFF8000000000000FFF00000000000007FF0000000000000
	byte[] v = new byte[] { (byte) 0x0F, (byte) 0x0F, (byte) 0x00, (byte) 0x3F, (byte) 0xF1, (byte) 0x99, (byte) 0x99, (byte) 0x99, (byte) 0x99, (byte) 0x99, (byte) 0x9A,
			(byte) 0xBF, (byte) 0xF1, (byte) 0x99, (byte) 0x99, (byte) 0x99, (byte) 0x99, (byte) 0x99, (byte) 0x9A, (byte) 0x7F, (byte) 0xEF, (byte) 0xFF, (byte) 0xFF,
			(byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0xFF, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x01,
			(byte) 0xFF, (byte) 0xF8, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xFF, (byte) 0xF0, (byte) 0x00, (byte) 0x00,
			(byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x7F, (byte) 0xF0, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00 };

	in = new Input(IoBuffer.wrap(v));
	((org.red5.io.amf3.Input) in).enforceAMF3();
	List<Double> vectorOut = Deserializer.deserialize(in, null);
	//[1.1, -1.1, 1.7976931348623157E308, 4.9E-324, NaN, -Infinity, Infinity]
	assertNotNull(vectorOut);
	assertEquals(vectorOut.size(), 7);
	for (int i = 0; i < vectorOut.size(); i++) {
		System.err.println("Vector: " + vectorOut.get(i));
	}
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:22,代码来源:AMF3IOTest.java

示例5: testList

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testList() {
	log.debug("Testing list");
	List<Comparable<?>> listIn = new LinkedList<Comparable<?>>();
	listIn.add(null);
	listIn.add(Boolean.FALSE);
	listIn.add(Boolean.TRUE);
	listIn.add(Integer.valueOf(1));
	listIn.add("This is a test string");
	listIn.add(new Date());
	Serializer.serialize(out, listIn);
	dumpOutput();
	List<?> listOut = Deserializer.deserialize(in, List.class);
	assertNotNull(listOut);
	assertEquals(listIn.size(), listOut.size());
	for (int i = 0; i < listIn.size(); i++) {
		assertEquals(listOut.get(i), listIn.get(i));
	}
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:21,代码来源:AbstractIOTest.java

示例6: handleParameters

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/**
 * Sets incoming connection parameters and / or returns encoded parameters for use in a call.
 * 
 * @param in
 * @param notify
 * @param input
 * @return parameters array
 */
private Object[] handleParameters(IoBuffer in, Notify notify, Input input) {
    Object[] params = new Object[] {};
    List<Object> paramList = new ArrayList<>();
    final Object obj = Deserializer.deserialize(input, Object.class);
    if (obj instanceof Map) {
        // Before the actual parameters we sometimes (connect) get a map of parameters, this is usually null, but if set should be
        // passed to the connection object.
        @SuppressWarnings("unchecked")
        final Map<String, Object> connParams = (Map<String, Object>) obj;
        notify.setConnectionParams(connParams);
    } else if (obj != null) {
        paramList.add(obj);
    }
    while (in.hasRemaining()) {
        paramList.add(Deserializer.deserialize(input, Object.class));
    }
    params = paramList.toArray();
    if (log.isDebugEnabled()) {
        log.debug("Num params: {}", paramList.size());
        for (int i = 0; i < params.length; i++) {
            log.debug(" > {}: {}", i, params[i]);
        }
    }
    return params;
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:34,代码来源:RTMPProtocolDecoder.java

示例7: decodeResult

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/**
 * Decode response received from remoting server.
 * 
 * @param data
 *            Result data to decode
 * @return Object deserialized from byte buffer data
 */
private Object decodeResult(IoBuffer data) {
    log.debug("decodeResult - data limit: {}", (data != null ? data.limit() : 0));
    processHeaders(data);
    int count = data.getUnsignedShort();
    if (count != 1) {
        throw new RuntimeException("Expected exactly one result but got " + count);
    }
    Input input = new Input(data);
    String target = input.getString(); // expect "/onResult"
    log.debug("Target: {}", target);
    String nullString = input.getString(); // expect "null"
    log.debug("Null string: {}", nullString);
    // Read return value
    return Deserializer.deserialize(input, Object.class);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:23,代码来源:RemotingClient.java

示例8: testByteArray

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testByteArray() {
    log.debug("\n Testing ByteArray");
    // just some ones and such
    ByteArray baIn = new ByteArray();
    baIn.writeBytes(new byte[] { (byte) 0, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x1, (byte) 0x42, (byte) 0x99 });
    Serializer.serialize(out, baIn);
    dumpOutput();
    ByteArray baOut = Deserializer.deserialize(in, ByteArray.class);
    assertNotNull(baOut);
    assertEquals(baIn.length(), baOut.length());
    for (int i = 0; i < baOut.length(); i++) {
        System.err.println("Byte: " + baOut.readByte());
    }
    resetOutput();
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:17,代码来源:AMF3IOTest.java

示例9: unmarshal

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 *
 * @see marshalsec.BlazeDSBase#unmarshal(byte[])
 */
@Override
public Object unmarshal ( byte[] data ) throws Exception {
    IoBuffer buf = IoBuffer.wrap(data);
    Input i = createInput(buf);
    return Deserializer.deserialize(i, Object.class);
}
 
开发者ID:mbechler,项目名称:marshalsec,代码行数:12,代码来源:Red5AMFBase.java

示例10: readMetaData

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/** {@inheritDoc} */
// TODO need to fix
public MetaData<?, ?> readMetaData(IoBuffer buffer) {
	MetaData<?, ?> retMeta = new MetaData<String, Object>();
	Input input = new Input(buffer);
	String metaType = Deserializer.deserialize(input, String.class);
	log.debug("Metadata type: {}", metaType);
	Map<String, ?> m = Deserializer.deserialize(input, Map.class);
	retMeta.putAll(m);
	return retMeta;
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:12,代码来源:MetaService.java

示例11: readKeyValues

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/**
 * Read key - value pairs into Map object
 * @param result            Map to put resulting pair to
 */
protected void readKeyValues(Map<String, Object> result) {
	while (hasMoreProperties()) {
		String name = readPropertyName();
		log.debug("property: {}", name);
		Object property = Deserializer.deserialize(this, Object.class);
		log.debug("val: {}", property);
		result.put(name, property);
		if (hasMoreProperties()) {
			skipPropertySeparator();
		}
	}
	skipEndObject();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:18,代码来源:Input.java

示例12: readBean

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
/**
 * Reads the input as a bean and returns an object
 *
 * @param bean               Input as bean
 * @return                   Decoded object
 */
@SuppressWarnings({ "unchecked", "rawtypes" })
protected Object readBean(Object bean) {
	log.debug("read bean");
	storeReference(bean);
	Class theClass = bean.getClass();
	while (hasMoreProperties()) {
		String name = readPropertyName();
		Type type = getPropertyType(bean, name);
		log.debug("property: {}", name);
		Object property = Deserializer.deserialize(this, type);
		log.debug("val: {}", property);
		//log.debug("val: "+property.getClass().getName());
		if (property != null) {
			try {
				if (type instanceof Class) {
					Class t = (Class) type;
					if (!t.isAssignableFrom(property.getClass())) {
						property = ConversionUtils.convert(property, t);
					}
				}
				final Field field = theClass.getField(name);
				field.set(bean, property);
			} catch (Exception ex2) {
				try {
					BeanUtils.setProperty(bean, name, property);
				} catch (Exception ex) {
					log.error("Error mapping property: {} ({})", name, property);
				}
			}
		} else {
			log.debug("Skipping null property: {}", name);
		}
		if (hasMoreProperties()) {
			skipPropertySeparator();
		}
	}
	skipEndObject();
	return bean;
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:46,代码来源:Input.java

示例13: testString

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testString() {
	log.debug("Testing string");
	String inStr = "hello world";
	Serializer.serialize(out, inStr);
	dumpOutput();
	String outStr = Deserializer.deserialize(in, String.class);
	assertEquals(inStr, outStr);
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:11,代码来源:AbstractIOTest.java

示例14: testNull

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testNull() {
	log.debug("Testing null");
	Serializer.serialize(out, null);
	dumpOutput();
	Object val = Deserializer.deserialize(in, Object.class);
	assertEquals(val, null);
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:10,代码来源:AbstractIOTest.java

示例15: testMap

import org.red5.io.object.Deserializer; //导入方法依赖的package包/类
@Test
public void testMap() {
	Map<String, Object> mapIn = new HashMap<String, Object>();
	mapIn.put("testNumber", Integer.valueOf(34));
	mapIn.put("testString", "wicked");
	mapIn.put("testBean", new SimpleJavaBean());
	Serializer.serialize(out, mapIn);

	dumpOutput();
	Map<?, ?> mapOut = Deserializer.deserialize(in, Map.class);
	assertNotNull(mapOut);
	assertEquals(mapIn.size(), mapOut.size());

	Set<?> entrySet = mapOut.entrySet();
	Iterator<?> it = entrySet.iterator();
	while (it.hasNext()) {
		Map.Entry<?, ?> entry = (Map.Entry<?, ?>) it.next();
		String propOut = (String) entry.getKey();
		Object valueOut = entry.getValue();

		assertTrue(mapIn.containsKey(propOut));
		Object valueIn = mapIn.get(propOut);
		assertEquals(valueOut, valueIn);
	}
	resetOutput();

}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:28,代码来源:AbstractIOTest.java


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