Examples of remaining()


Examples of java.nio.ByteBuffer.remaining()

            if ( header.isClient() )
            {
                // ok, get the control bits as well as the adapter name in a
                // ByteChannel
                ByteBuffer tmpBuf = header.toByteBuffer();
                magicBuf = ByteBufferAllocator.allocate( tmpBuf.remaining() + 4, false );
                magicBuf.putInt( EJConstants.EJOE_MAGIC_NUMBER );
                magicBuf.put( tmpBuf );
                magicBuf.flip();
                logger.log( Level.FINEST, "Sending Clientheader: " + header );
                semiBlockingWrite( channel, magicBuf, timeout );
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

        long timePeriod = -1;
        do
        {
            limit = headerBuf.limit();
            // increase the byte buffer if it's free memory falls below 20 percent
            if ( headerBuf.remaining() <= (limit / 5) )
            {
                logger.log( Level.FINEST, "Allocating additional " + (limit / 2) + "b for buffer with " + limit + "b" );
                headerBuf = ByteBufferAllocator.reAllocate( headerBuf, limit + (limit / 2) );
            }
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

            return 0;
        }
        int olen = len;
        while(true) {
            ByteBuffer bb = link.peekFirst();
            if(len < bb.remaining()) {
                bb.get(b, off, len);
                return olen;
            }
            int rem = bb.remaining();
            bb.get(b, off, rem);
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

            ByteBuffer bb = link.peekFirst();
            if(len < bb.remaining()) {
                bb.get(b, off, len);
                return olen;
            }
            int rem = bb.remaining();
            bb.get(b, off, rem);
            len -= rem;
            off += rem;
            if(!removeFirstLink(bb)) {
                break;
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

    public boolean tryRefer(BufferReferer ref, int len) throws IOException {
        ByteBuffer bb = link.peekFirst();
        if(bb == null) {
            throw new EndOfBufferException();
        } else if(bb.remaining() < len) {
            return false;
        }
        boolean success = false;
        int pos = bb.position();
        int lim = bb.limit();
View Full Code Here

Examples of java.nio.CharBuffer.remaining()

        CharBuffer cb = CharBuffer.wrap(name);
        ByteBuffer out = ByteBuffer.allocate(name.length()
                                             + (name.length() + 1) / 2);

        while (cb.remaining() > 0) {
            CoderResult res = enc.encode(cb, out,true);

            if (res.isUnmappable() || res.isMalformed()) {

                // write the unmappable characters in utf-16
View Full Code Here

Examples of java.nio.DoubleBuffer.remaining()

        if (buf == null) {
      buf = Buffers.newDirectDoubleBuffer(array.length);
            threadLocal.set(buf);
        } else {
            buf.rewind();
            if (buf.remaining() < array.length) {
                int newSize = Math.max(2 * buf.remaining(), array.length);
        buf = Buffers.newDirectDoubleBuffer(newSize);
                threadLocal.set(buf);
            }
        }
View Full Code Here

Examples of java.nio.FloatBuffer.remaining()

        return getMatrix(GL11.GL_PROJECTION_MATRIX, store);
    }

    private FloatBuffer getMatrix(final int matrixType, final FloatBuffer store) {
        FloatBuffer result = store;
        if (result.remaining() < 16) {
            result = BufferUtils.createFloatBuffer(16);
        }
        GL11.glGetFloat(matrixType, store);
        return result;
    }
View Full Code Here

Examples of java.nio.IntBuffer.remaining()

        buf.put((char) c);
    }

    private void addSeparator() {
        IntBuffer buf = cellBeginPositions;
        if (buf.remaining() == 0) {
            IntBuffer newBuf = IntBuffer.allocate(buf.capacity() * 2);
            newBuf.clear();
            buf.flip();
            newBuf.put(buf);
            buf = newBuf;
View Full Code Here

Examples of java.nio.LongBuffer.remaining()

                    LongBuffer retVal = myBuffer.asReadOnlyBuffer();

                    if (chunkFactor < myBuffer.remaining()) {
                      retVal.limit(retVal.position() + chunkFactor);
                    }
                    myBuffer.position(myBuffer.position() + retVal.remaining());

                    return StupidResourceHolder.create(retVal);
                  }

                  @Override
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.