public BaseRTMPTConnection(String type) { super(type); this.buffer = IoBuffer.allocate(0).setAutoExpand(true); }
private void deliverRawText0(String text){ boolean errorDelivering = false; IoBuffer buffer = IoBuffer.allocate(text.length()); buffer.setAutoExpand(true); try { //Charset charset = Charset.forName(CHARSET); //buffer.putString(text, charset.newEncoder()); buffer.put(text.getBytes(StandardCharsets.UTF_8)); if (flashClient) { buffer.put((byte) '\0'); } buffer.flip(); ioSessionLock.lock(); try { ioSession.write(buffer); } finally { ioSessionLock.unlock(); } } catch (Exception e) { Log.debug("Error delivering raw text:\n" + text, e); errorDelivering = true; } // Attempt to close the connection if delivering text fails. if (errorDelivering) { close(); } }
buf.setAutoExpand(true); Output out = new Output(buf); out.writeString(object.getClass().getName());
result = IoBuffer.allocate(targetSize).setAutoExpand(true); for (PendingData pendingMessage : sendList) { result.put(pendingMessage.getBuffer());
boolean errorDelivering = false; IoBuffer buffer = IoBuffer.allocate(4096); buffer.setAutoExpand(true); try { buffer.putString(packet.getElement().asXML(), encoder.get());
RemotingPacket resp = (RemotingPacket) message; IoBuffer buf = IoBuffer.allocate(1024); buf.setAutoExpand(true); Output output; if (resp.getEncoding() == Encoding.AMF0) {
/** * {@inheritDoc} */ @Override public IoBuffer setAutoExpand(boolean autoExpand) { buf.setAutoExpand(autoExpand); return this; }
/** Create a new Context object with a default buffer */ private Context(int bufferLength) { decoder = charset.newDecoder(); buf = IoBuffer.allocate(bufferLength).setAutoExpand(true); }
public IoSessionInputStream() { buf = IoBuffer.allocate(16); buf.setAutoExpand(true); buf.limit(0); }
public void encode(IoSession session, Object message, ProtocolEncoderOutput out) throws Exception { String value = message.toString(); IoBuffer buf = IoBuffer.allocate(value.length()).setAutoExpand(true); buf.putString(value, ENCODER); buf.flip(); out.write(buf); } }
private static IoBuffer buildWSResponseBuffer(WebSocketHandShakeResponse response) { IoBuffer buffer = IoBuffer.allocate(response.getResponse().getBytes().length, false); buffer.setAutoExpand(true); buffer.put(response.getResponse().getBytes()); buffer.flip(); return buffer; }
public static void encodeString(int code, IoSession session, CharSequence message, ProtocolEncoderOutput out) throws CharacterCodingException, ProtocolEncoderException { code = code | Protocols.FORMAT_JSON; int size = message.length(); int prefixLength = size <= (Protocols.MAX_ONE / 3) ? 1 : size <= (Protocols.MAX_TWO / 3) ? 2 : 4; IoBuffer buffer = IoBuffer.allocate((int) (size * 1.2) + 10).setAutoExpand(true); putProtocol(code, buffer, prefixLength); buffer.putPrefixedString(message, prefixLength, charset.newEncoder()); buffer.flip(); out.write(buffer); }
/** {@inheritDoc} */ @Override public IoBuffer getDecoderConfiguration() { if (blockDataAACDCR == null) { return null; } IoBuffer result = IoBuffer.allocate(4); result.setAutoExpand(true); result.put(blockDataAACDCR); result.rewind(); return result; }
/** {@inheritDoc} */ public IoBuffer encodeFlexSharedObject(ISharedObjectMessage so) { final IoBuffer out = IoBuffer.allocate(128); out.setAutoExpand(true); out.put((byte) 0x00); // unknown (not AMF version) doEncodeSharedObject(so, out); return out; }
@Override public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); dataType = in.readByte(); byte[] byteBuf = (byte[]) in.readObject(); if (byteBuf != null) { data = IoBuffer.allocate(0); data.setAutoExpand(true); SerializeUtils.ByteArrayToByteBuffer(byteBuf, data); } }
@Override public void sessionOpened ( final NextFilter nextFilter, final IoSession session ) throws Exception { logger.debug ( "Session opened: {}", session ); final IoBuffer buffer = IoBuffer.allocate ( 1 ); buffer.setAutoExpand ( true ); buffer.put ( new byte[] { 0x11, (byte)0xE0, 0x00, 0x00, 0x00, 0x01, 0x00, (byte)0xC1, 2, 1, 0, (byte)0xC2, 2, 0, 1, (byte)0xC0, 1, 9 } ); buffer.put ( 13, (byte) ( this.rack + 1 ) ); buffer.put ( 14, this.slot ); buffer.flip (); session.write ( buffer ); }
public CacheableImpl(Object obj) { IoBuffer tmp = IoBuffer.allocate(1024, true); tmp.setAutoExpand(true); tmp.putObject(obj); bytes = new byte[tmp.capacity()]; tmp.get(bytes); cached = true; tmp.free(); tmp = null; }
private void storeRemainingInSession(IoBuffer buf, IoSession session) { final IoBuffer remainingBuf = IoBuffer.allocate(buf.capacity()).setAutoExpand(true); remainingBuf.order(buf.order()); remainingBuf.put(buf); session.setAttribute(BUFFER, remainingBuf); }
private void storeRemainingInSession(IoBuffer buf, IoSession session) { IoBuffer remainingBuf = IoBuffer.allocate(buf.capacity()); remainingBuf.setAutoExpand(true); remainingBuf.order(buf.order()); remainingBuf.put(buf); session.setAttribute(BUFFER, remainingBuf); }
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 ); }