Package org.apache.mina.core.buffer

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


        session.increaseWrittenBytes(localWrittenBytes, currentTime);

        if (!buf.hasRemaining() || !hasFragmentation && localWrittenBytes != 0) {
            // Buffer has been sent, clear the current request.
            int pos = buf.position();
            buf.reset();
           
            fireMessageSent(session, req);
           
            // And set it back to its position
View Full Code Here


            buf.reset();
           
            fireMessageSent(session, req);
           
            // And set it back to its position
            buf.position(pos);
        }
        return localWrittenBytes;
    }

    private int writeFile(T session, WriteRequest req,
View Full Code Here

        // Loop until we don't have anymore byte in the buffer,
        // or until the decoder throws an unrecoverable exception or
        // can't decoder a message, because there are not enough
        // data in the buffer
        while (in.hasRemaining()) {
            int oldPos = in.position();
           
            try {
                synchronized (decoderOut) {
                    // Call the decoder with the read bytes
                    decoder.decode(session, in, decoderOut);
View Full Code Here

                    pde = new ProtocolDecoderException(t);
                }
               
                if (pde.getHexdump() == null) {
                    // Generate a message hex dump
                    int curPos = in.position();
                    in.position(oldPos);
                    pde.setHexdump(in.getHexDump());
                    in.position(curPos);
                }
View Full Code Here

                }
               
                if (pde.getHexdump() == null) {
                    // Generate a message hex dump
                    int curPos = in.position();
                    in.position(oldPos);
                    pde.setHexdump(in.getHexDump());
                    in.position(curPos);
                }

                // Fire the exceptionCaught event.
View Full Code Here

                if (pde.getHexdump() == null) {
                    // Generate a message hex dump
                    int curPos = in.position();
                    in.position(oldPos);
                    pde.setHexdump(in.getHexDump());
                    in.position(curPos);
                }

                // Fire the exceptionCaught event.
                decoderOut.flush(nextFilter, session);
                nextFilter.exceptionCaught(session, pde);
View Full Code Here

                // Retry only if the type of the caught exception is
                // recoverable and the buffer position has changed.
                // We check buffer position additionally to prevent an
                // infinite loop.
                if (!(t instanceof RecoverableProtocolDecoderException) ||
                        (in.position() == oldPos)) {
                    break;
                }
            }
        }
    }
View Full Code Here

                continue;
            }

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

            }

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

            }

            int writtenBytes = buf.remaining();
            try {
                outputStream.write(buf.array(), buf.position(), writtenBytes);
                buf.position(buf.position() + writtenBytes);
               
                // increase written bytes
                increaseWrittenBytes(writtenBytes, System.currentTimeMillis());
               
                setCurrentWriteRequest(null);
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.