Package java.nio

Examples of java.nio.LongBuffer.position()


    }

    @Test
    public void testAddAllNoBackingArray3() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 11).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        try {
            notBackedByArray.addAll(LongArray.unsafeValueOf((long) 5, (long) 5, (long) 5));
            fail();
View Full Code Here


    }

    @Test
    public void testAddAllNoBackingArray0() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 10).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(LongArray.unsafeValueOf());
        assertEquals(8, notBackedByArray.length());
        assertArrayEquals(new long[]{1, 1, 2, 1, 2, 3, 3, 4}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray1() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 11).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(LongArray.unsafeValueOf((long) 5));
        assertEquals(9, notBackedByArray.length());
        assertArrayEquals(new long[]{1, 1, 2, 1, 2, 3, 3, 4, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray2() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 11).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        notBackedByArray.addAll(LongArray.unsafeValueOf((long) 5, (long) 5));
        assertEquals(10, notBackedByArray.length());
        assertArrayEquals(new long[]{1, 1, 2, 1, 2, 3, 3, 4, 5, 5}, notBackedByArray.toArray());
View Full Code Here

    }

    @Test
    public void testAddAllNoBackingArray3() throws Exception {
        LongBuffer buffer = ByteBuffer.allocateDirect(Long.SIZE / Byte.SIZE * 11).asLongBuffer();
        buffer.position(1).limit(9);
        BoundedLongArray notBackedByArray = BoundedLongArray.valueOf(buffer);
        notBackedByArray.setAll(array);
        try {
            notBackedByArray.addAll(LongArray.unsafeValueOf((long) 5, (long) 5, (long) 5));
            fail();
View Full Code Here

        }
        int newOffset = elements.position() + offset;
        int newLength = elements.remaining() - offset;
        subArrayCheck(newOffset, newLength);
        LongBuffer copy = elements.duplicate();
        copy.position(newOffset);
        return new LongBufferArrayImpl(copy, characteristics, false);
    }

    /**
     * <p>Returns a new sub array object for the specified {@code length}. Note that {@code length} must be smaller than
View Full Code Here

        if (newOffset == offset && newLength == length) {
            return this;
        }
        subArrayCheck(newOffset, newLength);
        LongBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new LongBufferArrayImpl(copy, characteristics, false);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
View Full Code Here

        }
        int newOffset = elements.position() + offset;
        int newLength = elements.remaining() - offset;
        subArrayCheck(newOffset, newLength);
        LongBuffer copy = elements.duplicate();
        copy.position(newOffset);
        return new SubMutableLongBufferArrayImpl(this, copy);
    }

    /**
     * <p>Returns a new sub array object for the specified {@code length}. Note that {@code length} must be smaller than
View Full Code Here

        if (newOffset == offset && newLength == length) {
            return this;
        }
        subArrayCheck(newOffset, newLength);
        LongBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubMutableLongBufferArrayImpl(this, copy);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
View Full Code Here

    public BoundedLongArray offset(int offset) {
        int newOffset = elements.position() + offset;
        int newLength = elements.remaining() - offset;
        subArrayCheck(newOffset, newLength);
        LongBuffer copy = elements.duplicate();
        copy.position(newOffset);
        return new SubBoundedLongBufferArrayImpl(this, copy);
    }

    /**
     * <p>Returns a new sub array object for the specified {@code length}. Note that {@code length} must be smaller than
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.