Updating NioUtils
package java.nio;
+import dalvik.annotation.compat.UnsupportedAppUsage;
+
import com.google.j2objc.LibraryNotLinkedError;
import java.io.Closeable;
import java.io.FileDescriptor;
@@ -23,9 +25,14 @@ import java.io.IOException;
import java.nio.channels.FileChannel;
import java.util.Set;
-import static libcore.io.OsConstants.*;
import sun.misc.Cleaner;
import sun.nio.ch.DirectBuffer;
+import sun.nio.ch.FileChannelImpl;
+
+import static libcore.io.OsConstants.O_ACCMODE;
+import static libcore.io.OsConstants.O_APPEND;
+import static libcore.io.OsConstants.O_RDONLY;
+import static libcore.io.OsConstants.O_WRONLY;
/**
* @hide internal use only
@@ -34,6 +41,8 @@ public final class NioUtils {
private NioUtils() {
}
+ @UnsupportedAppUsage
+ @libcore.api.CorePlatformApi
public static void freeDirectBuffer(ByteBuffer buffer) {
if (buffer == null) {
return;
@@ -96,6 +105,8 @@ public final class NioUtils {
* Exposes the array backing a non-direct ByteBuffer, even if the ByteBuffer is read-only.
* Normally, attempting to access the array backing a read-only buffer throws.
*/
+ @UnsupportedAppUsage
+ @libcore.api.CorePlatformApi
public static byte[] unsafeArray(ByteBuffer b) {
return b.array();
}
@@ -104,6 +115,8 @@ public final class NioUtils {
* Exposes the array offset for the array backing a non-direct ByteBuffer,
* even if the ByteBuffer is read-only.
*/
+ @UnsupportedAppUsage
+ @libcore.api.CorePlatformApi
public static int unsafeArrayOffset(ByteBuffer b) {
return b.arrayOffset();
}
