Package java.nio

Examples of java.nio.DoubleBuffer.limit()


    return direct_buffer;
  }

  private static DoubleBuffer doNoCopyWrap(DoubleBuffer buffer) {
    DoubleBuffer direct_buffer = lookupBuffer(buffer);
    direct_buffer.limit(buffer.limit());
    direct_buffer.position(buffer.position());
    return direct_buffer;
  }

  private static ByteBuffer lookupBuffer(ByteBuffer buffer) {
View Full Code Here


    @Override
    public MutableDoubleArray length(int length) {
        int offset = elements.position();
        subArrayCheck(offset, length);
        DoubleBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new SubBoundedDoubleBufferArrayImpl(this, copy);
    }

    /**
     * Convenience method, combining {@code offset(int)} and {@code length(int)}.
View Full Code Here

        int newOffset = offset + fromIndex;
        int newLength = toIndex - fromIndex;
        subArrayCheck(newOffset, newLength);
        DoubleBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubBoundedDoubleBufferArrayImpl(this, copy);
    }

    /**
     * Tells whether or not the array's content is resident in physical memory.
View Full Code Here

            return this;
        }
        int offset = elements.position();
        subArrayCheck(offset, length);
        DoubleBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new SubMutableDoubleBufferArrayImpl(this, copy);
    }

    /**
     * Convenience method, combining {@code offset(int)} and {@code length(int)}.
View Full Code Here

            return this;
        }
        subArrayCheck(newOffset, newLength);
        DoubleBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new SubMutableDoubleBufferArrayImpl(this, copy);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
    private class ArrayIteratorImpl implements ArrayIterator.OfDouble {
View Full Code Here

            return this;
        }
        int offset = elements.position();
        subArrayCheck(offset, length);
        DoubleBuffer copy = elements.duplicate();
        copy.limit(offset + length);
        return new DoubleBufferArrayImpl(copy, characteristics, false);
    }

    /**
     * Convenience method, combining {@code offset(int)} and {@code length(int)}.
View Full Code Here

            return this;
        }
        subArrayCheck(newOffset, newLength);
        DoubleBuffer copy = elements.duplicate();
        copy.position(newOffset);
        copy.limit(newOffset + newLength);
        return new DoubleBufferArrayImpl(copy, characteristics, false);
    }

    @SuppressWarnings({"MissingMethodJavaDoc", "MissingFieldJavaDoc"})
    private class ArrayIteratorImpl implements ArrayIterator.OfDouble {
View Full Code Here

        // readonly's contents should be the same as buf
        DoubleBuffer readonly = buf.asReadOnlyBuffer();
        assertNotSame(buf, readonly);
        assertTrue(readonly.isReadOnly());
        assertEquals(buf.position(), readonly.position());
        assertEquals(buf.limit(), readonly.limit());
        assertEquals(buf.isDirect(), readonly.isDirect());
        assertEquals(buf.order(), readonly.order());
        assertContentEquals(buf, readonly);

        // readonly's position, mark, and limit should be independent to buf
View Full Code Here

        assertTrue(other.compareTo(buf) < 0);
        other.position(2);
        assertTrue(buf.compareTo(other) < 0);
        assertTrue(other.compareTo(buf) > 0);
        buf.position(2);
        other.limit(5);
        assertTrue(buf.compareTo(other) > 0);
        assertTrue(other.compareTo(buf) < 0);

        DoubleBuffer dbuffer1 = DoubleBuffer.wrap(new double[] { Double.NaN });
        DoubleBuffer dbuffer2 = DoubleBuffer.wrap(new double[] { Double.NaN });
View Full Code Here

        // duplicate's contents should be the same as buf
        DoubleBuffer duplicate = buf.duplicate();
        assertNotSame(buf, duplicate);
        assertEquals(buf.position(), duplicate.position());
        assertEquals(buf.limit(), duplicate.limit());
        assertEquals(buf.isReadOnly(), duplicate.isReadOnly());
        assertEquals(buf.isDirect(), duplicate.isDirect());
        assertEquals(buf.order(), duplicate.order());
        assertContentEquals(buf, duplicate);
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.