Examples of remaining()


Examples of java.nio.MappedByteBuffer.remaining()

    FileInputStream fis = new FileInputStream(infile);
    try{
      FileChannel fc = fis.getChannel(); // Get the file's size and then map it into memory
      int sz = (int)fc.size();
      MappedByteBuffer bb = fc.map(FileChannel.MapMode.READ_ONLY, 0, sz);
      byte[] data2 = new byte[bb.remaining()];
      bb.get(data2);
      return data2;
    }
    finally{//Ensures resources are closed regardless of whether the action suceeded
      fis.close();
View Full Code Here

Examples of java.nio.ShortBuffer.remaining()

        // test BIG_ENDIAN short buffer, read
        buf.clear();
        buf.order(ByteOrder.BIG_ENDIAN);
        shortBuffer = buf.asShortBuffer();
        assertSame(ByteOrder.BIG_ENDIAN, shortBuffer.order());
        while (shortBuffer.remaining() > 0) {
            buf.get(bytes);
            value = shortBuffer.get();
            assertEquals(bytes2short(bytes, buf.order()), value);
        }
View Full Code Here

Examples of juju.reattore.io.ByteSource.remaining()

    private String getBody()
        throws IOException {

        ByteSource body = resp.getBody();
        byte[] ab = new byte[body.remaining()];

        assertEquals(body.remaining(), body.get(ab, 0, ab.length));

        return new String(ab);
    }
View Full Code Here

Examples of net.openhft.lang.io.ByteBufferBytes.remaining()

                            }

                            final ByteBufferBytes bufferBytes = new ByteBufferBytes(ByteBuffer.wrap(item));

                            while (bufferBytes.remaining() > 0) {

                                final long entrySize = bufferBytes.readStopBit();

                                final long position = bufferBytes.position();
                                final long limit = bufferBytes.limit();
View Full Code Here

Examples of net.rubyeye.xmemcached.buffer.IoBuffer.remaining()

    buffer.put("test".getBytes());
    assertEquals(64, buffer.capacity());
    assertEquals(4, buffer.position());
    assertEquals(64, buffer.limit());
    assertEquals(60, buffer.remaining());
    buffer.mark();

    buffer.position(32);
    assertEquals(32, buffer.position());
    buffer.reset();
View Full Code Here

Examples of net.sf.cindy.Buffer.remaining()

            assertEquals(b.length, buffer.position());
            buffer.flip();
            assertEquals(0, buffer.position());
            assertEquals(b.length, buffer.limit());
            assertEquals(b.length, buffer.capacity());
            assertEquals(b.length, buffer.remaining());
            assertTrue(buffer.hasRemaining());
            assertEquals(buffer.asByteBuffer(), ByteBuffer.wrap(b));

            random.nextBytes(b);
            buffer.put(ByteBuffer.wrap(b));
View Full Code Here

Examples of org.activeio.Packet.remaining()

   
    long start = System.currentTimeMillis();
    Packet answer = next.read(location);   
    long end = System.currentTimeMillis();
   
    readBytesCounter.add(answer.remaining());
    readLatency.addTime(end-start);
    return answer;
  }

  /**
 
View Full Code Here

Examples of org.apache.activeio.packet.Packet.remaining()

       
    }

    private void storeState() throws IOException {
        Packet controlData = controlFile.getControlData();
        if( controlData.remaining() == 0 )
            return;
       
        DataOutput data = new DataOutputStream(new PacketOutputStream(controlData));

        data.writeInt(lastLogFileId);
View Full Code Here

Examples of org.apache.archiva.repository.content.maven2.FilenameParser.remaining()

            {
                throw new LayoutException( INVALID_ARTIFACT_PATH + "no artifact id present." );
            }
        }

        artifact.setVersion( parser.remaining() );

        // Sanity Check: does it have a version?
        if ( StringUtils.isEmpty( artifact.getVersion() ) )
        {
            // Special Case: use last section of artifactId as version.
View Full Code Here

Examples of org.apache.hama.bsp.message.io.SpilledByteBuffer.remaining()

      spillBuffer.putInt(i);
      spillBuffer.markEndOfRecord();
    }
    spillBuffer.putInt(100);
    assertEquals(spillBuffer.getMarkofLastRecord(), 400);
    assertEquals(spillBuffer.remaining(), (512 - 404));
    spillBuffer.flip();
    assertEquals(spillBuffer.remaining(), 404);
    assertEquals(spillBuffer.getMarkofLastRecord(), 400);

  }
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.