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


Java IOUtils类代码示例

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


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

示例1: testDecodeBuffer

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testDecodeBuffer() {
    log.debug("\ntestDecodeBuffer");
    RTMPProtocolDecoder dec = new RTMPProtocolDecoder();
    List<Object> objs;
    RTMPConnection conn = new RTMPMinaConnection();
    conn.getState().setState(RTMP.STATE_CONNECTED);
    conn.setHandler(this);
    IoBuffer p00 = IoBuffer
            .wrap(IOUtils
                    .hexStringToByteArray("8639ae8685ad4e802fb905a7918b480416b013e0632e41773e6ba30a1ee089ddb94df6eff6b59aa6251a2707215a2907dc6b51a749ff6680b37792b6c302d43e80f4780361ab7b3c79de5f917aece673e6192e0d45606a5a56dc23ee8113b3381a5d428074f461db71f8caaefa650517809b63edc8412c1f88b4e4d43584ca491a89dfdbb78df1b00c1cedc8e2139fe831becd70527adf4d17760c1cbfff47a1116aaa8f603d3f5319a0688bbc215c1cae1cfb06b6546abd4b76cc7f32cbc84b4531ba2f539d6ae5c4c081bcc51a73b7c14881f8b6bddb480d8a4430b98577f15d31215480d6ebb9cb56931ad3703c2bf024c943b3c45c18717d467387141cdcc88f389548bc335b10ead0daf8e8c69e67f43099ab1f5f2afcb343c08d4b065ec7ce3a437d9891ec8388155d5bdae8dcfd6b4419df2d9c7ca584511e240cc6b1f04ccc098a74d5037c921e4f5916affa17ff71daed20d621687b12bd3f7fcb8f538360b39eb237ca05ada13dc433dc10c2504c55e5ca2e6528b3279eb49e4629218acfc33fce315c58533076d7e3fff6e49650d4283c8fa4ee766f93fc3d10b10bd10b8c2393e2a1da4e6c53dcc5ddbd6efd7b844b7546b0472346b9229cdb6e8d45f70f1e6d23b96cbb2c41fcd486e25fef021e19568c4617248e58ca195fb7aad5ca34dcf27ac7f03dc71a8b4831d1bbb273f6bba56ed9cdf49eef6c45df5071d19d9e8e23fb33b34a65648141cd61db72f79fa7944e3232cd8e30ba310d566fdac6d51b683a3c27af315ca5dc0f614d62c6672e97c036d181e00d6cf08b41a130d7a24783ad616593dc10753959529657f94aec63fa073ae24afe44b2d7075164ebc25305db954607b92c1c7ded5f88e587227ce411010292b6e392aeaeca456d64dadec73cac5de51ec2d3b530db0cdb9869fbdabe1f0aae10bcc1479dc927178a323ac0b2c1def11a086605ee0a66d5a9f1652b5b5860cdbd3594c8e2511c004d8704ccb2732197f37e687753ce0ed00717f20ca6e7076fd4d06b49ba8c665a2adc41e702753225868ace398baebb6944c29c149b838fb71b1e8c20ed3c9561129867c56bc800be10f8dba659f37bbe2242b0cbdcf342396e5ee61f327e7759500d4647e313937c81809b602af08493812ca199698ed35de9ebeded83e1ef5d8f8ad56c368acd7a6d7a05118541bf9d60bc3e45d64431a7700770c814f48f5dcd1c35270a5288b8cbde9333b5b8c40dfd6f0d31d51bea52e0bc6e6e4f46b1bfe85268a494a83d20668829dcfa492325e5f372f45a74bc19c9be07eda5bb1060376b0563081f541801b7d7ce5f7408e5bb11f63d0638419f7cb8aaaa55afa32dfb1e4f0df11fc355ad6c30405b8824f8fff87feeb3b5390cde76040008bb422200a571cd0c19fda9df620ad6ca881c833728081e7cefecc78b280cc06b4c7de3d1c9cebc04d84e1c43fb9fc8b52cc07e0eb15012872c0739322b1da9d7888b6c0f968863ac571837fd63457f98d574665e3cbe1f3b497fb03d1ab8e481985732de26051919d0aba7f18281d8f512b05a625746e4dd50e0c4be16ab4b59aa3cf24e1648ee9d74e4f3b2a92fc7828a5eb2040a706d52e354fb079df3062d404c46fb78de4931caac381020c5bf6b38fecdc5f7d66c3ea3fb087f4ed8ac98a81a24a42053282c7524c2953a5885c1ff5d736d46c472d318312f2a427dc3526fd513c88dbb8583d607031c0a2825f9e74428b859d8874e0cb013b458b27d549a41e4330682dac90e073b79c458dcb2cba317f816bd2dabdcee96d77ab6466021a23a932d134ba33279956aae938787a3a59216b53d50dc0554fe34b5f51d1e050f84e03a7442b29604684291a2ee79198a3911f8a54a1e47c0bf9ec25114f60dae43d4aa4639e5a5c89010ba3884014c2721cab878795f22ba8136f7d4685c9a5c348bda08b60a1ff1afe6d5578d52f5051eeafa9e3b9501701a272a880aaeb30fbc2db66a5e48d7c811a56c9a809c92567d8a10472c142f3dc38c0123e20ed3feb067a550e0a997b38061e191a3bb5b47a04ef70fdd94e69bfc9be160d8a8cc7dc163e8d595cc987c1d676a7b543f56305be60921c19113be5ea988c864b636e216c1c6d71319e0c96b58eb619ac63016ffb97761b79a3eea0016cfacadc7c10300000100014d1400000000020007636f6e6e656374003ff0000000000000030003617070020003766f640008666c61736856657202000e4c4e582032302c302c302c323836000673776655726c020036687474703a2f2f6c6f63616c686f73743a353038302f766f642f6d696e69706c617965722e7377662f5b5b44594e414d49435d5d2f320005746355c3726c02001972746d703a2f2f6c6f63616c686f73743a313933352f766f640004667061640100000c6361706162696c697469657300406de00000000000000b617564696f436f646563730040abee0000000000000b766964656f436f6465637300406f800000000000000d766964656f46756e6374696f6e003ff00000000000c30000077061676555726c020024687474703a2f2f6c6f63616c686f73743a353038302f766f642f696e6465782e68746d6c000e6f626a656374456e636f64696e67004008000000000000000009"));
    p00.position(1536);
    objs = dec.decodeBuffer(conn, p00);
    log.debug("Objects #00: {}", objs);
    assertNotNull("Objects should not be null", objs);
    assertFalse("Objects should not be empty", objs.isEmpty());
    assertEquals("Method should be 'connect'", "connect", ((Invoke) ((Packet) objs.get(0)).getMessage()).getCall().getServiceMethodName());

    IoBuffer p01 = IoBuffer
            .wrap(IOUtils
                    .hexStringToByteArray("030000000001431400000000020007636f6e6e656374003ff0000000000000030003617070020003766f640008666c61736856657202000e4c4e582032302c302c302c323836000673776655726c020036687474703a2f2f6c6f63616c686f73743a353038302f766f642f6d696e69706c617965722e7377662f5b5b44594e414d49435d5d2f320005746355c3726c02001972746d703a2f2f6c6f63616c686f73743a313933352f766f640004667061640100000c6361706162696c697469657300406de00000000000000b617564696f436f646563730040abee0000000000000b766964656f436f6465637300406f800000000000000d766964656f46756e6374696f6e003ff00000000000c30000077061676555726c02001a687474703a2f2f6c6f63616c686f73743a353038302f766f642f000e6f626a656374456e636f64696e6700400800000000000000000902fffe410000040500000000009896800300003100001a11000000000002000c63726561746553747265616d00400000000000000005"));
    objs = dec.decodeBuffer(conn, p01);
    log.debug("Objects #01: {}", objs);
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:25,代码来源:TestRTMPProtocolDecoder.java

示例2: testServerDigest

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testServerDigest() throws InterruptedException {
    log.info("\n testServerDigest");
    IoBuffer r5c1 = IoBuffer.allocate(1536);
    r5c1.put(IOUtils.hexStringToByteArray(red5clientC1));
    r5c1.flip();
    InboundHandshake in = new InboundHandshake();
    in.decodeClientRequest1(r5c1);
    int algorithm = 0;
    byte[] handshakeBytes = in.getHandshakeBytes();
    // get the handshake digest
    int digestPos = in.getDigestOffset(algorithm, handshakeBytes, 0);
    log.debug("Digest position offset: {}", digestPos);
    in.calculateDigest(digestPos, handshakeBytes, 0, RTMPHandshake.GENUINE_FMS_KEY, 36, handshakeBytes, digestPos);
    log.debug("Calculated digest: {}", Hex.encodeHexString(Arrays.copyOfRange(handshakeBytes, digestPos, digestPos + 32)));
    Assert.assertTrue(in.verifyDigest(digestPos, handshakeBytes, RTMPHandshake.GENUINE_FMS_KEY, 36));
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:18,代码来源:ServerRTMPHandshakeTest.java

示例3: testValidateFromBrowsers

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testValidateFromBrowsers() {
    log.info("\n testValidateFromBrowsers");
    // no handshake type bytes are included here, the C0
    // server side handshake handler
    InboundHandshake in = new InboundHandshake();
    // CHROME
    IoBuffer cc = IoBuffer.allocate(1536);
    cc.put(IOUtils.hexStringToByteArray(chromeFlashPlayerC1));
    cc.flip();
    log.debug("Validate chrome: {}", cc);
    boolean chrome = in.validate(cc.array());
    cc.clear();
    // FIREFOX
    cc.put(IOUtils.hexStringToByteArray(firefoxFlashPlayerC1));
    cc.flip();
    log.debug("Validate firefox: {}", cc);
    boolean firefox = in.validate(cc.array());
    cc.clear();
    Assert.assertTrue(chrome && firefox);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:22,代码来源:ServerRTMPHandshakeTest.java

示例4: testDecodeBufferExTS

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testDecodeBufferExTS() {
    //log.debug("\testDecodeBufferExTS");
    RTMPProtocolDecoder dec = new RTMPProtocolDecoder();
    RTMPConnection conn = new RTMPMinaConnection();
    Red5.setConnectionLocal(conn);
    RTMP rtmp = conn.getState();
    rtmp.setState(RTMP.STATE_CONNECTED);
    // lastHeader: Header [streamId=1, channelId=4, dataType=18, timerBase=0, timerDelta=0, size=309, extended=false]
    // get the local decode state
    RTMPDecodeState state = conn.getDecoderState();
    // meta and audio 4x chunks
    IoBuffer in = IoBuffer.wrap(IOUtils.hexStringToByteArray("04000000000135120100000002000d40736574446174614672616d6502000a6f6e4d65746144617461080000000d00086475726174696f6e0040d518000000000000057769647468004064000000000000000668656967687400405e000000000000000d766964656f64617461726174650040686a000000000000096672616d657261746500403900000000c40000000c766964656f636f6465636964004000000000000000000d617564696f6461746172617465000000000000000000000f617564696f73616d706c65726174650040d5888000000000000f617564696f73616d706c6573697a65004030000000000000000673746572656f0100000c617564696f636f6465636964004000c40000000000000007656e636f64657202000d4c61766635362e31352e313032000866696c6573697a650000000000000000000000090400000000006908010000002afff340c400104002e62d4110009080200830107ea04cfa810710e0987f820ec130fc401897c1c0c70ff502008020eea04c1f0fe7fcb9fc10ff90d107c1f82008021feb07c1c04010041c20f89c1fff6b6edad93d99d8da6cd42a08e459095589d4b5fb9a4e679a1f4400001a00006a082afff342c41a19c91f225d89300055a47640c62cee7ccc85c08c42cadb6b56daebe65989f78c3ef3cfbd694ac0c34aa855ee0598a031f0a0686212d43631a4c59a926383c2d5201c5e9b7377"));
    Packet packet = null;
    do {
        packet = dec.decodePacket(conn, state, in);
    } while (packet == null);
    assertNotNull(packet);
    assertTrue(packet.getMessage() instanceof Notify);
    do {
        packet = dec.decodePacket(conn, state, in);
    } while (packet == null);
    assertNotNull(packet);
    assertTrue(packet.getMessage() instanceof AudioData);
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:26,代码来源:RTMPClientProtocolDecoderTest.java

示例5: testValidateFromYouTube

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testValidateFromYouTube() {
    log.info("\ntestValidateFromYouTube");
    // client side handshake handler
    OutboundHandshake out = new OutboundHandshake();
    // server response
    IoBuffer y = IoBuffer.allocate(0);
    y.setAutoExpand(true);
    y.put(IOUtils.hexStringToByteArray(youtubeS1));
    y.flip();
    log.debug("Validate youtube: {}", y);
    @SuppressWarnings("unused")
    boolean youtube = out.validate(y.array());
    //boolean decoded = out.decodeServerResponse1(y);
    
    //Assert.assertTrue(youtube && decoded);
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:18,代码来源:RTMPHandshakeTest.java

示例6: testDecodeBufferChunks

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testDecodeBufferChunks() {
    log.debug("\n testDecodeBufferChunks");
    RTMPProtocolDecoder dec = new RTMPProtocolDecoder();
    List<Object> objs;
    RTMPConnection conn = new RTMPMinaConnection();
    conn.getState().setState(RTMP.STATE_CONNECTED);
    conn.setHandler(this);
    IoBuffer p00 = IoBuffer.wrap(IOUtils.hexStringToByteArray("030000000001531400000000020007636f6e6e656374003ff0000000000000030003617070020000000e6f626a656374456e636f64696e6700000000000000000000046670616401000008666c61736856657202001057494e2031312c322c3230322c3233350005746355726c02001b72746d703a2f2f36372e3136372e3136382e3138323a313933352f00c30b617564696f436f646563730040abee000000000000077061676555726c05000b636c7573746572506173730200086368616e67656d65000f70726976617465496e7374616e6365010000087075626c6963497002000d35342e3230392e32342e323138000a7075626c6963506f727400409e3c0000000000000d766964656fc346756e6374696f6e003ff0000000000000000470617468020000000c6361706162696c697469657300402e000000000000000673776655726c05000b766964656f436f64656373000000000000000000000009"));
    objs = dec.decodeBuffer(conn, p00);
    log.debug("Objects #00: {}", objs);
    assertNotNull("Objects should not be null", objs);
    assertFalse("Objects should not be empty", objs.isEmpty());
    assertEquals("Method should be 'connect'", "connect", ((Invoke) ((Packet) objs.get(0)).getMessage()).getCall().getServiceMethodName());
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:16,代码来源:TestRTMPProtocolDecoder.java

示例7: fillBufferFromStringData

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@SuppressWarnings("unused")
private void fillBufferFromStringData(IoBuffer buf, String byteDumpFile) throws Exception {
    File f = new File(String.format("%s/target/test-classes/%s", System.getProperty("user.dir"), byteDumpFile));
    BufferedReader in = new BufferedReader(new FileReader(f));
    try {
        String line = null;
        while ((line = in.readLine()) != null) {
            buf.put(IOUtils.hexStringToByteArray(line));
        }
        buf.flip();
        log.debug("Filled buffer: {}", buf);
    } finally {
        in.close();
    }
}
 
开发者ID:Red5,项目名称:red5-server-common,代码行数:16,代码来源:TestRTMPProtocolDecoder.java

示例8: readTagHeader

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
/**
 * Read only header part of a tag.
 *
 * @return Tag header
 * @throws UnsupportedDataTypeException
 */
private ITag readTagHeader() throws UnsupportedDataTypeException {
    // previous tag size (4 bytes) + flv tag header size (11 bytes)
    fillBuffer(15);
    // previous tag's size
    int previousTagSize = in.getInt();
    // start of the flv tag
    byte dataType = in.get();
    if (log.isTraceEnabled()) {
        log.trace("Bits: {}", Integer.toBinaryString(dataType));
    }
    dataType = (byte) (dataType & 31);
    byte filter = (byte) ((dataType & 63) >> 5);
    byte reserved = (byte) ((dataType & 127) >> 6);
    log.debug("Reserved: {}, Filter: {}, Datatype: {}", reserved, filter, dataType);
    switch (dataType) {
        case 8: // audio
            log.debug("Found audio");
            break;
        case 9: // video
            log.debug("Found video");
            break;
        case 15: // special fms undocumented type?
        case 18: // meta / script data
            log.debug("Found meta/script data");
            break;
        default:
            log.debug("Invalid data type detected ({}), reading ahead\n current position: {} limit: {}", dataType, in.position(), in.limit());
            throw new UnsupportedDataTypeException("Invalid data type detected (" + dataType + ")");
    }
    int bodySize = IOUtils.readUnsignedMediumInt(in);
    int timestamp = IOUtils.readExtendedMediumInt(in);
    int streamId = IOUtils.readUnsignedMediumInt(in);
    if (log.isDebugEnabled()) {
        log.debug("Data type: {} timestamp: {} stream id: {} body size: {} previous tag size: {}", new Object[] { dataType, timestamp, streamId, bodySize, previousTagSize });
    }
    return new Tag(dataType, timestamp, bodySize, null, previousTagSize);
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:44,代码来源:FLVReader.java

示例9: testAMF0Connect

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testAMF0Connect() {
    log.debug("\ntestAMF0Connect");
    IoBuffer data = IoBuffer
            .wrap(IOUtils
                    .hexStringToByteArray("020007636f6e6e656374003ff00000000000000300036170700200086f666c6144656d6f0008666c61736856657202000e4c4e582032302c302c302c323836000673776655726c020029687474703a2f2f6c6f63616c686f73743a353038302f64656d6f732f6f666c615f64656d6f2e7377660005746355726c02001972746d703a2f2f6c6f63616c686f73742f6f666c6144656d6f0004667061640100000c6361706162696c697469657300406de00000000000000b617564696f436f646563730040abee0000000000000b766964656f436f6465637300406f800000000000000d766964656f46756e6374696f6e003ff000000000000000077061676555726c02002a687474703a2f2f6c6f63616c686f73743a353038302f64656d6f732f6f666c615f64656d6f2e68746d6c000009"));
    Input in0 = new Input(data);
    // action string
    Assert.assertEquals(DataTypes.CORE_STRING, in0.readDataType());
    String action = in0.readString();
    Assert.assertEquals("connect", action);
    // invoke trasaction id
    log.trace("Before reading number type: {}", data.position());
    byte type = in0.readDataType();
    log.trace("After reading number type({}): {}", type, data.position());
    Assert.assertEquals(DataTypes.CORE_NUMBER, type);
    Number transactionId = in0.readNumber();
    System.out.printf("Number - i: %d d: %f%n", transactionId.intValue(), transactionId.doubleValue());
    Map<String, Object> obj1 = Deserializer.deserialize(in0, Map.class);
    assertNotNull("Connection parameters should be valid", obj1);
    log.debug("Parameters: {}", obj1.toString());
    assertEquals("Application does not match", "oflaDemo", obj1.get("app"));
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:24,代码来源:AMFIOTest.java

示例10: testOnStreamSendMap

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testOnStreamSendMap() {
    // 02 = string
    // 08 = mixed array (map) max number = 0
    
    IoBuffer data = IoBuffer.wrap(IOUtils.hexStringToByteArray("02 00 0c 6f 6e 53 74 72 65 61 6d 53 65 6e 64 08 00000000 00 05 76 616c7565 02 00 01 31 00 00 09"));
    Input in0 = new Input(data);
    assertEquals(DataTypes.CORE_STRING, in0.readDataType());
    String method = in0.readString();
    assertEquals("onStreamSend", method);
    assertEquals(DataTypes.CORE_MAP, in0.readDataType());
    @SuppressWarnings("rawtypes")
    ObjectMap map = (ObjectMap) in0.readMap();
    assertEquals(map.get("value"), "1");
}
 
开发者ID:Red5,项目名称:red5-io,代码行数:16,代码来源:InputTest.java

示例11: testInboundHandshake

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
/** Serverside test */
@Test
public void testInboundHandshake() {
    log.info("\n testInboundHandshake");
    IoBuffer r5c1 = IoBuffer.allocate(1536);
    r5c1.put(IOUtils.hexStringToByteArray(red5clientC1));
    r5c1.flip();
    InboundHandshake in = new InboundHandshake();
    // try old method
    IoBuffer S1 = in.doHandshake(r5c1);
    log.debug("S1: {}", Hex.encodeHexString(S1.array()));
    Assert.assertNotNull(S1);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:14,代码来源:ServerRTMPHandshakeTest.java

示例12: testValidateFromFFMpeg

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testValidateFromFFMpeg() {
    log.info("\n testValidateFromFFMpeg");
    // server side handshake handler
    InboundHandshake in = new InboundHandshake((byte) 0x03);
    // set whether or not unverified will be allowed
    in.setUnvalidatedConnectionAllowed(true);
    // FFMPEG
    IoBuffer cc = IoBuffer.allocate(1536);
    // C1
    //cc.put(IOUtils.hexStringToByteArray(ffmpegC1));
    cc.put(IOUtils.hexStringToByteArray(ffmpeg3C1));
    cc.flip();
    log.debug("FFMpeg c1: {}", cc);
    // use pregenerated server handshake bytes
    IoBuffer svr = IoBuffer.wrap(IOUtils.hexStringToByteArray(ffmpeg3ServerHS));
    in.setHandshakeBytes(svr.array());
    // decode C1
    IoBuffer s0s1s2 = in.decodeClientRequest1(cc);
    log.debug("Server reponse: {}", s0s1s2);
    // C2
    IoBuffer c2 = IoBuffer.wrap(IOUtils.hexStringToByteArray(ffmpeg3C2));
    // decode C2
    boolean ffmpeg = in.decodeClientRequest2(c2);
    // prevent travis CI from failing; we know this is broken atm
    if (!ffmpeg) {
        log.warn("FFMpeg validation failed");
    }
    //Assert.assertTrue(ffmpeg);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:31,代码来源:ServerRTMPHandshakeTest.java

示例13: testOutgoingPublicKey

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testOutgoingPublicKey() {
    log.info("\n testOutgoingPublicKey");
    byte[] sharedSecret = IOUtils.hexStringToByteArray("04cde275ff2d72113cfac0e914bf4dab3bc747dfb63c23314b470181e7260a1f37ae3ef259f3bd3fe80ec5ebf99d501e4cce69d224268e6d5304cbfb94bc71d59f15564f96a089f9a93b5e08d9ea0c45ca5934ff2c9729cc73856fd130cb6bfe29f14a0ec36e0eee0cd5c21c1d08f6f9979adc162d24831318a3b9145d835222");
    byte[] outgoingPublicKey = IOUtils.hexStringToByteArray("d5055cd576014c41fc91811a7f6aaaacc8f5bef9383cabb3c91afd392448255ef14a38e8c985197652a47a31e2852d7923dae7c2c10df3b325556c4f2fbc14b04e244570c42526e67d2c5c3e75fcd1732c7b915839653274df15d887c10852dae81d54e52fe26946fd7936fc69926e7a33c9e3aba7ae2a93cbbd4c481cde3f90");
    InboundHandshake in = new InboundHandshake();
    byte[] rc4keyOut = new byte[32];
    in.calculateHMAC_SHA256(outgoingPublicKey, 0, outgoingPublicKey.length, sharedSecret, RTMPHandshake.KEY_LENGTH, rc4keyOut, 0);
    log.debug("rc4keyOut: {}", rc4keyOut);
    Assert.assertNotEquals(IOUtils.hexStringToByteArray("0000000000000000000000000000000000000000000000000000000000000000"), rc4keyOut);
}
 
开发者ID:Red5,项目名称:red5-server,代码行数:12,代码来源:ServerRTMPHandshakeTest.java

示例14: testDecodeBufferYugeTimestamp2

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
@Test
public void testDecodeBufferYugeTimestamp2() {
    // this test data is from a flash forum
    byte[] buf = IOUtils.hexStringToByteArray("06FFFFFF00BC48090100000001643DD012 00 00 84 02 80 9E FE 25 2A 2E F8 30 3F 99 FC 4C AB 6E B7 2F CB CB E2 DE 62 A7 86 9E BC 3E 04 05 73 C3 D1 F0 FB 70 45 12 80 32 CE 4C B3 44 6E 76 37 66 62 C7 A5 84 A0 60 12 C1 80 51 55 E9 41 80 D5 06 01 69 55 53 EB 70 18 06 10 60 1A FC C2 BF 4C B0 03 65 1D E5 FA 6B 57 AE 91 80 C0 25 03 00 A9 E2 EB F0 60 36 01 80 61 B6 65 1D 83 00 D0 0C 03 82 B1 16 C0 52 89 35 7A D3 18 C2 88 F6 CD C601 64 3D D000 FE 03 02 F7 28 19 50 AF F8 55 7D 8C 35 1A 33 0E 3D EE DC F2 75 3B 10 E4 CC 21 7B CF C1 80 11 06 00 64 BF 41 0C 18 00 F0 0C F9 7F F2 DA AC 18 01 10 40 56 3B C5 17 3F 4B BE AD AC B6 E5 DC C1 DC 91 EF 60 C0 4F 03 00 3E 5F B6 83 00 36 0C 00 99 7C A0 C1 88 80 62 A5 3C C0 60 9E 81 80 10 CD 9B 59 83 BE B0 E8 F5 40 C0 22 03 00 A9 00 D8 30 0C 00 C0 36 97 F2 D0 60 5E 02 1D 08 39 F1 EE 03C6 01 64 3D D0 04 F2 07 FB 67 07 6D F6 5B B6 9F 8E A0 C0 20 83 00 B3 E5 14 18 0F 00 84 AF 6A AD A2 58 30 02 A0 C0 0C 04 39 F8 A6 A9 D0 60 3E 41 80 10 2F 6B 16 98 C0 8A E6 AF 2A 12 44 75 73 CA F6 62 90 3F FA 58 08 52 6C 63 AB 64 E1 D8 70 43 FC 9C 2F 2F F5 9B 66 5A 0A AD FB 48 0C 3D E8 18 0A 60 60 09 2D 55 FF 03 00 3A 0C 00 CA 8B C5 70 4B 06 00 60 18 00 F2 FA 8F EA 84 88 5D F9 19 6B E0 59 EF 5E 06");
    RTMPConnection conn = RTMPConnManager.getInstance().createConnection(RTMPMinaConnection.class);
    conn.setStateCode(RTMP.STATE_CONNECTED);
    
    RTMPClientProtocolDecoder decoder = new RTMPClientProtocolDecoder();
    decoder.decodeBuffer(conn, IoBuffer.wrap(buf));
}
 
开发者ID:Red5,项目名称:red5-client,代码行数:11,代码来源:RTMPClientProtocolDecoderTest.java

示例15: readTagHeader

import org.red5.io.utils.IOUtils; //导入依赖的package包/类
/**
 * Read only header part of a tag.
 *
 * @return              Tag header
 */
private ITag readTagHeader() {
	// previous tag size (4 bytes) + flv tag header size (11 bytes)
	fillBuffer(15);
	//		if (log.isDebugEnabled()) {
	//			in.mark();
	//			StringBuilder sb = new StringBuilder();
	//			HexDump.dumpHex(sb, in.array());
	//			log.debug("\n{}", sb);
	//			in.reset();
	//		}		
	// previous tag's size
	int previousTagSize = in.getInt();
	// start of the flv tag
	byte dataType = in.get();
	if (log.isTraceEnabled()) {
		log.trace("Bits: {}", Integer.toBinaryString(dataType));
	}
	dataType = (byte) (dataType & 31);
	byte filter = (byte) ((dataType & 63) >> 5);
	byte reserved = (byte) ((dataType & 127) >> 6);
	log.debug("Reserved: {}, Filter: {}, Datatype: {}", reserved, filter, dataType);
	switch (dataType) {
		case 8: // audio
			log.debug("Found audio");
			break;
		case 9: // video
			log.debug("Found video");
			break;
		case 15: // special fms undocumented type?
		case 18: // meta / script data
			log.debug("Found meta/script data");			
			break;
		default:
			log.debug("Invalid data type detected ({}), reading ahead", dataType);
			log.debug("Current position: {} limit: {}", in.position(), in.limit());
			// loop a few times to see if we find a usable data type
			int i = 0;
			while (dataType != 8 && dataType != 9 && dataType != 18) {
				// only allow 10 loops
				if (i++ > 10) {
					return null;
				}
				// move ahead and see if we get a valid datatype		
				dataType = in.get();
			}
	}
	//		byte aacType = 0;
	//		if (dataType == 8 && keyframeMeta.audioCodecId == AudioCodec.AAC.getId()) {
	//			// flv spec indicates that aac contains an extra byte after the data type
	//			aacType = in.get();
	//		}
	int bodySize = IOUtils.readUnsignedMediumInt(in);
	int timestamp = IOUtils.readExtendedMediumInt(in);
	if (log.isDebugEnabled()) {
		int streamId = IOUtils.readUnsignedMediumInt(in);
		log.debug("Data type: {} timestamp: {} stream id: {} body size: {} previous tag size: {}", new Object[] { dataType, timestamp, streamId, bodySize, previousTagSize });
	} else {
		in.skip(3);
	}
	return new Tag(dataType, timestamp, bodySize, null, previousTagSize);
}
 
开发者ID:Kyunghwa-Yoo,项目名称:StitchRTSP,代码行数:67,代码来源:FLVReader.java


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