Examples of remaining()


Examples of com.google.code.hs4j.network.buffer.IoBuffer.remaining()

    public IoBuffer encode(Object message, Session session) {
      final IoBuffer msgBuffer = (IoBuffer) message;
      if (msgBuffer == null) {
        return null;
      }
      if (msgBuffer.remaining() == 0) {
        return EMPTY_BUFFER;
      }
      byte[] bytes = new byte[msgBuffer.remaining()];
      msgBuffer.get(bytes);
      IoBuffer result = IoBuffer.allocate(bytes.length,
View Full Code Here

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

    @Test
    public void testPutPrefixedString() throws Exception {
        CharsetEncoder encoder;
        IoBuffer buf = IoBuffer.allocate(16);
        buf.fillAndReset(buf.remaining());
        encoder = Charset.forName("ISO-8859-1").newEncoder();

        // Without autoExpand
        buf.putPrefixedString("ABC", encoder);
        assertEquals(5, buf.position());
View Full Code Here

Examples of com.higherfrequencytrading.chronicle.Excerpt.remaining()

                    } else {
                        bb.limit(remaining);
                        excerpt.read(bb);
                        int count = 1;
                        while (excerpt.index(index + 1) && count++ < MAX_MESSAGE) {
                            if (excerpt.remaining() + 4 >= bb.capacity() - bb.position())
                                break;
                            // if there is free space, copy another one.
                            int size2 = excerpt.capacity();
//                            System.out.println("W+ "+size);
                            bb.limit(bb.position() + size2 + 4);
View Full Code Here

Examples of com.jogamp.common.nio.NativeSizeBuffer.remaining()

        if(ret != CL_SUCCESS) {
            throw newException(ret, "on clGetProgramInfo(CL_PROGRAM_BINARY_SIZES) of "+this);
        }

        int binariesSize = 0;
        while(sizes.remaining() != 0) {
            int size = (int) sizes.get();
            binariesSize += size;
        }
        ByteBuffer binaries = newDirectByteBuffer(binariesSize);
View Full Code Here

Examples of com.salesforce.omakase.parser.Source.remaining()

                    atRule.expression(queryList.get());
                }

                // nothing should be left in the expression content
                if (!source.skipWhitepace().eof()) {
                    throw new ParserException(source, String.format(UNABLE_PARSE, source.remaining()));
                }
            }
        } catch (QuickFixException e) {
            throw new ParserException(e);
        }
View Full Code Here

Examples of com.taobao.gecko.core.buffer.IoBuffer.remaining()

        IoBuffer buf = IoBuffer.wrap("put test 1 5 0 10\r\nhel".getBytes());

        PutCommand decodedCmd = (PutCommand) this.decoder.decode(buf, null);
        assertNull(decodedCmd);
        assertEquals(0, buf.position());
        assertEquals(buf.capacity(), buf.remaining());

        buf = IoBuffer.wrap("put test 1 5 0 10\r\nhello".getBytes());
        decodedCmd = (PutCommand) this.decoder.decode(buf, null);
        assertNotNull(decodedCmd);
        assertEquals("test", decodedCmd.getTopic());
View Full Code Here

Examples of java.nio.Buffer.remaining()

         * @throws IOException If an error (including EOF) occurred while reading the stream.
         */
        final void readFully(final int dataSize, int offset, int length) throws IOException {
            ensureBufferContains(Math.min(length * dataSize, buffer.capacity()));
            final Buffer view = createView(); // Must be after ensureBufferContains
            int n = Math.min(view.remaining(), length);
            transfer(offset, n);
            skipInBuffer(n * dataSize);
            while ((length -= n) != 0) {
                offset += n;
                ensureBufferContains(dataSize);
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

            for(;;) {
                int c=in.read();
                if(c == -1 || c == 0)
                    terminate=true;

                if(buf.remaining() == 0 || terminate) {
                    if(body == null) {
                        body=new byte[buf.position()];
                        System.arraycopy(buf.array(), buf.arrayOffset(), body, 0, buf.position());
                    }
                    else {
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

         
          length_buffer.flip();
        }
      }else{
       
        int  rem = payload_buffer.remaining();
        int  lim  = payload_buffer.limit();
       
        if ( rem > read_lim ){
         
          payload_buffer.limit( payload_buffer.position() + read_lim );
View Full Code Here

Examples of java.nio.ByteBuffer.remaining()

   
      GenericMessage  gm = new GenericMessage( msg_id, msg_desc, new DirectByteBuffer( upper_initial_data ), false );
     
      DirectByteBuffer[]  payload = new GenericMessageEncoder().encodeMessage( gm )[0].getRawData();
     
      int  size = initial_data.remaining();
     
      for (int i=0;i<payload.length;i++){
       
        size += payload[i].remaining( DirectByteBuffer.SS_MSG );
      }
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.