Examples of buf()


Examples of com.google.code.yanf4j.buffer.IoBuffer.buf()

        duplicate = original.duplicate();
        original.put(4, (byte) 127);
        assertEquals(4, duplicate.position());
        assertEquals(10, duplicate.limit());
        assertEquals(16, duplicate.capacity());
        assertNotSame(original.buf(), duplicate.buf());
        assertSame(original.buf().array(), duplicate.buf().array());
        assertEquals(127, duplicate.get(4));

        // Test a duplicate of a duplicate.
        original = IoBuffer.allocate(16);
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

    private void readSession(DatagramSessionImpl session) {

        ByteBuffer readBuf = ByteBuffer.allocate(session.getReadBufferSize());
        try {
            int readBytes = session.getChannel().read(readBuf.buf());
            if (readBytes > 0) {
                readBuf.flip();
                ByteBuffer newBuf = ByteBuffer.allocate(readBuf.limit());
                newBuf.put(readBuf);
                newBuf.flip();
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

        try {
            int readBytes = 0;
            int ret;

            try {
                while ((ret = ch.read(buf.buf())) > 0) {
                    readBytes += ret;
                }
            } finally {
                buf.flip();
            }
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

                    buf.reset();
                    session.getFilterChain().fireMessageSent(session, req);
                    continue;
                }
       
                int localWrittenBytes = ch.write(buf.buf());
                writtenBytes += localWrittenBytes;
   
                if (localWrittenBytes == 0 || writtenBytes >= maxWrittenBytes) {
                    // Kernel buffer is full or wrote too much
                    key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

                    session.getFilterChain().fireMessageSent(session, req);
                    continue;
                }

                if (key.isWritable()) {
                    writtenBytes += ch.write(buf.buf());
                }

                if (buf.hasRemaining() || writtenBytes >= maxWrittenBytes) {
                    // Kernel buffer is full or wrote too much.
                    key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

        for (;;) {
            ByteBuffer buf = ByteBuffer.allocate(8192);
            Message m = (Message) message;
            try {
                if (m.write(buf.buf())) {
                    break;
                }
            } finally {
                buf.flip();
                if (buf.hasRemaining()) {
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

            throws Exception {
        ByteBuffer readBuf = ByteBuffer
                .allocate(((DatagramSessionConfig) req.config
                        .getSessionConfig()).getReceiveBufferSize());
        try {
            SocketAddress remoteAddress = channel.receive(readBuf.buf());
            if (remoteAddress != null) {
                DatagramSessionImpl session = (DatagramSessionImpl) newSession(
                        remoteAddress, req.address);

                readBuf.flip();
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

                SocketAddress destination = req.getDestination();
                if (destination == null) {
                    destination = session.getRemoteAddress();
                }
   
                int localWrittenBytes = ch.send(buf.buf(), destination);
                writtenBytes += localWrittenBytes;
   
                if (localWrittenBytes == 0 || writtenBytes >= maxWrittenBytes) {
                    // Kernel buffer is full or wrote too much
                    key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

                            + buf + ')');
                }

                try {
                    // forward read encrypted data to SSL handler
                    handler.messageReceived(nextFilter, buf.buf());

                    // Handle data to be forwarded to application or written to net
                    handleSSLData(nextFilter, handler);

                    if (handler.isInboundDone()) {
View Full Code Here

Examples of org.apache.mina.common.ByteBuffer.buf()

                    if (SessionLog.isDebugEnabled(session)) {
                        SessionLog.debug(session, " encrypt: " + buf);
                    }

                    int pos = buf.position();
                    handler.encrypt(buf.buf());
                    buf.position(pos);
                    ByteBuffer encryptedBuffer = new EncryptedBuffer(SSLHandler
                            .copy(handler.getOutNetBuffer()), buf);

                    if (SessionLog.isDebugEnabled(session)) {
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.