You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2022/12/09 02:34:16 UTC
[datasketches-memory] branch IntegrateJava17_v2 updated: Interim 2 Reorganizing methods to identify API changes between 8 and 17
This is an automated email from the ASF dual-hosted git repository.
leerho pushed a commit to branch IntegrateJava17_v2
in repository https://gitbox.apache.org/repos/asf/datasketches-memory.git
The following commit(s) were added to refs/heads/IntegrateJava17_v2 by this push:
new 1065b5c Interim 2 Reorganizing methods to identify API changes between 8 and 17
1065b5c is described below
commit 1065b5c725137e7a33f041ee6f0e3353c58ed93b
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Thu Dec 8 18:34:03 2022 -0800
Interim 2 Reorganizing methods to identify API changes between 8 and 17
---
.../org/apache/datasketches/memory/BaseState.java | 185 +++++++--------
.../org/apache/datasketches/memory/BaseState.java | 262 +++++++++++----------
.../org/apache/datasketches/memory/Buffer.java | 2 +-
.../memory/DefaultMemoryRequestServer.java | 2 +-
.../apache/datasketches/memory/MurmurHash3v2.java | 1 +
.../apache/datasketches/memory/WritableMemory.java | 4 +-
.../memory/internal/BaseStateImpl.java | 9 +-
.../memory/internal/BaseWritableBufferImpl.java | 8 +-
.../internal/AllocateDirectMapMemoryTest.java | 1 +
.../memory/internal/AllocateDirectMemoryTest.java | 1 +
.../AllocateDirectWritableMapMemoryTest.java | 1 +
.../memory/internal/BaseStateTest.java | 1 +
.../datasketches/memory/internal/Buffer2Test.java | 3 +-
.../datasketches/memory/internal/BufferTest.java | 2 +-
.../memory/internal/DruidIssue11544Test.java | 1 +
.../internal/ExampleMemoryRequestServerTest.java | 3 +-
.../datasketches/memory/internal/LeafImplTest.java | 17 +-
.../datasketches/memory/internal/MemoryTest.java | 5 +-
.../internal/NativeWritableBufferImplTest.java | 9 +-
.../internal/NativeWritableMemoryImplTest.java | 1 +
.../internal/NonNativeWritableBufferImplTest.java | 8 +-
.../internal/NonNativeWritableMemoryImplTest.java | 4 +-
.../memory/internal/WritableMemoryTest.java | 14 +-
23 files changed, 290 insertions(+), 254 deletions(-)
diff --git a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/BaseState.java b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/BaseState.java
index b9d85b9..ef5d4f8 100644
--- a/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/BaseState.java
+++ b/datasketches-memory-java17/src/main/java17/org/apache/datasketches/memory/BaseState.java
@@ -38,28 +38,6 @@ public interface BaseState {
*/
static final MemoryRequestServer defaultMemReqSvr = new DefaultMemoryRequestServer();
- /**
- * Returns a ByteBuffer view of this Memory object with the given ByteOrder.
- * Some of the properties of the returned buffer are linked to the properties of this Memory object.
- * For instance, if this Memory object is immutable (i.e., read-only, see isReadOnly()),
- * then the resulting buffer is read-only (see Buffer.isReadOnly().
- * Additionally, if this is a native memory segment, the resulting buffer is direct
- * (see ByteBuffer.isDirect()). The endianness of the returned buffer will be set to
- * the given ByteOrder.
- * @param order the given ByteOrder.
- * @return a ByteBuffer view of this Memory object with the given ByteOrder.
- * @throws UnsupportedOperationException - if this segment cannot be mapped onto a ByteBuffer instance,
- * e.g. because it models an heap-based segment that is not based on a byte[]),
- * or if its size is greater than Integer.MAX_VALUE.
- */
- ByteBuffer asByteBufferView(ByteOrder order);
-
- /**
- * For off-heap segments, this closes the controlling ResourceScope. If the segment is
- * not off-heap, this does nothing.
- */
- void close();
-
/**
* Returns true if the given object is an instance of this class and has equal contents to
* this object.
@@ -84,13 +62,6 @@ public interface BaseState {
*/
boolean equalTo(long thisOffsetBytes, BaseState that, long thatOffsetBytes, long lengthBytes);
- /**
- * Forces any changes made to the contents of this mapped segment to be written to the storage device described
- * by the mapped segment's file descriptor. Please refer to
- * <a href="https://docs.oracle.com/en/java/javase/17/docs/api/jdk.incubator.foreign/jdk/incubator/foreign/MemorySegment.html#force()">force()</a>
- */
- void force();
-
/**
* Gets the current Type ByteOrder.
* This may be different from the ByteOrder of the backing resource and of the Native Byte Order.
@@ -104,11 +75,6 @@ public interface BaseState {
*/
long getCapacity();
- /**
- * Returns the configured MemoryRequestSever or null, if it has not been configured.
- * @return the configured MemoryRequestSever or null, if it has not been configured.
- */
- MemoryRequestServer getMemoryRequestServer();
/**
* Returns true if this Memory is backed by a ByteBuffer.
@@ -116,6 +82,99 @@ public interface BaseState {
*/
boolean hasByteBuffer();
+ /**
+ * Returns true if the Native ByteOrder is the same as the ByteOrder of the
+ * current Buffer or Memory and the same ByteOrder as the given byteOrder.
+ * @param byteOrder the given ByteOrder
+ * @return true if the Native ByteOrder is the same as the ByteOrder of the
+ * current Buffer or Memory and the same ByteOrder as the given byteOrder.
+ */
+ boolean isByteOrderCompatible(ByteOrder byteOrder);
+
+ /**
+ * Returns true if the backing resource is direct (off-heap) memory.
+ * This can be true for allocated direct memory, memory mapped files,
+ * or from a wrapped ByteBuffer that was allocated direct.
+ * @return true if the backing resource is direct (off-heap) memory.
+ */
+ boolean isDirect();
+
+ /**
+ * Returns true if this object or the backing resource is read-only.
+ * @return true if this object or the backing resource is read-only.
+ */
+ boolean isReadOnly();
+
+ /**
+ * Returns a description of this object with an optional formatted hex string of the data
+ * for the specified a range. Used primarily for testing.
+ * @param comment a description
+ * @param offsetBytes offset bytes relative to this object start
+ * @param lengthBytes number of bytes to convert to a hex string
+ * @param withData include output listing of byte data in the given range
+ * @return a description and hex output in a human readable format.
+ */
+ String toHexString(String comment, long offsetBytes, int lengthBytes, boolean withData);
+
+ /**
+ * Returns a 64-bit hash from a single long. This method has been optimized for speed when only
+ * a single hash of a long is required.
+ * @param in A long.
+ * @param seed A long valued seed.
+ * @return the hash.
+ */
+ long xxHash64(long in, long seed);
+
+ /**
+ * Returns the 64-bit hash of the sequence of bytes in this object specified by
+ * <i>offsetBytes</i>, <i>lengthBytes</i> and a <i>seed</i>. Note that the sequence of bytes is
+ * always processed in the same order independent of endianness.
+ *
+ * @param offsetBytes the given offset in bytes to the first byte of the byte sequence.
+ * @param lengthBytes the given length in bytes of the byte sequence.
+ * @param seed the given long seed.
+ * @return the 64-bit hash of the sequence of bytes in this object specified by
+ * <i>offsetBytes</i> and <i>lengthBytes</i>.
+ */
+ long xxHash64(long offsetBytes, long lengthBytes, long seed);
+
+ //NEW HERE WITH JAVA 17
+
+ /**
+ * Returns a ByteBuffer view of this Memory object with the given ByteOrder.
+ * Some of the properties of the returned buffer are linked to the properties of this Memory object.
+ * For instance, if this Memory object is immutable (i.e., read-only, see isReadOnly()),
+ * then the resulting buffer is read-only (see Buffer.isReadOnly().
+ * Additionally, if this is a native memory segment, the resulting buffer is direct
+ * (see ByteBuffer.isDirect()). The endianness of the returned buffer will be set to
+ * the given ByteOrder.
+ * @param order the given ByteOrder.
+ * @return a ByteBuffer view of this Memory object with the given ByteOrder.
+ * @throws UnsupportedOperationException - if this segment cannot be mapped onto a ByteBuffer instance,
+ * e.g. because it models an heap-based segment that is not based on a byte[]),
+ * or if its size is greater than Integer.MAX_VALUE.
+ */
+ ByteBuffer asByteBufferView(ByteOrder order);
+
+ /**
+ * For off-heap segments, this closes the controlling ResourceScope. If the segment is
+ * not off-heap, this does nothing.
+ */
+ void close();
+
+ /**
+ * Forces any changes made to the contents of this mapped segment to be written to the storage device described
+ * by the mapped segment's file descriptor. Please refer to
+ * <a href="https://docs.oracle.com/en/java/javase/17/docs/api/jdk.incubator.foreign/jdk/incubator/foreign/MemorySegment.html#force()">force()</a>
+ */
+ void force();
+
+ /**
+ * Returns the configured MemoryRequestSever or null, if it has not been configured.
+ * @return the configured MemoryRequestSever or null, if it has not been configured.
+ */
+ MemoryRequestServer getMemoryRequestServer();
+
/**
* Returns true if the MemoryRequestServer has been configured.
* @return true if the MemoryRequestServer has been configured.
@@ -134,23 +193,6 @@ public interface BaseState {
*/
boolean isBuffer();
- /**
- * Returns true if the Native ByteOrder is the same as the ByteOrder of the
- * current Buffer or Memory and the same ByteOrder as the given byteOrder.
- * @param byteOrder the given ByteOrder
- * @return true if the Native ByteOrder is the same as the ByteOrder of the
- * current Buffer or Memory and the same ByteOrder as the given byteOrder.
- */
- boolean isByteOrderCompatible(ByteOrder byteOrder);
-
- /**
- * Returns true if the backing resource is direct (off-heap) memory.
- * This can be true for allocated direct memory, memory mapped files,
- * or from a wrapped ByteBuffer that was allocated direct.
- * @return true if the backing resource is direct (off-heap) memory.
- */
- boolean isDirect();
-
/**
* Returns true if this instance is a duplicate of a Buffer instance.
* @return true if this instance is a duplicate of a Buffer instance.
@@ -184,12 +226,6 @@ public interface BaseState {
*/
boolean isMemory();
- /**
- * Returns true if this object or the backing resource is read-only.
- * @return true if this object or the backing resource is read-only.
- */
- boolean isReadOnly();
-
/**
* Returns true if this instance is a region view of another Memory or Buffer
* @return true if this instance is a region view of another Memory or Buffer
@@ -243,17 +279,6 @@ public interface BaseState {
*/
ByteBuffer toByteBuffer(ByteOrder order);
- /**
- * Returns a description of this object with an optional formatted hex string of the data
- * for the specified a range. Used primarily for testing.
- * @param comment a description
- * @param offsetBytes offset bytes relative to this object start
- * @param lengthBytes number of bytes to convert to a hex string
- * @param withData include output listing of byte data in the given range
- * @return a description and hex output in a human readable format.
- */
- String toHexString(String comment, long offsetBytes, int lengthBytes, boolean withData);
-
/**
* Returns a copy of the underlying MemorySegment.
* The size is limited to <i>Integer.MAX_VALUE</i>.
@@ -267,28 +292,4 @@ public interface BaseState {
*/
void unload();
- /**
- * Returns a 64-bit hash from a single long. This method has been optimized for speed when only
- * a single hash of a long is required.
- * @param in A long.
- * @param seed A long valued seed.
- * @return the hash.
- */
- long xxHash64(long in, long seed);
-
- //TO STRING
-
- /**
- * Returns the 64-bit hash of the sequence of bytes in this object specified by
- * <i>offsetBytes</i>, <i>lengthBytes</i> and a <i>seed</i>. Note that the sequence of bytes is
- * always processed in the same order independent of endianness.
- *
- * @param offsetBytes the given offset in bytes to the first byte of the byte sequence.
- * @param lengthBytes the given length in bytes of the byte sequence.
- * @param seed the given long seed.
- * @return the 64-bit hash of the sequence of bytes in this object specified by
- * <i>offsetBytes</i> and <i>lengthBytes</i>.
- */
- long xxHash64(long offsetBytes, long lengthBytes, long seed);
-
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java
index 6dad6a4..4f6a376 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/BaseState.java
@@ -23,7 +23,6 @@ import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import org.apache.datasketches.memory.internal.BaseStateImpl;
-// intentional blank
/**
* Keeps key configuration state for Memory and Buffer plus some common static variables
@@ -38,55 +37,6 @@ public interface BaseState {
*/
static final MemoryRequestServer defaultMemReqSvr = null; //new DefaultMemoryRequestServer();
- /**
- * Gets the current size of active direct memory allocated.
- * @return the current size of active direct memory allocated.
- * @deprecated no longer supported
- */
- @Deprecated
- static long getCurrentDirectMemoryAllocated() {
- return BaseStateImpl.getCurrentDirectMemoryAllocated();
- }
-
- /**
- * Gets the current number of active direct memory allocations.
- * @return the current number of active direct memory allocations.
- * @deprecated no longer supported
- */
- @Deprecated
- static long getCurrentDirectMemoryAllocations() {
- return BaseStateImpl.getCurrentDirectMemoryAllocations();
- }
-
- /**
- * Gets the current size of active direct memory map allocated.
- * @return the current size of active direct memory map allocated.
- * @deprecated no longer supported
- */
- @Deprecated
- static long getCurrentDirectMemoryMapAllocated() {
- return BaseStateImpl.getCurrentDirectMemoryMapAllocated();
- }
-
- /**
- * Gets the current number of active direct memory map allocations.
- * @return the current number of active direct memory map allocations.
- * @deprecated no longer supported
- */
- @Deprecated
- static long getCurrentDirectMemoryMapAllocations() {
- return BaseStateImpl.getCurrentDirectMemoryMapAllocations();
- }
-
- /**
- * Checks that the specified range of bytes is within bounds of this object, throws
- * {@link IllegalArgumentException} if it's not: i. e. if offsetBytes < 0, or length < 0,
- * or offsetBytes + length > {@link #getCapacity()}.
- * @param offsetBytes the given offset in bytes of this object
- * @param lengthBytes the given length in bytes of this object
- */
- void checkValidAndBounds(long offsetBytes, long lengthBytes);
-
/**
* Returns true if the given object is an instance of this class and has equal contents to
* this object.
@@ -111,10 +61,11 @@ public interface BaseState {
boolean equalTo(long thisOffsetBytes, BaseState that, long thatOffsetBytes, long lengthBytes);
/**
- * Gets the backing ByteBuffer if it exists, otherwise returns null.
- * @return the backing ByteBuffer if it exists, otherwise returns null.
+ * Gets the current Type ByteOrder.
+ * This may be different from the ByteOrder of the backing resource and of the Native Byte Order.
+ * @return the current Type ByteOrder.
*/
- ByteBuffer getByteBuffer();
+ ByteOrder getByteOrder();
/**
* Gets the capacity of this object in bytes
@@ -122,13 +73,97 @@ public interface BaseState {
*/
long getCapacity();
+ /**
+ * Returns true if this Memory is backed by a ByteBuffer.
+ * @return true if this Memory is backed by a ByteBuffer.
+ */
+ boolean hasByteBuffer();
+
+ /**
+ * Returns true if the Native ByteOrder is the same as the ByteOrder of the
+ * current Buffer or Memory and the same ByteOrder as the given byteOrder.
+ * @param byteOrder the given ByteOrder
+ * @return true if the Native ByteOrder is the same as the ByteOrder of the
+ * current Buffer or Memory and the same ByteOrder as the given byteOrder.
+ */
+ boolean isByteOrderCompatible(ByteOrder byteOrder);
+
+ /**
+ * Returns true if the backing resource is direct (off-heap) memory.
+ * This is the case for allocated direct memory, memory mapped files,
+ * @return true if the backing resource is direct (off-heap) memory.
+ */
+ boolean isDirect();
+
+ /**
+ * Returns true if this object or the backing resource is read-only.
+ * @return true if this object or the backing resource is read-only.
+ */
+ boolean isReadOnly();
+
+ /**
+ * Returns a formatted hex string of a range of this object.
+ * Used primarily for testing.
+ * @param header a descriptive header
+ * @param offsetBytes offset bytes relative to this object start
+ * @param lengthBytes number of bytes to convert to a hex string
+ * @return a formatted hex string in a human readable array
+ */
+ String toHexString(String header, long offsetBytes, int lengthBytes);
+
+ /**
+ * Returns a 64-bit hash from a single long. This method has been optimized for speed when only
+ * a single hash of a long is required.
+ * @param in A long.
+ * @param seed A long valued seed.
+ * @return the hash.
+ */
+ long xxHash64(long in, long seed);
+
+ /**
+ * Returns the 64-bit hash of the sequence of bytes in this object specified by
+ * <i>offsetBytes</i>, <i>lengthBytes</i> and a <i>seed</i>. Note that the sequence of bytes is
+ * always processed in the same order independent of endianness.
+ *
+ * @param offsetBytes the given offset in bytes to the first byte of the byte sequence.
+ * @param lengthBytes the given length in bytes of the byte sequence.
+ * @param seed the given long seed.
+ * @return the 64-bit hash of the sequence of bytes in this object specified by
+ * <i>offsetBytes</i> and <i>lengthBytes</i>.
+ */
+ long xxHash64(long offsetBytes, long lengthBytes, long seed);
+
+ //DEPRECATED. DOES NOT EXIST FOR JAVA 17+ VERSIONS
+
+ /**
+ * Checks that the specified range of bytes is within bounds of this object, throws
+ * {@link IllegalArgumentException} if it's not: i. e. if offsetBytes < 0, or length < 0,
+ * or offsetBytes + length > {@link #getCapacity()}.
+ * @param offsetBytes the given offset in bytes of this object
+ * @param lengthBytes the given length in bytes of this object
+ * @deprecated no longer supported for Java 17 versions.
+ */
+ @Deprecated
+ void checkValidAndBounds(long offsetBytes, long lengthBytes);
+
+ /**
+ * Gets the backing ByteBuffer if it exists, otherwise returns null.
+ * @return the backing ByteBuffer if it exists, otherwise returns null.
+ * @deprecated no longer supported for Java 17 versions.
+ * In Java 17 use toByteBuffer(ByteOrder) or asByteBufferView(ByteOrder) instead.
+ */
+ @Deprecated
+ ByteBuffer getByteBuffer();
+
/**
* Gets the cumulative offset in bytes of this object from the backing resource.
* This offset may also include other offset components such as the native off-heap
* memory address, DirectByteBuffer split offsets, region offsets, and unsafe arrayBaseOffsets.
*
* @return the cumulative offset in bytes of this object from the backing resource.
+ * @deprecated no longer supported for Java 17 versions. Use nativeOverlap(BaseState) instead.
*/
+ @Deprecated
long getCumulativeOffset();
/**
@@ -139,15 +174,59 @@ public interface BaseState {
* @param offsetBytes offset to be added to the cumulative offset.
* @return the cumulative offset in bytes of this object from the backing resource including the
* given offsetBytes.
+ * @deprecated no longer supported for Java 17 versions. Use nativeOverlap(BaseState) instead.
*/
+ @Deprecated
long getCumulativeOffset(long offsetBytes);
+ /**
+ * Gets the current size of active direct memory allocated.
+ * @return the current size of active direct memory allocated.
+ * @deprecated no longer supported for Java 17 versions.
+ */
+ @Deprecated
+ static long getCurrentDirectMemoryAllocated() {
+ return BaseStateImpl.getCurrentDirectMemoryAllocated();
+ }
+
+ /**
+ * Gets the current number of active direct memory allocations.
+ * @return the current number of active direct memory allocations.
+ * @deprecated no longer supported for Java 17 versions.
+ */
+ @Deprecated
+ static long getCurrentDirectMemoryAllocations() {
+ return BaseStateImpl.getCurrentDirectMemoryAllocations();
+ }
+
+ /**
+ * Gets the current size of active direct memory map allocated.
+ * @return the current size of active direct memory map allocated.
+ * @deprecated no longer supported for Java 17 versions.
+ */
+ @Deprecated
+ static long getCurrentDirectMemoryMapAllocated() {
+ return BaseStateImpl.getCurrentDirectMemoryMapAllocated();
+ }
+
+ /**
+ * Gets the current number of active direct memory map allocations.
+ * @return the current number of active direct memory map allocations.
+ * @deprecated no longer supported for Java 17 versions.
+ */
+ @Deprecated
+ static long getCurrentDirectMemoryMapAllocations() {
+ return BaseStateImpl.getCurrentDirectMemoryMapAllocations();
+ }
+
/**
* Returns the offset of address zero of this object relative to the address zero of the
* backing resource but not including the size of any Java object header.
* @return the offset of address zero of this object relative to the address zero of the
* backing resource but not including the size of any Java object header.
+ * @deprecated no longer supported for Java17 versions use nativeOverlap(BaseState) instead.
*/
+ @Deprecated
long getRegionOffset();
/**
@@ -158,28 +237,28 @@ public interface BaseState {
* @return the offset of address zero of this object relative to the address zero of the
* backing resource plus the given offsetBytes but not including the size of any Java object
* header.
+ * @deprecated no longer supported for Java 17 versions. Use nativeOverlap(BaseState) instead.
*/
+ @Deprecated
long getRegionOffset(long offsetBytes);
/**
* Gets the current Type ByteOrder.
* This may be different from the ByteOrder of the backing resource and of the Native Byte Order.
* @return the current Type ByteOrder.
+ * @deprecated use getByteOrder() instead.
*/
- ByteOrder getTypeByteOrder();
+ @Deprecated
+ default ByteOrder getTypeByteOrder() { return getByteOrder(); }
/**
* Returns true if this object is backed by an on-heap primitive array
* @return true if this object is backed by an on-heap primitive array
+ * @deprecated no longer supported for Java 17 versions.
*/
+ @Deprecated
boolean hasArray();
- /**
- * Returns true if this Memory is backed by a ByteBuffer.
- * @return true if this Memory is backed by a ByteBuffer.
- */
- boolean hasByteBuffer();
-
/**
* Returns the hashCode of this object.
*
@@ -191,34 +270,11 @@ public interface BaseState {
* than the {@link java.util.IdentityHashMap} can be used.</p>
*
* @return the hashCode of this object.
+ * @apiNote This custom hashCode() will no longer be supported for Java 17 versions.
*/
@Override
int hashCode();
- /**
- * Returns true if the Native ByteOrder is the same as the ByteOrder of the
- * current Buffer or Memory and the same ByteOrder as the given byteOrder.
- * @param byteOrder the given ByteOrder
- * @return true if the Native ByteOrder is the same as the ByteOrder of the
- * current Buffer or Memory and the same ByteOrder as the given byteOrder.
- */
- boolean isByteOrderCompatible(ByteOrder byteOrder);
-
- /**
- * Returns true if the backing resource is direct (off-heap) memory.
- * This is the case for allocated direct memory, memory mapped files,
- * @return true if the backing resource is direct (off-heap) memory.
- */
- boolean isDirect();
-
- /**
- * Returns true if this object or the backing resource is read-only.
- * @return true if this object or the backing resource is read-only.
- */
- boolean isReadOnly();
-
- //Monitoring
-
/**
* Returns true if the backing resource of <i>this</i> is identical with the backing resource
* of <i>that</i>. The capacities must be the same. If <i>this</i> is a region,
@@ -226,48 +282,18 @@ public interface BaseState {
* @param that A different non-null object
* @return true if the backing resource of <i>this</i> is the same as the backing resource
* of <i>that</i>.
+ * @deprecated no longer required or supported for Java 17 versions. Use nativeOverlap(BaseState) instead.
*/
+ @Deprecated
boolean isSameResource(Object that);
/**
* Returns true if this object is valid and has not been closed.
* This is relevant only for direct (off-heap) memory and Mapped Files.
* @return true if this object is valid and has not been closed.
+ * @deprecated no longer required or supported for Java 17 versions.
*/
+ @Deprecated
boolean isValid();
- /**
- * Returns a formatted hex string of a range of this object.
- * Used primarily for testing.
- * @param header a descriptive header
- * @param offsetBytes offset bytes relative to this object start
- * @param lengthBytes number of bytes to convert to a hex string
- * @return a formatted hex string in a human readable array
- */
- String toHexString(String header, long offsetBytes, int lengthBytes);
-
- /**
- * Returns a 64-bit hash from a single long. This method has been optimized for speed when only
- * a single hash of a long is required.
- * @param in A long.
- * @param seed A long valued seed.
- * @return the hash.
- */
- long xxHash64(long in, long seed);
-
- //TO STRING
-
- /**
- * Returns the 64-bit hash of the sequence of bytes in this object specified by
- * <i>offsetBytes</i>, <i>lengthBytes</i> and a <i>seed</i>. Note that the sequence of bytes is
- * always processed in the same order independent of endianness.
- *
- * @param offsetBytes the given offset in bytes to the first byte of the byte sequence.
- * @param lengthBytes the given length in bytes of the byte sequence.
- * @param seed the given long seed.
- * @return the 64-bit hash of the sequence of bytes in this object specified by
- * <i>offsetBytes</i> and <i>lengthBytes</i>.
- */
- long xxHash64(long offsetBytes, long lengthBytes, long seed);
-
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
index fe4a9c8..9c75edb 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/Buffer.java
@@ -143,7 +143,7 @@ public interface Buffer extends BaseBuffer {
* @return Memory
*/
default Memory asMemory() {
- return asMemory(getTypeByteOrder());
+ return asMemory(getByteOrder());
}
/**
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java
index 51c2d2b..f8f828c 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/DefaultMemoryRequestServer.java
@@ -73,7 +73,7 @@ public final class DefaultMemoryRequestServer implements MemoryRequestServer {
*/
@Override
public WritableMemory request(final WritableMemory currentWritableMemory, final long capacityBytes) {
- final WritableMemory wmem = WritableMemory.allocate((int)capacityBytes, currentWritableMemory.getTypeByteOrder());
+ final WritableMemory wmem = WritableMemory.allocate((int)capacityBytes, currentWritableMemory.getByteOrder());
return wmem;
}
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
index 9c5a35b..245f3a9 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/MurmurHash3v2.java
@@ -40,6 +40,7 @@ import static org.apache.datasketches.memory.internal.UnsafeUtil.unsafe;
*
* @author Lee Rhodes
*/
+@SuppressWarnings("deprecation")
public final class MurmurHash3v2 {
private static final long C1 = 0x87c37b91114253d5L;
private static final long C2 = 0x4cf5ad432745937fL;
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java
index 0c03c1a..47b4684 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/WritableMemory.java
@@ -168,7 +168,7 @@ public interface WritableMemory extends Memory {
* @return a new <i>WritableMemory</i> representing the defined writable region.
*/
default WritableMemory writableRegion(long offsetBytes, long capacityBytes) {
- return writableRegion(offsetBytes, capacityBytes, getTypeByteOrder());
+ return writableRegion(offsetBytes, capacityBytes, getByteOrder());
}
/**
@@ -202,7 +202,7 @@ public interface WritableMemory extends Memory {
* @return a new <i>WritableBuffer</i> with a view of this WritableMemory
*/
default WritableBuffer asWritableBuffer() {
- return asWritableBuffer(getTypeByteOrder());
+ return asWritableBuffer(getByteOrder());
}
/**
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
index 2692725..83b8f64 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseStateImpl.java
@@ -99,10 +99,8 @@ public abstract class BaseStateImpl implements BaseState {
: UnsafeUtil.getArrayBaseOffset(unsafeObj.getClass()));
}
- //Byte Order Related
-
@Override
- public final ByteOrder getTypeByteOrder() {
+ public final ByteOrder getByteOrder() {
return isNonNativeType() ? NON_NATIVE_BYTE_ORDER : NATIVE_BYTE_ORDER;
}
@@ -120,7 +118,7 @@ public abstract class BaseStateImpl implements BaseState {
@Override
public final boolean isByteOrderCompatible(final ByteOrder byteOrder) {
- final ByteOrder typeBO = getTypeByteOrder();
+ final ByteOrder typeBO = getByteOrder();
return typeBO == NATIVE_BYTE_ORDER && typeBO == byteOrder;
}
@@ -331,7 +329,6 @@ public abstract class BaseStateImpl implements BaseState {
return (getTypeId() >>> 3 & 3) == 3;
}
- //TO STRING
/**
* Decodes the resource type. This is primarily for debugging.
* @param typeId the given typeId
@@ -430,7 +427,7 @@ public abstract class BaseStateImpl implements BaseState {
sb.append("MemReq, hashCode : ").append(memReqStr).append(LS);
sb.append("Valid : ").append(state.isValid()).append(LS);
sb.append("Read Only : ").append(state.isReadOnly()).append(LS);
- sb.append("Type Byte Order : ").append(state.getTypeByteOrder().toString()).append(LS);
+ sb.append("Type Byte Order : ").append(state.getByteOrder().toString()).append(LS);
sb.append("Native Byte Order : ").append(NATIVE_BYTE_ORDER.toString()).append(LS);
sb.append("JDK Runtime Version : ").append(UnsafeUtil.JDK).append(LS);
//Data detail
diff --git a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
index e1dbe93..37d8fbf 100644
--- a/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
+++ b/datasketches-memory-java8/src/main/java/org/apache/datasketches/memory/internal/BaseWritableBufferImpl.java
@@ -92,7 +92,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
//REGIONS
@Override
public Buffer region() {
- return writableRegionImpl(getPosition(), getEnd() - getPosition(), true, getTypeByteOrder());
+ return writableRegionImpl(getPosition(), getEnd() - getPosition(), true, getByteOrder());
}
@Override
@@ -104,7 +104,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
@Override
public WritableBuffer writableRegion() {
- return writableRegionImpl(getPosition(), getEnd() - getPosition(), false, getTypeByteOrder());
+ return writableRegionImpl(getPosition(), getEnd() - getPosition(), false, getByteOrder());
}
@Override
@@ -132,7 +132,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
//DUPLICATES
@Override
public Buffer duplicate() {
- return writableDuplicateImpl(true, getTypeByteOrder());
+ return writableDuplicateImpl(true, getByteOrder());
}
@Override
@@ -142,7 +142,7 @@ public abstract class BaseWritableBufferImpl extends BaseBufferImpl implements W
@Override
public WritableBuffer writableDuplicate() {
- return writableDuplicateImpl(false, getTypeByteOrder());
+ return writableDuplicateImpl(false, getByteOrder());
}
@Override
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java
index 34dcb1e..dcbd2d1 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMapMemoryTest.java
@@ -39,6 +39,7 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class AllocateDirectMapMemoryTest {
MapHandle hand = null;
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java
index c041e4e..024c1b4 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectMemoryTest.java
@@ -32,6 +32,7 @@ import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.AfterClass;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class AllocateDirectMemoryTest {
@Test
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java
index 723d137..5b62610 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/AllocateDirectWritableMapMemoryTest.java
@@ -50,6 +50,7 @@ import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class AllocateDirectWritableMapMemoryTest {
@BeforeClass
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java
index dcc227a..eef5799 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BaseStateTest.java
@@ -32,6 +32,7 @@ import org.apache.datasketches.memory.WritableBuffer;
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class BaseStateTest {
@Test
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java
index 3d9cb20..f378d5e 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/Buffer2Test.java
@@ -35,6 +35,7 @@ import org.apache.datasketches.memory.WritableBuffer;
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class Buffer2Test {
@Test
@@ -351,7 +352,7 @@ public class Buffer2Test {
for (int i = 0; i < n; i++) { arr[i] = i; }
Memory mem = Memory.wrap(arr);
Buffer buf = mem.asBuffer();
- Buffer reg = buf.region(n2 * 8, n2 * 8, buf.getTypeByteOrder()); //top half
+ Buffer reg = buf.region(n2 * 8, n2 * 8, buf.getByteOrder()); //top half
for (int i = 0; i < n2; i++) {
long v = reg.getLong(i * 8);
long e = i + n2;
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java
index cb877b7..ca9700f 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/BufferTest.java
@@ -204,7 +204,7 @@ public class BufferTest {
ByteBuffer bb = ByteBuffer.allocate(n * 8);
bb.order(ByteOrder.BIG_ENDIAN);
Buffer buf = Buffer.wrap(bb);
- assertEquals(buf.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(buf.getByteOrder(), ByteOrder.BIG_ENDIAN);
}
@Test
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java
index 73e1832..1e8d187 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/DruidIssue11544Test.java
@@ -48,6 +48,7 @@ import org.testng.annotations.Test;
* @author Lee Rhodes
*
*/
+@SuppressWarnings("deprecation")
public class DruidIssue11544Test {
@Test
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java
index f2f4547..c1e9fe4 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/ExampleMemoryRequestServerTest.java
@@ -34,6 +34,7 @@ import org.testng.annotations.Test;
* Examples of how to use the MemoryRequestServer with a memory hungry client.
* @author Lee Rhodes
*/
+@SuppressWarnings("deprecation")
public class ExampleMemoryRequestServerTest {
/**
@@ -132,7 +133,7 @@ public class ExampleMemoryRequestServerTest {
@Override
public WritableMemory request(WritableMemory currentWMem, long capacityBytes) {
- ByteOrder order = currentWMem.getTypeByteOrder();
+ ByteOrder order = currentWMem.getByteOrder();
WritableHandle handle = WritableMemory.allocateDirect(capacityBytes, order, this);
WritableMemory wmem = handle.getWritable();
map.put(wmem, handle); //We track the newly allocated memory and its handle.
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java
index cb45b4b..1a7f738 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/LeafImplTest.java
@@ -42,6 +42,7 @@ import org.testng.annotations.Test;
/**
* @author Lee Rhodes
*/
+@SuppressWarnings("deprecation")
public class LeafImplTest {
private static final ByteOrder NBO = NATIVE_BYTE_ORDER;
private static final ByteOrder NNBO = NON_NATIVE_BYTE_ORDER;
@@ -91,7 +92,7 @@ public class LeafImplTest {
WritableMemory mem = WritableMemory.writableWrap(bb, NBO, dummyMemReqSvr);
assertEquals(bb.isDirect(), mem.isDirect());
assertNotNull(((BaseStateImpl)mem).getUnsafeObject());
- checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
+ checkCombinations(mem, off, cap, mem.isDirect(), mem.getByteOrder(), true, true);
//BB off heap, native order, has ByteBuffer, has MemReqSvr
ByteBuffer dbb = ByteBuffer.allocateDirect((int)cap);
@@ -100,7 +101,7 @@ public class LeafImplTest {
mem = WritableMemory.writableWrap(dbb, NBO, dummyMemReqSvr);
assertEquals(dbb.isDirect(), mem.isDirect());
assertNull(((BaseStateImpl)mem).getUnsafeObject());
- checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
+ checkCombinations(mem, off, cap, mem.isDirect(), mem.getByteOrder(), true, true);
//BB on heap, non native order, has ByteBuffer, has MemReqSvr
bb = ByteBuffer.allocate((int)cap);
@@ -109,7 +110,7 @@ public class LeafImplTest {
mem = WritableMemory.writableWrap(bb, NNBO, dummyMemReqSvr);
assertEquals(bb.isDirect(), mem.isDirect());
assertNotNull(((BaseStateImpl)mem).getUnsafeObject());
- checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
+ checkCombinations(mem, off, cap, mem.isDirect(), mem.getByteOrder(), true, true);
//BB off heap, non native order, has ByteBuffer, has MemReqSvr
dbb = ByteBuffer.allocateDirect((int)cap);
@@ -118,7 +119,7 @@ public class LeafImplTest {
mem = WritableMemory.writableWrap(dbb, NNBO, dummyMemReqSvr);
assertEquals(dbb.isDirect(), mem.isDirect());
assertNull(((BaseStateImpl)mem).getUnsafeObject());
- checkCombinations(mem, off, cap, mem.isDirect(), mem.getTypeByteOrder(), true, true);
+ checkCombinations(mem, off, cap, mem.isDirect(), mem.getByteOrder(), true, true);
}
@Test
@@ -186,7 +187,7 @@ public class LeafImplTest {
ByteBuffer bb = mem.getByteBuffer();
assertTrue( hasByteBuffer ? bb != null : bb == null);
- assertTrue(mem.getTypeByteOrder() == bo);
+ assertTrue(mem.getByteOrder() == bo);
if (hasMemReqSvr) { assertTrue(mem.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
@@ -211,7 +212,7 @@ public class LeafImplTest {
bb = buf.getByteBuffer();
assertTrue(hasByteBuffer ? bb != null : bb == null);
- assertTrue(buf.getTypeByteOrder() == bo);
+ assertTrue(buf.getByteOrder() == bo);
if (hasMemReqSvr) { assertTrue(buf.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
@@ -236,7 +237,7 @@ public class LeafImplTest {
bb = nnMem.getByteBuffer();
assertTrue( hasByteBuffer ? bb != null : bb == null);
- assertTrue(nnMem.getTypeByteOrder() == oo);
+ assertTrue(nnMem.getByteOrder() == oo);
if (hasMemReqSvr) { assertTrue(nnMem.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
@@ -261,7 +262,7 @@ public class LeafImplTest {
bb = nnBuf.getByteBuffer();
assertTrue( hasByteBuffer ? bb != null : bb == null);
- assertTrue(nnBuf.getTypeByteOrder() == oo);
+ assertTrue(nnBuf.getByteOrder() == oo);
if (hasMemReqSvr) { assertTrue(nnBuf.getMemoryRequestServer() instanceof DummyMemoryRequestServer); }
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java
index cf6a998..02d44a0 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/MemoryTest.java
@@ -48,6 +48,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.testng.collections.Lists;
+@SuppressWarnings("deprecation")
public class MemoryTest {
@BeforeClass
@@ -212,8 +213,8 @@ public class MemoryTest {
ByteBuffer bb = ByteBuffer.allocate(n * 8);
bb.order(ByteOrder.BIG_ENDIAN);
Memory mem = Memory.wrap(bb);
- assertFalse(mem.getTypeByteOrder() == NATIVE_BYTE_ORDER);
- assertEquals(mem.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertFalse(mem.getByteOrder() == NATIVE_BYTE_ORDER);
+ assertEquals(mem.getByteOrder(), ByteOrder.BIG_ENDIAN);
}
@Test
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
index f29841a..63bfc4d 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableBufferImplTest.java
@@ -37,6 +37,7 @@ import org.apache.datasketches.memory.WritableMemory;
import org.testng.Assert;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class NativeWritableBufferImplTest {
//Simple Native direct
@@ -234,7 +235,7 @@ public class NativeWritableBufferImplTest {
try (WritableHandle wrh = WritableMemory.allocateDirect(memCapacity)) {
WritableMemory wmem = wrh.getWritable();
WritableBuffer wbuf = wmem.asWritableBuffer();
- wbuf.writableRegion(1, 64, wbuf.getTypeByteOrder()); //wrong!
+ wbuf.writableRegion(1, 64, wbuf.getByteOrder()); //wrong!
}
}
@@ -557,13 +558,13 @@ public class NativeWritableBufferImplTest {
ByteBuffer bb = ByteBuffer.allocate(64);
WritableBuffer wbuf = WritableBuffer.writableWrap(bb);
@SuppressWarnings("unused")
- WritableBuffer wreg = wbuf.writableRegion(0, 1, wbuf.getTypeByteOrder());
+ WritableBuffer wreg = wbuf.writableRegion(0, 1, wbuf.getByteOrder());
try {
Buffer buf = Buffer.wrap(bb);
wbuf = (WritableBuffer) buf;
@SuppressWarnings("unused")
- WritableBuffer wreg2 = wbuf.writableRegion(0, 1, wbuf.getTypeByteOrder());
+ WritableBuffer wreg2 = wbuf.writableRegion(0, 1, wbuf.getByteOrder());
Assert.fail();
} catch (ReadOnlyException expected) {
// ignore
@@ -574,7 +575,7 @@ public class NativeWritableBufferImplTest {
public void checkZeroBuffer() {
WritableMemory wmem = WritableMemory.allocate(8);
WritableBuffer wbuf = wmem.asWritableBuffer();
- WritableBuffer reg = wbuf.writableRegion(0, 0, wbuf.getTypeByteOrder());
+ WritableBuffer reg = wbuf.writableRegion(0, 0, wbuf.getByteOrder());
assertEquals(reg.getCapacity(), 0);
}
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
index a83d5bd..08d79c0 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NativeWritableMemoryImplTest.java
@@ -37,6 +37,7 @@ import org.apache.datasketches.memory.WritableHandle;
import org.apache.datasketches.memory.WritableMemory;
import org.testng.annotations.Test;
+@SuppressWarnings("deprecation")
public class NativeWritableMemoryImplTest {
//Simple Native direct
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java
index 57d481a..d7f0421 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableBufferImplTest.java
@@ -239,10 +239,10 @@ public class NonNativeWritableBufferImplTest {
WritableMemory wmem = WritableMemory.writableWrap(bArr, ByteOrder.BIG_ENDIAN);
WritableBuffer wbuf = wmem.asWritableBuffer();
WritableBuffer wdup = wbuf.writableDuplicate();
- assertEquals(wdup.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(wdup.getByteOrder(), ByteOrder.BIG_ENDIAN);
WritableBuffer wreg = wbuf.writableRegion();
- assertEquals(wreg.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(wreg.getByteOrder(), ByteOrder.BIG_ENDIAN);
}
@Test
@@ -251,10 +251,10 @@ public class NonNativeWritableBufferImplTest {
WritableMemory wmem = WritableMemory.writableWrap(bArr, ByteOrder.BIG_ENDIAN);
Buffer buf = wmem.asBuffer();
Buffer dup = buf.duplicate();
- assertEquals(dup.getTypeByteOrder(), ByteOrder.LITTLE_ENDIAN);
+ assertEquals(dup.getByteOrder(), ByteOrder.LITTLE_ENDIAN);
Buffer reg = buf.region();
- assertEquals(reg.getTypeByteOrder(), ByteOrder.LITTLE_ENDIAN);
+ assertEquals(reg.getByteOrder(), ByteOrder.LITTLE_ENDIAN);
}
}
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java
index c6bd5d0..b544e93 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/NonNativeWritableMemoryImplTest.java
@@ -205,7 +205,7 @@ public class NonNativeWritableMemoryImplTest {
@Test
public void checkRegion() {
WritableMemory wreg = wmem.writableRegion(0, wmem.getCapacity());
- assertEquals(wreg.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(wreg.getByteOrder(), ByteOrder.BIG_ENDIAN);
}
@Test
@@ -213,7 +213,7 @@ public class NonNativeWritableMemoryImplTest {
byte[] bArr1 = new byte[0];
WritableMemory wmem1 = WritableMemory.writableWrap(bArr1, ByteOrder.BIG_ENDIAN);
Memory reg = wmem1.region(0, wmem1.getCapacity());
- assertEquals(reg.getTypeByteOrder(), ByteOrder.LITTLE_ENDIAN);
+ assertEquals(reg.getByteOrder(), ByteOrder.LITTLE_ENDIAN);
}
}
diff --git a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java
index 89a36f3..33d1529 100644
--- a/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java
+++ b/datasketches-memory-java8/src/test/java/org/apache/datasketches/memory/internal/WritableMemoryTest.java
@@ -39,9 +39,9 @@ public class WritableMemoryTest {
public void wrapBigEndian() {
ByteBuffer bb = ByteBuffer.allocate(64); //big endian
WritableMemory wmem = WritableMemory.writableWrap(bb);
- assertEquals(wmem.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(wmem.getByteOrder(), ByteOrder.BIG_ENDIAN);
wmem = WritableMemory.writableWrap(bb, NATIVE_BYTE_ORDER);
- assertEquals(wmem.getTypeByteOrder(), ByteOrder.LITTLE_ENDIAN);
+ assertEquals(wmem.getByteOrder(), ByteOrder.LITTLE_ENDIAN);
}
@Test
@@ -55,11 +55,11 @@ public class WritableMemoryTest {
@Test
public void allocateWithByteOrder() {
WritableMemory wmem = WritableMemory.allocate(64, ByteOrder.BIG_ENDIAN);
- assertEquals(wmem.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(wmem.getByteOrder(), ByteOrder.BIG_ENDIAN);
wmem = WritableMemory.allocate(64, ByteOrder.LITTLE_ENDIAN);
- assertEquals(wmem.getTypeByteOrder(), ByteOrder.LITTLE_ENDIAN);
+ assertEquals(wmem.getByteOrder(), ByteOrder.LITTLE_ENDIAN);
wmem = WritableMemory.writableWrap(new byte[64], 32, 32, ByteOrder.BIG_ENDIAN);
- assertEquals(wmem.getTypeByteOrder(), ByteOrder.BIG_ENDIAN);
+ assertEquals(wmem.getByteOrder(), ByteOrder.BIG_ENDIAN);
}
@Test
@@ -164,11 +164,11 @@ public class WritableMemoryTest {
@Test
public void checkWrapWithBO() {
WritableMemory wmem = WritableMemory.writableWrap(new byte[0], ByteOrder.BIG_ENDIAN);
- boolean nativeBO = wmem.getTypeByteOrder() == NATIVE_BYTE_ORDER;
+ boolean nativeBO = wmem.getByteOrder() == NATIVE_BYTE_ORDER;
assertFalse(nativeBO);
println("" + nativeBO);
wmem = WritableMemory.writableWrap(new byte[8], ByteOrder.BIG_ENDIAN);
- nativeBO = wmem.getTypeByteOrder() == NATIVE_BYTE_ORDER;
+ nativeBO = wmem.getByteOrder() == NATIVE_BYTE_ORDER;
assertFalse(nativeBO);
println("" + nativeBO);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org