diff options
-rw-r--r-- | luni/src/main/java/java/nio/NIOAccess.java | 10 | ||||
-rw-r--r-- | mmodules/core_platform_api/api/platform/current-api.txt | 5 |
2 files changed, 12 insertions, 3 deletions
diff --git a/luni/src/main/java/java/nio/NIOAccess.java b/luni/src/main/java/java/nio/NIOAccess.java index 81b205d3fb..734537980f 100644 --- a/luni/src/main/java/java/nio/NIOAccess.java +++ b/luni/src/main/java/java/nio/NIOAccess.java @@ -19,10 +19,12 @@ package java.nio; import android.compat.annotation.UnsupportedAppUsage; /** - * This class is used via JNI by code in frameworks/base/. + * This class is used via JNI by code in frameworks/base/ and + * by the JniConstants cache in libnativehelper/. * @hide */ // @VisibleForTesting : was default +@libcore.api.CorePlatformApi public final class NIOAccess { /** @@ -46,7 +48,8 @@ public final class NIOAccess { * given Buffer, or null if the Buffer is not backed by a Java array. */ @UnsupportedAppUsage - static Object getBaseArray(Buffer b) { + @libcore.api.CorePlatformApi + public static Object getBaseArray(Buffer b) { return b.hasArray() ? b.array() : null; } @@ -58,7 +61,8 @@ public final class NIOAccess { * meaningful if getBaseArray() returns non-null. */ @UnsupportedAppUsage - static int getBaseArrayOffset(Buffer b) { + @libcore.api.CorePlatformApi + public static int getBaseArrayOffset(Buffer b) { return b.hasArray() ? ((b.arrayOffset() + b.position) << b._elementSizeShift) : 0; } } diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt index 1ca16bc169..2b3e77d346 100644 --- a/mmodules/core_platform_api/api/platform/current-api.txt +++ b/mmodules/core_platform_api/api/platform/current-api.txt @@ -850,6 +850,11 @@ package java.nio { method public final void setAccessible(boolean); } + public final class NIOAccess { + method public static Object getBaseArray(java.nio.Buffer); + method public static int getBaseArrayOffset(java.nio.Buffer); + } + public final class NioUtils { method public static void freeDirectBuffer(java.nio.ByteBuffer); method public static byte[] unsafeArray(java.nio.ByteBuffer); |