/** {@inheritDoc} */ @Override public void messageReceived(NextFilter next, IoSession session, Object message) throws Exception { if (message instanceof IoBuffer) { IoBuffer out = (IoBuffer) message; if (headers != null) { IoBuffer header = IoBuffer.allocate(12); header.putLong(System.currentTimeMillis()); header.putInt(out.limit() - out.position()); header.flip(); headers.write(header.buf()); } if (raw != null) { raw.write(out.asReadOnlyBuffer().buf()); } } next.messageReceived(session, message); }
/** * Generates response for non-versioned connections, such as those before FP9. * * @param input * incoming RTMP bytes * @return outgoing handshake */ private IoBuffer generateUnversionedHandshake(byte[] input) { log.debug("Using old style (un-versioned) handshake"); IoBuffer output = IoBuffer.allocate((Constants.HANDSHAKE_SIZE * 2) + 1); // 3073 // non-encrypted output.put(RTMPConnection.RTMP_NON_ENCRYPTED); // set server uptime in seconds output.putInt((int) Red5.getUpTime() / 1000); //0x01 output.position(Constants.HANDSHAKE_SIZE + 1); output.put(input); output.flip(); // fill S1 with handshake data (nearly all 0's) output.mark(); output.position(1); output.get(s1); output.reset(); return output; }
Output.putString(buf, ""); buf.putInt(-1); log.info("result: {}", call.getResult()); if (call.isAMF3) {
/** * {@inheritDoc} */ @Override public void putInt(int index, int i) { bb.putInt(index, i); }
/** * {@inheritDoc} */ @Override public IoBuffer putInt(int value) { buf.putInt(value); return this; }
/** * {@inheritDoc} */ @Override public IoBuffer putInt(int index, int value) { buf.putInt(index, value); return this; }
/** * {@inheritDoc} */ @Override public IoBuffer putInt(int value) { buf.putInt(value); return this; }
/** {@inheritDoc} */ @Override public void writeUnsignedInt(long value) { buffer.putInt((int) value); }
/** * {@inheritDoc} */ @Override public IoBuffer putInt(int index, int value) { buf.putInt(index, value); return this; }
@Override public void put ( final IoBuffer data, final Integer value ) { data.putInt ( value ); }
protected void inlineEncodeProperties ( final IoBuffer buffer, final Map<String, String> data ) throws Exception { buffer.putInt ( data.size () ); for ( final Map.Entry<String, String> entry : data.entrySet () ) { buffer.putPrefixedString ( entry.getKey (), STRING_PREFIX_LEN, this.encoder ); buffer.putPrefixedString ( entry.getValue (), STRING_PREFIX_LEN, this.encoder ); } }
@Override public void encodePrimitiveInt ( final IoBuffer buffer, final byte fieldNumber, final int data ) throws Exception { buffer.put ( fieldNumber ); buffer.put ( TYPE_INT ); buffer.putInt ( data ); }
/** {@inheritDoc} */ public IoBuffer encodeBytesRead(BytesRead bytesRead) { final IoBuffer out = IoBuffer.allocate(4); out.putInt(bytesRead.getBytesRead()); return out; }
/** {@inheritDoc} */ public IoBuffer encodeChunkSize(ChunkSize chunkSize) { final IoBuffer out = IoBuffer.allocate(4); out.putInt(chunkSize.getSize()); return out; }
@Override public IoBuffer encodeMessage ( final BinaryContext context, final Object objectMessage ) throws Exception { final IoBuffer data = IoBuffer.allocate ( 5 ); data.putInt ( MESSAGE_CODE ); data.put ( (byte)0 ); // number of fields data.flip (); return data; }
@Override public IoBuffer encodeMessage ( final BinaryContext context, final Object objectMessage ) throws Exception { final IoBuffer data = IoBuffer.allocate ( 5 ); data.putInt ( MESSAGE_CODE ); data.put ( (byte)0 ); // number of fields data.flip (); return data; }
public static IoBuffer toIobuffer(final MassMessage message) { IoBuffer buf = IoBuffer.allocate(8 + message.getLength()); buf.putInt(message.getLength() + 4); // 总长度 buf.putInt(message.getBuffLength()); // 内容长度 buf.put(message.getBuffer()); for (Long target : message.getTargets()) { buf.putLong(target); } buf.rewind(); return buf; }
private void encodeHeader ( final IoBuffer data, final CommonMessage message ) { data.putShort ( (short)1202 ); data.put ( (byte)0x01 ); data.putInt ( message.getSequence () ); data.put ( message.getCommandCode ().getCommandCode () ); }
public void put( IoBuffer byteBuffer, ResourceRecord record ) throws IOException { putDomainName( byteBuffer, record.getDomainName() ); putRecordType( byteBuffer, record.getRecordType() ); putRecordClass( byteBuffer, record.getRecordClass() ); byteBuffer.putInt( record.getTimeToLive() ); putResourceRecord( byteBuffer, record ); }
private Frame encodeCloseMessage ( final IoSession session, final CloseMessage message ) throws CharacterCodingException { final IoBuffer data = IoBuffer.allocate ( 0 ); data.setAutoExpand ( true ); data.putString ( message.getMessage (), getCharsetEncoder ( session ) ); data.put ( (byte)0x00 ); data.putInt ( message.getCode () ); data.flip (); return new Frame ( FrameType.CLOSE, data ); }