Package java.nio

Examples of java.nio.IntBuffer.remaining()


        // test BIG_ENDIAN int buffer, read
        buf.clear();
        buf.order(ByteOrder.BIG_ENDIAN);
        intBuffer = buf.asIntBuffer();
        assertSame(ByteOrder.BIG_ENDIAN, intBuffer.order());
        while (intBuffer.remaining() > 0) {
            buf.get(bytes);
            value = intBuffer.get();
            assertEquals(bytes2int(bytes, buf.order()), value);
        }
View Full Code Here


        // test LITTLE_ENDIAN int buffer, read
        buf.clear();
        buf.order(ByteOrder.LITTLE_ENDIAN);
        intBuffer = buf.asIntBuffer();
        assertSame(ByteOrder.LITTLE_ENDIAN, intBuffer.order());
        while (intBuffer.remaining() > 0) {
            buf.get(bytes);
            value = intBuffer.get();
            assertEquals(bytes2int(bytes, buf.order()), value);
        }
View Full Code Here

            // test BIG_ENDIAN int buffer, write
            buf.clear();
            buf.order(ByteOrder.BIG_ENDIAN);
            intBuffer = buf.asIntBuffer();
            assertSame(ByteOrder.BIG_ENDIAN, intBuffer.order());
            while (intBuffer.remaining() > 0) {
                value = (int) intBuffer.remaining();
                intBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, int2bytes(value, buf.order())));
            }
View Full Code Here

            buf.clear();
            buf.order(ByteOrder.BIG_ENDIAN);
            intBuffer = buf.asIntBuffer();
            assertSame(ByteOrder.BIG_ENDIAN, intBuffer.order());
            while (intBuffer.remaining() > 0) {
                value = (int) intBuffer.remaining();
                intBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, int2bytes(value, buf.order())));
            }
View Full Code Here

            // test LITTLE_ENDIAN int buffer, write
            buf.clear();
            buf.order(ByteOrder.LITTLE_ENDIAN);
            intBuffer = buf.asIntBuffer();
            assertSame(ByteOrder.LITTLE_ENDIAN, intBuffer.order());
            while (intBuffer.remaining() > 0) {
                value = (int) intBuffer.remaining();
                intBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, int2bytes(value, buf.order())));
            }
View Full Code Here

            buf.clear();
            buf.order(ByteOrder.LITTLE_ENDIAN);
            intBuffer = buf.asIntBuffer();
            assertSame(ByteOrder.LITTLE_ENDIAN, intBuffer.order());
            while (intBuffer.remaining() > 0) {
                value = (int) intBuffer.remaining();
                intBuffer.put(value);
                buf.get(bytes);
                assertTrue(Arrays.equals(bytes, int2bytes(value, buf.order())));
            }
        }
View Full Code Here

        // compare remaining size with estimated size
        final int Np = 384;
        final int chunk = columns * rows;
        int size = 8 * chunk + Np * 10;
        if (size != ib.remaining()) {
            updateStatus("size of input data not correct, will stop");
            return;
        }

        // read all chunks into different arrays
View Full Code Here

                    while (input.read(buffer) > 0) {
                        ;
                    }
                    buffer.flip();
                    IntBuffer ibuffer = buffer.asIntBuffer();
                    int ibuffRemain = Math.min(ibuffer.remaining(), countIDs);
                    ibuffer.get(streams, 0, ibuffRemain);
                    for (int i = 0; i < ibuffRemain; i++) {
                        if (streams[i] == meta.streamID) {
                            offsetFound = offset + i + 1;
                            //TODO break and seek ahead based on countIDs
View Full Code Here

        // Loop until all ints have been put.
        do {
            // Determine number of ints to put.
            int numToPut = Math.min(len - numPut,
                                    viewBuffer.remaining());

            // If no ints to put, the buffer has to be full as len
            // is always greater than numPut so flush it and return
            // to start of loop.
            if(numToPut == 0) {
View Full Code Here

                    while (input.read(buffer) > 0) {
                        ;
                    }
                    buffer.flip();
                    IntBuffer ibuffer = buffer.asIntBuffer();
                    int ibuffRemain = Math.min(ibuffer.remaining(), countIDs);
                    ibuffer.get(streams, 0, ibuffRemain);
                    for (int i = 0; i < ibuffRemain; i++) {
                        if (streams[i] == meta.streamID) {
                            offsetFound = offset + i + 1;
                            //TODO break and seek ahead based on countIDs
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.