Package org.apache.mina.core.buffer

Examples of org.apache.mina.core.buffer.IoBuffer.remaining()


        {
            /*
             * Get the buffer as bytes.
             */
            IoBuffer buf = ( IoBuffer ) writeRequest.getMessage();
            int bufferLength = buf.remaining();
            byte[] bufferBytes = new byte[bufferLength];
            buf.get( bufferBytes );

            log.debug( "Will use SASL to wrap message of length:  {}", bufferLength );

View Full Code Here


        out = new ChannelOutputStream(this, remoteWindow, log, SshConstants.Message.SSH_MSG_CHANNEL_DATA);
        IoHandler handler = new IoHandlerAdapter() {
            @Override
            public void messageReceived(IoSession session, Object message) throws Exception {
                IoBuffer ioBuffer = (IoBuffer) message;
                int r = ioBuffer.remaining();
                byte[] b = new byte[r];
                ioBuffer.get(b, 0, r);
                out.write(b, 0, r);
                out.flush();
            }
View Full Code Here

    @Override
    public void messageReceived(IoSession session, Object message) throws Exception {
        ChannelForwardedTcpip channel = (ChannelForwardedTcpip) session.getAttribute(ChannelForwardedTcpip.class);
        IoBuffer ioBuffer = (IoBuffer) message;
        int r = ioBuffer.remaining();
        byte[] b = new byte[r];
        ioBuffer.get(b, 0, r);
        channel.waitFor(ClientChannel.OPENED | ClientChannel.CLOSED, Long.MAX_VALUE);
        channel.getOut().write(b, 0, r);
        channel.getOut().flush();
View Full Code Here

      public void messageReceived(IoSession session, Object message) throws Exception {
        long id = session.getId();
        System.out.println("[id:" + id + "]messageReceived");
        IoBuffer msg = (IoBuffer)message;
        IoBuffer buf = (IoBuffer)session.getAttribute("buffer");
        if (buf.remaining() < msg.limit()) {
          int bufCapacity = buf.capacity() + (msg.limit() - buf.remaining());
          buf.capacity(bufCapacity);
          buf.limit(bufCapacity);
        }
        buf.put((IoBuffer)message);
View Full Code Here

        long id = session.getId();
        System.out.println("[id:" + id + "]messageReceived");
        IoBuffer msg = (IoBuffer)message;
        IoBuffer buf = (IoBuffer)session.getAttribute("buffer");
        if (buf.remaining() < msg.limit()) {
          int bufCapacity = buf.capacity() + (msg.limit() - buf.remaining());
          buf.capacity(bufCapacity);
          buf.limit(bufCapacity);
        }
        buf.put((IoBuffer)message);
       
View Full Code Here

    int pos = buf.position();
    int limit = buf.limit();
   
    buf.flip();
    buf.position(0);
    int len = buf.remaining();
    byte [] bytes = new byte[len];
    buf.get(bytes);
   
    buf.position(pos);
    buf.limit(limit);   
View Full Code Here

      public void messageReceived(IoSession session, Object message) throws Exception {
        long id = session.getId();
        System.out.println("[id:" + id + "]messageReceived");
        IoBuffer msg = (IoBuffer)message;
        IoBuffer buf = (IoBuffer)session.getAttribute("buffer");
        if (buf.remaining() < msg.limit()) {
          int bufCapacity = buf.capacity() + (msg.limit() - buf.remaining());
          buf.capacity(bufCapacity);
          buf.limit(bufCapacity);
        }
        buf.put((IoBuffer)message);
View Full Code Here

        long id = session.getId();
        System.out.println("[id:" + id + "]messageReceived");
        IoBuffer msg = (IoBuffer)message;
        IoBuffer buf = (IoBuffer)session.getAttribute("buffer");
        if (buf.remaining() < msg.limit()) {
          int bufCapacity = buf.capacity() + (msg.limit() - buf.remaining());
          buf.capacity(bufCapacity);
          buf.limit(bufCapacity);
        }
        buf.put((IoBuffer)message);
       
View Full Code Here

    int pos = buf.position();
    int limit = buf.limit();
   
    buf.flip();
    buf.position(0);
    int len = buf.remaining();
    byte [] bytes = new byte[len];
    buf.get(bytes);
   
    buf.position(pos);
    buf.limit(limit);   
View Full Code Here

                    break;
                }
            }

            IoBuffer buf = (IoBuffer) req.getMessage();
            if (buf.remaining() == 0) {
                setCurrentWriteRequest(null);
                buf.reset();

                this.getFilterChain().fireMessageSent(req);
                continue;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.