Package java.nio

Examples of java.nio.ByteBuffer.limit()


        }

        ByteBuffer bb = link.peekLast();
        if(len <= writable) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + len);
            bb.put(b, off, len);
            bb.position(pos);
            writable = bb.capacity() - bb.limit();
            return;
View Full Code Here


        ByteBuffer bb = link.peekLast();
        if(len <= writable) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + len);
            bb.put(b, off, len);
            bb.position(pos);
            writable = bb.capacity() - bb.limit();
            return;
        }
View Full Code Here

        ByteBuffer bb = link.peekLast();
        if(len <= writable) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + len);
            bb.put(b, off, len);
            bb.position(pos);
            writable = bb.capacity() - bb.limit();
            return;
        }
View Full Code Here

            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + len);
            bb.put(b, off, len);
            bb.position(pos);
            writable = bb.capacity() - bb.limit();
            return;
        }

        if(writable > 0) {
            int pos = bb.position();
View Full Code Here

            return;
        }

        if(writable > 0) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + writable);
            bb.put(b, off, writable);
            bb.position(pos);
            off += writable;
            len -= writable;
View Full Code Here

        }

        if(writable > 0) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + writable);
            bb.put(b, off, writable);
            bb.position(pos);
            off += writable;
            len -= writable;
            writable = 0;
View Full Code Here

        }

        if(writable > 0) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + writable);
            bb.put(b, off, writable);
            bb.position(pos);
            off += writable;
            len -= writable;
            writable = 0;
View Full Code Here

        }

        int sz = Math.max(len, bufferSize);
        ByteBuffer nb = ByteBuffer.allocate(sz);
        nb.put(b, off, len);
        nb.limit(len);
        nb.position(0);
        link.addLast(nb);
        writable = sz - len;
    }
View Full Code Here

        int rem = buf.remaining();

        ByteBuffer bb = link.peekLast();
        if(rem <= writable) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + rem);
            bb.put(buf);
            bb.position(pos);
            writable = bb.capacity() - bb.limit();
            return;
View Full Code Here

        ByteBuffer bb = link.peekLast();
        if(rem <= writable) {
            int pos = bb.position();
            bb.position(bb.limit());
            bb.limit(bb.limit() + rem);
            bb.put(buf);
            bb.position(pos);
            writable = bb.capacity() - bb.limit();
            return;
        }
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.