• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Deserializer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Deserializer类属于org.red5.io.object包,在下文中一共展示了Deserializer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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: readArray

import org.red5.io.object.Deserializer; //导入依赖的package包/类
public Object readArray(Type target) {
	log.debug("readArray - target: {}", target);
	Object result = null;
	int count = buf.getInt();
	log.debug("Count: {}", count);
	List<Object> resultCollection = new ArrayList<Object>(count);
	storeReference(result);
	for (int i = 0; i < count; i++) {
		resultCollection.add(Deserializer.deserialize(this, Object.class));
	}
	// To maintain conformance to the Input API, we should convert the output
	// into an Array if the Type asks us to.
	Class<?> collection = Collection.class;
	if (target instanceof Class<?>) {
		collection = (Class<?>) target;
	}
	if (collection.isArray()) {
		result = ArrayUtils.toArray(collection.getComponentType(), resultCollection);
	} else {
		result = resultCollection;
	}
	return result;
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:24,代码来源:Input.java


示例3: testByteArray

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testByteArray() {
	log.debug("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:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:18,代码来源:AMF3IOTest.java


示例4: testVectorRoundTrip

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testVectorRoundTrip() {
	log.debug("Testing Vector on a round trip");
	Vector<String> vIn = new Vector<String>();
	vIn.add("This is my vector and her name is Sally");
	Serializer.serialize(out, vIn);
	dumpOutput();
	// test fails without enforcing amf3 here
	((org.red5.io.amf3.Input) in).enforceAMF3();
	Vector<String> vOut = Deserializer.deserialize(in, Vector.class);
	assertNotNull(vOut);
	assertEquals(vIn.size(), vOut.size());
	for (int i = 0; i < vOut.size(); i++) {
		System.err.println("Element: " + vOut.elementAt(i));
	}
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:18,代码来源:AMF3IOTest.java


示例5: 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


示例6: 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


示例7: 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


示例8: testVectorMixedInput

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testVectorMixedInput() {
	log.debug("Testing Vector<Object>");
	//100700010607666f6f010a13256f72672e726564352e74673742e466f6f33000403
	//[foo, null, org.red5.test.Foo3[foo=0]] // Foo3 is a class instance
	byte[] v2 = new byte[] { (byte) 0x10, (byte) 0x07, (byte) 0x00, (byte) 0x01, (byte) 0x06, (byte) 0x07, (byte) 0x66, (byte) 0x6f, (byte) 0x6f, (byte) 0x01, (byte) 0x0a,
			(byte) 0x13, (byte) 0x25, (byte) 0x6f, (byte) 0x72, (byte) 0x67, (byte) 0x2e, (byte) 0x72, (byte) 0x65, (byte) 0x64, (byte) 0x35, (byte) 0x2e, (byte) 0x74,
			(byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x46, (byte) 0x6f, (byte) 0x6f, (byte) 0x33, (byte) 0x00, (byte) 0x04, (byte) 0x03 };

	in = new Input(IoBuffer.wrap(v2));
	((org.red5.io.amf3.Input) in).enforceAMF3();
	List<Object> vectorOut = Deserializer.deserialize(in, null);
	assertNotNull(vectorOut);
	assertEquals(vectorOut.size(), 3);
	for (int i = 0; i < vectorOut.size(); i++) {
		System.err.println("Vector: " + vectorOut.get(i));
	}
	resetOutput();
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:20,代码来源:AMF3IOTest.java


示例9: 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


示例10: 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


示例11: 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


示例12: readArray

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Override
public Object readArray(Type target) {
    log.debug("readArray - target: {}", target);
    Object result = null;
    int count = buf.getInt();
    log.debug("Count: {}", count);
    // To conform to the Input API, we should convert the output into an Array if the Type asks us to.
    Class<?> collection = Collection.class;
    if (target instanceof Class<?>) {
        collection = (Class<?>) target;
    }
    List<Object> resultCollection = new ArrayList<>(count);
    if (collection.isArray()) {
        result = ArrayUtils.getArray(collection.getComponentType(), count);
    } else {
        result = resultCollection;
    }
    storeReference(result); //reference should be stored before reading of objects to get correct refIds
    for (int i = 0; i < count; i++) {
        resultCollection.add(Deserializer.deserialize(this, Object.class));
    }
    if (collection.isArray()) {
        ArrayUtils.fillArray(collection.getComponentType(), result, resultCollection);
    }
    return result;
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:27,代码来源:Input.java


示例13: readMap

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Override
public Object readMap() {
    // the maximum number used in this mixed array
    int maxNumber = buf.getInt();
    log.debug("Read start mixed array: {}", maxNumber);
    ObjectMap<Object, Object> result = new ObjectMap<Object, Object>();
    // we must store the reference before we deserialize any items in it to ensure that reference IDs are correct
    int reference = storeReference(result);
    while (hasMoreProperties()) {
        String key = getString();
        Object item = Deserializer.deserialize(this, Object.class);
        log.debug("item: {}", item);
        if (!NumberUtils.isParsable(key)) {
            result.put(key, item);
        } else {
            result.put(Integer.valueOf(key), item);
        }
    }
    result.remove("length");
    // replace the original reference with the final result
    storeReference(reference, result);
    return result;
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:24,代码来源:Input.java


示例14: 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


示例15: testVectorIntInput

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testVectorIntInput() {
    log.debug("\n 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:Red5,项目名称:red5-io,代码行数:17,代码来源:AMF3IOTest.java


示例16: testVectorNumberInput

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testVectorNumberInput() {
    log.debug("\n 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));
    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:Red5,项目名称:red5-io,代码行数:18,代码来源:AMF3IOTest.java


示例17: testVectorMixedInput

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testVectorMixedInput() {
    log.debug("\n Testing Vector<Object>");
    //100700010607666f6f010a13256f72672e726564352e74673742e466f6f33000403
    //[foo, null, org.red5.test.Foo3[foo=0]] // Foo3 is a class instance
    byte[] v2 = new byte[] { (byte) 0x10, (byte) 0x07, (byte) 0x00, (byte) 0x01, (byte) 0x06, (byte) 0x07, (byte) 0x66, (byte) 0x6f, (byte) 0x6f, (byte) 0x01, (byte) 0x0a, (byte) 0x13, (byte) 0x25, (byte) 0x6f, (byte) 0x72, (byte) 0x67, (byte) 0x2e, (byte) 0x72, (byte) 0x65, (byte) 0x64, (byte) 0x35, (byte) 0x2e, (byte) 0x74, (byte) 0x65, (byte) 0x73, (byte) 0x74, (byte) 0x2e, (byte) 0x46, (byte) 0x6f,
            (byte) 0x6f, (byte) 0x33, (byte) 0x00, (byte) 0x04, (byte) 0x03 };

    in = new Input(IoBuffer.wrap(v2));
    List<Object> vectorOut = Deserializer.deserialize(in, null);
    assertNotNull(vectorOut);
    assertEquals(vectorOut.size(), 3);
    for (int i = 0; i < vectorOut.size(); i++) {
        System.err.println("Vector: " + vectorOut.get(i));
    }
    resetOutput();
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:18,代码来源:AMF3IOTest.java


示例18: testMap

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testMap() {
    log.debug("\ntestMap");
    Map<String, Object> mapIn = new HashMap<>();
    mapIn.put("testNumber", 34d); //numbers are stored as double
    mapIn.put("testString", "wicked awesome");
    mapIn.put("testBean", new SimpleJavaBean());
    Serializer.serialize(out, mapIn);
    dumpOutput();
    Map<?, ?> mapOut = Deserializer.deserialize(in, Map.class);
    assertNotNull(mapOut);
    assertEquals(mapIn.size(), mapOut.size());
    for (Map.Entry<String, Object> entry : mapIn.entrySet()) {
        String key = entry.getKey();
        Object iVal = entry.getValue();
        Object oVal = mapOut.get(key);
        assertNotNull(oVal);
        assertEquals(iVal, oVal);
    }
    resetOutput();
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:22,代码来源:AbstractIOTest.java


示例19: testLongString

import org.red5.io.object.Deserializer; //导入依赖的package包/类
@Test
public void testLongString() {
    log.debug("\ntestLongString");
    byte[] rndStr = new byte[AMF.LONG_STRING_LENGTH];
    Arrays.fill(rndStr, (byte) 0x65);
    //Random rnd = new Random();
    //rnd.nextBytes(rndStr);
    String inStr = new String(rndStr, StandardCharsets.UTF_8);
    //String inStr = RandomStringUtils.random(AMF.LONG_STRING_LENGTH);
    //log.trace(inStr);
    Serializer.serialize(out, inStr);
    dumpOutput();
    String outStr = Deserializer.deserialize(in, String.class);
    assertEquals(inStr, outStr);
    resetOutput();
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:17,代码来源:AbstractIOTest.java


示例20: readArray

import org.red5.io.object.Deserializer; //导入依赖的package包/类
public Object readArray(Deserializer deserializer, Type target) {
	log.debug("readArray - deserializer: {} target: {}", deserializer, target);
	Object result = null;
	int count = buf.getInt();
	log.debug("Count: {}", count);
	List<Object> resultCollection = new ArrayList<Object>(count);
	storeReference(result);
	for (int i = 0; i < count; i++) {
		resultCollection.add(deserializer.deserialize(this, Object.class));
	}
	// To maintain conformance to the Input API, we should convert the output
	// into an Array if the Type asks us to.
	Class<?> collection = Collection.class;
	if (target instanceof Class<?>) {
		collection = (Class<?>) target;
	}
	if (collection.isArray()) {
		result = ArrayUtils.toArray(collection.getComponentType(), resultCollection);
	} else {
		result = resultCollection;
	}
	return result;
}
 
开发者ID:cwpenhale,项目名称:red5-mobileconsole,代码行数:24,代码来源:Input.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Min类代码示例发布时间:2022-05-23
下一篇:
Java NamespacePrefixResolver类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap