Package org.apache.mina.core.buffer

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


       
        if (buf.hasRemaining()) {
            int length;
           
            if (hasFragmentation) {
                length = Math.min(buf.remaining(), maxLength);
            } else {
                length = buf.remaining();
            }
           
            localWrittenBytes = write(session, buf, length);
View Full Code Here


            int length;
           
            if (hasFragmentation) {
                length = Math.min(buf.remaining(), maxLength);
            } else {
                length = buf.remaining();
            }
           
            localWrittenBytes = write(session, buf, length);
        }
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

                buf.reset();
                this.getFilterChain().fireMessageSent(req);
                continue;
            }

            int writtenBytes = buf.remaining();
            try {
                outputStream.write(buf.array(), buf.position(), writtenBytes);
                buf.position(buf.position() + writtenBytes);
               
                // increase written bytes
View Full Code Here

                    session.setCurrentWriteRequest(req);
                }

                IoBuffer buf = (IoBuffer) req.getMessage();
               
                if (buf.remaining() == 0) {
                    // Clear and fire event
                    session.setCurrentWriteRequest(null);
                    buf.reset();
                    session.getFilterChain().fireMessageSent(req);
                    continue;
View Full Code Here

        {
            /*
             * 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

    public void testAllocate() throws Exception {
        for (int i = 10; i < 1048576 * 2; i = i * 11 / 10) // increase by 10%
        {
            IoBuffer buf = IoBuffer.allocate(i);
            assertEquals(0, buf.position());
            assertEquals(buf.capacity(), buf.remaining());
            assertTrue(buf.capacity() >= i);
            assertTrue(buf.capacity() < i * 2);
        }
    }

View Full Code Here

            return false;
        }
       
        IoBuffer buf = (IoBuffer) message;
        int offset = buf.position();
        return buf.remaining() == 23 &&
               buf.get(offset + 0) == 0x15 && buf.get(offset + 1) == 0x03 &&
               buf.get(offset + 2) == 0x01 && buf.get(offset + 3) == 0x00 &&
               buf.get(offset + 4) == 0x12;
    }
View Full Code Here

                        return;
                    }

                    IoBuffer buf = (IoBuffer) message;
                    if (session.getFilterChain().contains("SSL")
                            && buf.remaining() == 1 && buf.get() == (byte) '.') {
                        logger.info("TLS Reentrance");
                        ((SslFilter) session.getFilterChain().get("SSL"))
                                .startSsl(session);

                        // Send a response
View Full Code Here

                    IoBuffer tmp = decoder.decodeFully(buf);
                    if (tmp == null) {
                        return;
                    }

                    if (tmp.remaining() == 2) {
                        waitingFooters = false;
                        break;
                    }

                    // add footer to headers         
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.