- All Implemented Interfaces:
Serializable,Comparable<BufferUtils>,Constable
- Author:
- biteytech@protonmail.com
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final BigByteBufferAn empty, read-onlyBigByteBufferwhich hasnative orderstatic final ByteBufferAn empty, read-onlyByteBufferwhich hasnative order -
Method Summary
Modifier and TypeMethodDescriptionstatic ByteBufferallocate(int capacity) Allocates a newByteBufferwith the specified capacity.static ByteBufferAllocates a newByteBufferwith the specified capacity.static BigByteBufferallocateBig(long capacity) Allocates a newBigByteBufferwith the specified capacity.static BigByteBufferallocateBig(long capacity, ByteOrder order) Allocates a newBigByteBufferwith the specified capacity.static ByteBufferCreates a new, read-only byte buffer that shares the specified buffer's content, and preserves it's order.static ByteBuffercopy(ByteBuffer b, int fromIndex, int toIndex) Returns a copy of a range from the specified buffer.static DoubleBuffercopy(DoubleBuffer b, int fromIndex, int toIndex) Returns a copy of a range from the specified buffer.static FloatBuffercopy(FloatBuffer b, int fromIndex, int toIndex) Returns a copy of a range from the specified buffer.static IntBufferReturns a copy of a range from the specified buffer.static LongBuffercopy(LongBuffer b, int fromIndex, int toIndex) Returns a copy of a range from the specified buffer.static ShortBuffercopy(ShortBuffer b, int fromIndex, int toIndex) Returns a copy of a range from the specified buffer.static intdeduplicate(ByteBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedByteBuffer.static intdeduplicate(DoubleBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedDoubleBuffer.static intdeduplicate(FloatBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedFloatBuffer.static intdeduplicate(IntBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedIntBuffer.static intdeduplicate(LongBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedLongBuffer.static intdeduplicate(ShortBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedShortBuffer.static intdeduplicate(SmallByteBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedSmallByteBuffer.static intdeduplicate(SmallDoubleBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedSmallDoubleBuffer.static intdeduplicate(SmallFloatBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedSmallFloatBuffer.static intdeduplicate(SmallIntBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedSmallIntBuffer.static intdeduplicate(SmallLongBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedSmallLongBuffer.static intdeduplicate(SmallShortBuffer b, int fromIndex, int toIndex) Deduplicates a range of the specifiedSmallShortBuffer.static ByteBufferDuplicate aByteBufferand preserve the order.static booleanisSorted(ByteBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(DoubleBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(FloatBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanDetermines if the specified buffer is sorted inside the specified range.static booleanisSorted(LongBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(ShortBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(SmallByteBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(SmallDoubleBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(SmallFloatBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(SmallIntBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(SmallLongBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSorted(SmallShortBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted inside the specified range.static booleanisSortedAndDistinct(ByteBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(DoubleBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(FloatBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(IntBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(LongBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(ShortBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(SmallByteBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(SmallDoubleBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(SmallFloatBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(SmallIntBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(SmallLongBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static booleanisSortedAndDistinct(SmallShortBuffer b, int fromIndex, int toIndex) Determines if the specified buffer is sorted and distinct inside the specified range.static voidreadFully(ReadableByteChannel channel, ByteBuffer buffer) static ByteBufferslice(ByteBuffer b) Slice aByteBufferand preserve the order.static ByteBufferslice(ByteBuffer b, int fromIndex, int toIndex) Slice a range from the specifiedByteBuffer.static DoubleStreamstream(DoubleBuffer buffer) Returns a sequentialDoubleStreamwith the specified buffer as its source.static DoubleStreamstream(DoubleBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialDoubleStreamwith the specified range of the specified buffer as its source.static IntStreamReturns a sequentialIntStreamwith the specified buffer as its source.static IntStreamReturns a sequentialIntStreamwith the specified range of the specified buffer as its source.static LongStreamstream(LongBuffer buffer) Returns a sequentialLongStreamwith the specified buffer as its source.static LongStreamstream(LongBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialLongStreamwith the specified range of the specified buffer as its source.static DoubleStreamstream(SmallDoubleBuffer buffer) Returns a sequentialDoubleStreamwith the specified buffer as its source.static DoubleStreamstream(SmallDoubleBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialDoubleStreamwith the specified range of the specified buffer as its source.static IntStreamstream(SmallIntBuffer buffer) Returns a sequentialIntStreamwith the specified buffer as its source.static IntStreamstream(SmallIntBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialIntStreamwith the specified range of the specified buffer as its source.static LongStreamstream(SmallLongBuffer buffer) Returns a sequentialLongStreamwith the specified buffer as its source.static LongStreamstream(SmallLongBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialLongStreamwith the specified range of the specified buffer as its source.static BufferUtilsReturns the enum constant of this class with the specified name.static BufferUtils[]values()Returns an array containing the constants of this enum class, in the order they are declared.static BigByteBufferwrap(ByteBuffer[] buffers) Returns a newBigByteBufferbacked by the specifiedByteBuffers.static voidwriteFully(WritableByteChannel channel, ByteBuffer buffer)
-
Field Details
-
EMPTY_BUFFER
An empty, read-onlyByteBufferwhich hasnative order -
EMPTY_BIG_BUFFER
An empty, read-onlyBigByteBufferwhich hasnative order
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
allocate
Allocates a newByteBufferwith the specified capacity. The buffer will be direct if thetech.bitey.allocateDirectsystem property is set to "true", and will havenative order.- Parameters:
capacity- the new buffer's capacity, in bytes- Returns:
- the new native order
ByteBuffer
-
allocate
Allocates a newByteBufferwith the specified capacity. The buffer will be direct if thetech.bitey.allocateDirectsystem property is set to "true", and will have the specifiedByteOrder.- Parameters:
capacity- the new buffer's capacity, in bytesorder- theByteOrder- Returns:
- the new
ByteBuffer
-
allocateBig
Allocates a newBigByteBufferwith the specified capacity. The buffer will be direct if thetech.bitey.allocateDirectsystem property is set to "true", and will havenative order.- Parameters:
capacity- the new buffer's capacity, in bytes- Returns:
- the new native order
BigByteBuffer
-
allocateBig
Allocates a newBigByteBufferwith the specified capacity. The buffer will be direct if thetech.bitey.allocateDirectsystem property is set to "true", and will have the specifiedByteOrder.- Parameters:
capacity- the new buffer's capacity, in bytesorder- theByteOrder- Returns:
- the new
BigByteBuffer
-
wrap
Returns a newBigByteBufferbacked by the specifiedByteBuffers.- Returns:
- a new
BigByteBufferbacked by the specifiedByteBuffer ByteBuffers.
-
duplicate
Duplicate aByteBufferand preserve the order. Equivalent to:b.duplicate().order(b.order())
- Parameters:
b- - the buffer to be duplicated- Returns:
- duplicated buffer with order preserved
- See Also:
-
slice
Slice aByteBufferand preserve the order. Equivalent to:b.slice().order(b.order())
- Parameters:
b- - the buffer to be sliced- Returns:
- sliced buffer with order preserved
- See Also:
-
asReadOnlyBuffer
Creates a new, read-only byte buffer that shares the specified buffer's content, and preserves it's order. Equivalent to:b.asReadOnlyBuffer().order(b.order())
- Parameters:
b- - the buffer to be made read-only- Returns:
- read-only byte buffer that shares the specified buffer's content
- See Also:
-
slice
Slice a range from the specifiedByteBuffer. The buffer's order is preserved.- Parameters:
b- - the buffer to be slicedfromIndex- - the index of the first element in the range (inclusive)toIndex- - the index of the last element in the range (exclusive)- Returns:
- sliced buffer with order preserved
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()- See Also:
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
copy
Returns a copy of a range from the specified buffer. The new buffer will be direct iff the specified buffer is direct, and will have the same byte order. The capacity will be equal to the size of the specified range. The limit will be set to the capacity, and the position will be set to zero.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- a copy of a range of data from the specified buffer
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
copy
Returns a copy of a range from the specified buffer. The new buffer will be direct iff the specified buffer is direct, and will have the same byte order. The capacity will be equal to the size of the specified range. The limit will be set to the capacity, and the position will be set to zero.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- a copy of a range of data from the specified buffer
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
copy
Returns a copy of a range from the specified buffer. The new buffer will be direct iff the specified buffer is direct, and will have the same byte order. The capacity will be equal to the size of the specified range. The limit will be set to the capacity, and the position will be set to zero.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- a copy of a range of data from the specified buffer
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
copy
Returns a copy of a range from the specified buffer. The new buffer will be direct iff the specified buffer is direct, and will have the same byte order. The capacity will be equal to the size of the specified range. The limit will be set to the capacity, and the position will be set to zero.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- a copy of a range of data from the specified buffer
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
copy
Returns a copy of a range from the specified buffer. The new buffer will be direct iff the specified buffer is direct, and will have the same byte order. The capacity will be equal to the size of the specified range. The limit will be set to the capacity, and the position will be set to zero.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- a copy of a range of data from the specified buffer
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
copy
Returns a copy of a range from the specified buffer. The new buffer will be direct iff the specified buffer is direct, and will have the same byte order. The capacity will be equal to the size of the specified range. The limit will be set to the capacity, and the position will be set to zero.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- a copy of a range of data from the specified buffer
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedIntBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedLongBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedShortBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedByteBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedFloatBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedDoubleBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
stream
Returns a sequentialIntStreamwith the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during use- Returns:
- an
IntStreamfor the buffer
-
stream
public static IntStream stream(IntBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialIntStreamwith the specified range of the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during usestartInclusive- the first index to cover, inclusiveendExclusive- index immediately past the last index to covercharacteristics- characteristics of this spliterator's source or elements beyondSIZED,SUBSIZED,ORDERED,NONNULL, andIMMUTABLE, which are are always reported- Returns:
- an
IntStreamfor the buffer range - Throws:
ArrayIndexOutOfBoundsException- ifstartInclusiveis negative,endExclusiveis less thanstartInclusive, orendExclusiveis greater than the buffer'scapacity
-
stream
Returns a sequentialLongStreamwith the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during use- Returns:
- an
LongStreamfor the buffer
-
stream
public static LongStream stream(LongBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialLongStreamwith the specified range of the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during usestartInclusive- the first index to cover, inclusiveendExclusive- index immediately past the last index to covercharacteristics- characteristics of this spliterator's source or elements beyondSIZED,SUBSIZED,ORDERED,NONNULL, andIMMUTABLE, which are are always reported- Returns:
- an
LongStreamfor the buffer range - Throws:
ArrayIndexOutOfBoundsException- ifstartInclusiveis negative,endExclusiveis less thanstartInclusive, orendExclusiveis greater than the buffer'scapacity
-
stream
Returns a sequentialDoubleStreamwith the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during use- Returns:
- an
DoubleStreamfor the buffer
-
stream
public static DoubleStream stream(DoubleBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialDoubleStreamwith the specified range of the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during usestartInclusive- the first index to cover, inclusiveendExclusive- index immediately past the last index to covercharacteristics- characteristics of this spliterator's source or elements beyondSIZED,SUBSIZED,ORDERED,NONNULL, andIMMUTABLE, which are are always reported- Returns:
- an
DoubleStreamfor the buffer range - Throws:
ArrayIndexOutOfBoundsException- ifstartInclusiveis negative,endExclusiveis less thanstartInclusive, orendExclusiveis greater than the buffer'scapacity
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSorted
Determines if the specified buffer is sorted inside the specified range. That is:buffer[i] <= buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
isSortedAndDistinct
Determines if the specified buffer is sorted and distinct inside the specified range. That is:buffer[i] < buffer[i + 1]for all elements in the range. A range of length zero or one is considered sorted and distinct.- Parameters:
b- - the buffer to be checkedfromIndex- - the index of the first element (inclusive) to be checkedtoIndex- - the index of the last element (exclusive) to be checked- Returns:
- true if the buffer is sorted and distinct inside the specified range
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedSmallIntBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedSmallLongBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedSmallShortBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedSmallByteBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedSmallFloatBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
deduplicate
Deduplicates a range of the specifiedSmallDoubleBuffer. The range must be sorted in ascending order prior to making this call. If it is not sorted, the results are undefined.This method is useful as a post-processing step after a sort on a buffer which contains duplicate elements.
- Parameters:
b- the buffer to be deduplicatedfromIndex- - the index of the first element (inclusive) to be deduplicatedtoIndex- - the index of the last element (exclusive) to be deduplicated- Returns:
- the (exclusive) highest index in use after deduplicating
- Throws:
IllegalArgumentException- iffromIndex > toIndexIndexOutOfBoundsException- iffromIndex < 0 or toIndex > b.capacity()
-
stream
Returns a sequentialIntStreamwith the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during use- Returns:
- an
IntStreamfor the buffer
-
stream
public static IntStream stream(SmallIntBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialIntStreamwith the specified range of the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during usestartInclusive- the first index to cover, inclusiveendExclusive- index immediately past the last index to covercharacteristics- characteristics of this spliterator's source or elements beyondSIZED,SUBSIZED,ORDERED,NONNULL, andIMMUTABLE, which are are always reported- Returns:
- an
IntStreamfor the buffer range - Throws:
ArrayIndexOutOfBoundsException- ifstartInclusiveis negative,endExclusiveis less thanstartInclusive, orendExclusiveis greater than the buffer'scapacity
-
stream
Returns a sequentialLongStreamwith the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during use- Returns:
- an
LongStreamfor the buffer
-
stream
public static LongStream stream(SmallLongBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialLongStreamwith the specified range of the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during usestartInclusive- the first index to cover, inclusiveendExclusive- index immediately past the last index to covercharacteristics- characteristics of this spliterator's source or elements beyondSIZED,SUBSIZED,ORDERED,NONNULL, andIMMUTABLE, which are are always reported- Returns:
- an
LongStreamfor the buffer range - Throws:
ArrayIndexOutOfBoundsException- ifstartInclusiveis negative,endExclusiveis less thanstartInclusive, orendExclusiveis greater than the buffer'scapacity
-
stream
Returns a sequentialDoubleStreamwith the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during use- Returns:
- an
DoubleStreamfor the buffer
-
stream
public static DoubleStream stream(SmallDoubleBuffer buffer, int startInclusive, int endExclusive, int characteristics) Returns a sequentialDoubleStreamwith the specified range of the specified buffer as its source.- Parameters:
buffer- the buffer, assumed to be unmodified during usestartInclusive- the first index to cover, inclusiveendExclusive- index immediately past the last index to covercharacteristics- characteristics of this spliterator's source or elements beyondSIZED,SUBSIZED,ORDERED,NONNULL, andIMMUTABLE, which are are always reported- Returns:
- an
DoubleStreamfor the buffer range - Throws:
ArrayIndexOutOfBoundsException- ifstartInclusiveis negative,endExclusiveis less thanstartInclusive, orendExclusiveis greater than the buffer'scapacity
-
writeFully
- Parameters:
channel- - the channel being written tobuffer- - the buffer being read from- Throws:
IOException
-
readFully
- Parameters:
channel- - the channel being read frombuffer- - the buffer being written to- Throws:
IOException
-