summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libart/src/main/java/java/lang/Daemons.java20
-rw-r--r--luni/src/main/java/android/system/Os.java32
-rw-r--r--luni/src/main/java/libcore/io/BlockGuardOs.java6
-rw-r--r--luni/src/main/java/libcore/io/ForwardingOs.java10
-rw-r--r--luni/src/main/java/libcore/io/IoBridge.java4
-rw-r--r--luni/src/main/java/libcore/io/Linux.java10
-rw-r--r--luni/src/main/java/libcore/io/Os.java10
-rw-r--r--luni/src/main/java/libcore/util/MutableInt.java30
-rw-r--r--luni/src/main/java/libcore/util/MutableLong.java30
-rw-r--r--luni/src/main/native/libcore_io_Linux.cpp38
-rw-r--r--luni/src/test/java/libcore/java/util/TreeMapTest.java27
-rw-r--r--luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java22
-rw-r--r--luni/src/test/java/libcore/libcore/icu/TransliteratorTest.java2
-rw-r--r--luni/src/test/java/libcore/libcore/io/BlockGuardOsTest.java4
-rw-r--r--luni/src/test/java/libcore/libcore/io/OsTest.java6
-rw-r--r--non_openjdk_java_files.bp2
-rw-r--r--ojluni/src/main/java/java/lang/Thread.java2
-rw-r--r--ojluni/src/main/java/java/nio/ByteBuffer.java869
-rw-r--r--ojluni/src/main/java/java/nio/CharBuffer.java602
-rw-r--r--ojluni/src/main/java/java/nio/DoubleBuffer.java426
-rw-r--r--ojluni/src/main/java/java/nio/FloatBuffer.java424
-rw-r--r--ojluni/src/main/java/java/nio/IntBuffer.java396
-rw-r--r--ojluni/src/main/java/java/nio/LongBuffer.java405
-rw-r--r--ojluni/src/main/java/java/nio/ShortBuffer.java404
-rw-r--r--ojluni/src/main/java/java/security/AlgorithmParameters.java4
-rw-r--r--ojluni/src/main/java/java/util/TreeMap.java30
-rw-r--r--ojluni/src/main/java/java/util/concurrent/TimeUnit.java53
-rw-r--r--ojluni/src/main/java/javax/crypto/Cipher.java13
-rw-r--r--ojluni/src/main/java/javax/crypto/KeyGenerator.java4
-rw-r--r--ojluni/src/main/java/sun/invoke/util/VerifyAccess.java23
-rw-r--r--tools/docs/crypto/data/crypto_support.json24
31 files changed, 2392 insertions, 1540 deletions
diff --git a/libart/src/main/java/java/lang/Daemons.java b/libart/src/main/java/java/lang/Daemons.java
index 0e2cb45676..f25c78cf30 100644
--- a/libart/src/main/java/java/lang/Daemons.java
+++ b/libart/src/main/java/java/lang/Daemons.java
@@ -400,7 +400,7 @@ public final class Daemons {
Exception syntheticException = new TimeoutException(message);
// We use the stack from where finalize() was running to show where it was stuck.
syntheticException.setStackTrace(FinalizerDaemon.INSTANCE.getStackTrace());
- Thread.UncaughtExceptionHandler h = Thread.getDefaultUncaughtExceptionHandler();
+
// Send SIGQUIT to get native stack traces.
try {
Os.kill(Os.getpid(), OsConstants.SIGQUIT);
@@ -411,15 +411,29 @@ public final class Daemons {
} catch (OutOfMemoryError ignored) {
// May occur while trying to allocate the exception.
}
- if (h == null) {
+
+ // Ideally, we'd want to do this if this Thread had no handler to dispatch to.
+ // Unfortunately, it's extremely to messy to query whether a given Thread has *some*
+ // handler to dispatch to, either via a handler set on itself, via its ThreadGroup
+ // object or via the defaultUncaughtExceptionHandler.
+ //
+ // As an approximation, we log by hand an exit if there's no pre-exception handler nor
+ // a default uncaught exception handler.
+ //
+ // Note that this condition will only ever be hit by ART host tests and standalone
+ // dalvikvm invocations. All zygote forked process *will* have a pre-handler set
+ // in RuntimeInit and they cannot subsequently override it.
+ if (Thread.getUncaughtExceptionPreHandler() == null &&
+ Thread.getDefaultUncaughtExceptionHandler() == null) {
// If we have no handler, log and exit.
System.logE(message, syntheticException);
System.exit(2);
}
+
// Otherwise call the handler to do crash reporting.
// We don't just throw because we're not the thread that
// timed out; we're the thread that detected it.
- h.uncaughtException(Thread.currentThread(), syntheticException);
+ Thread.currentThread().dispatchUncaughtException(syntheticException);
}
}
diff --git a/luni/src/main/java/android/system/Os.java b/luni/src/main/java/android/system/Os.java
index cc24cc5e81..5d967dc4af 100644
--- a/luni/src/main/java/android/system/Os.java
+++ b/luni/src/main/java/android/system/Os.java
@@ -280,12 +280,7 @@ public final class Os {
/** @hide */ public static int ioctlInt(FileDescriptor fd, int cmd, Int32Ref arg) throws ErrnoException {
- libcore.util.MutableInt internalArg = new libcore.util.MutableInt(arg.value);
- try {
- return Libcore.os.ioctlInt(fd, cmd, internalArg);
- } finally {
- arg.value = internalArg.value;
- }
+ return Libcore.os.ioctlInt(fd, cmd, arg);
}
/**
@@ -472,18 +467,8 @@ public final class Os {
/**
* See <a href="http://man7.org/linux/man-pages/man2/sendfile.2.html">sendfile(2)</a>.
*/
- public static long sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref inOffset, long byteCount) throws ErrnoException {
- if (inOffset == null) {
- return Libcore.os.sendfile(outFd, inFd, null, byteCount);
- } else {
- libcore.util.MutableLong internalInOffset = new libcore.util.MutableLong(
- inOffset.value);
- try {
- return Libcore.os.sendfile(outFd, inFd, internalInOffset, byteCount);
- } finally {
- inOffset.value = internalInOffset.value;
- }
- }
+ public static long sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount) throws ErrnoException {
+ return Libcore.os.sendfile(outFd, inFd, offset, byteCount);
}
/**
@@ -652,16 +637,7 @@ public final class Os {
* @throws IllegalArgumentException if {@code status != null && status.length != 1}
*/
public static int waitpid(int pid, Int32Ref status, int options) throws ErrnoException {
- if (status == null) {
- return Libcore.os.waitpid(pid, null, options);
- } else {
- libcore.util.MutableInt internalStatus = new libcore.util.MutableInt(status.value);
- try {
- return Libcore.os.waitpid(pid, internalStatus, options);
- } finally {
- status.value = internalStatus.value;
- }
- }
+ return Libcore.os.waitpid(pid, status, options);
}
/**
diff --git a/luni/src/main/java/libcore/io/BlockGuardOs.java b/luni/src/main/java/libcore/io/BlockGuardOs.java
index a8fa8fe3f3..d95668aecd 100644
--- a/luni/src/main/java/libcore/io/BlockGuardOs.java
+++ b/luni/src/main/java/libcore/io/BlockGuardOs.java
@@ -18,6 +18,7 @@ package libcore.io;
import android.system.ErrnoException;
import android.system.GaiException;
+import android.system.Int64Ref;
import android.system.OsConstants;
import android.system.StructAddrinfo;
import android.system.StructLinger;
@@ -33,7 +34,6 @@ import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
-import libcore.util.MutableLong;
import static android.system.OsConstants.*;
@@ -289,9 +289,9 @@ public class BlockGuardOs extends ForwardingOs {
os.rename(oldPath, newPath);
}
- @Override public long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount) throws ErrnoException {
+ @Override public long sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount) throws ErrnoException {
BlockGuard.getThreadPolicy().onWriteToDisk();
- return os.sendfile(outFd, inFd, inOffset, byteCount);
+ return os.sendfile(outFd, inFd, offset, byteCount);
}
@Override public int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException {
diff --git a/luni/src/main/java/libcore/io/ForwardingOs.java b/luni/src/main/java/libcore/io/ForwardingOs.java
index 3ad6f7e4be..98ee4860b4 100644
--- a/luni/src/main/java/libcore/io/ForwardingOs.java
+++ b/luni/src/main/java/libcore/io/ForwardingOs.java
@@ -18,6 +18,8 @@ package libcore.io;
import android.system.ErrnoException;
import android.system.GaiException;
+import android.system.Int32Ref;
+import android.system.Int64Ref;
import android.system.StructAddrinfo;
import android.system.StructCapUserData;
import android.system.StructCapUserHeader;
@@ -41,8 +43,6 @@ import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
-import libcore.util.MutableInt;
-import libcore.util.MutableLong;
/**
* Subclass this if you want to override some {@link Os} methods but otherwise delegate.
@@ -117,7 +117,7 @@ public class ForwardingOs implements Os {
public InetAddress inet_pton(int family, String address) { return os.inet_pton(family, address); }
public int ioctlFlags(FileDescriptor fd, String interfaceName) throws ErrnoException { return os.ioctlFlags(fd, interfaceName); };
public InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException { return os.ioctlInetAddress(fd, cmd, interfaceName); }
- public int ioctlInt(FileDescriptor fd, int cmd, MutableInt arg) throws ErrnoException { return os.ioctlInt(fd, cmd, arg); }
+ public int ioctlInt(FileDescriptor fd, int cmd, Int32Ref arg) throws ErrnoException { return os.ioctlInt(fd, cmd, arg); }
public int ioctlMTU(FileDescriptor fd, String interfaceName) throws ErrnoException { return os.ioctlMTU(fd, interfaceName); };
public boolean isatty(FileDescriptor fd) { return os.isatty(fd); }
public void kill(int pid, int signal) throws ErrnoException { os.kill(pid, signal); }
@@ -154,7 +154,7 @@ public class ForwardingOs implements Os {
public void remove(String path) throws ErrnoException { os.remove(path); }
public void removexattr(String path, String name) throws ErrnoException { os.removexattr(path, name); }
public void rename(String oldPath, String newPath) throws ErrnoException { os.rename(oldPath, newPath); }
- public long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount) throws ErrnoException { return os.sendfile(outFd, inFd, inOffset, byteCount); }
+ public long sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount) throws ErrnoException { return os.sendfile(outFd, inFd, offset, byteCount); }
public int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException { return os.sendto(fd, buffer, flags, inetAddress, port); }
public int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException { return os.sendto(fd, bytes, byteOffset, byteCount, flags, inetAddress, port); }
public int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, SocketAddress address) throws ErrnoException, SocketException { return os.sendto(fd, bytes, byteOffset, byteCount, flags, address); }
@@ -191,7 +191,7 @@ public class ForwardingOs implements Os {
public StructUtsname uname() { return os.uname(); }
public void unlink(String pathname) throws ErrnoException { os.unlink(pathname); }
public void unsetenv(String name) throws ErrnoException { os.unsetenv(name); }
- public int waitpid(int pid, MutableInt status, int options) throws ErrnoException { return os.waitpid(pid, status, options); }
+ public int waitpid(int pid, Int32Ref status, int options) throws ErrnoException { return os.waitpid(pid, status, options); }
public int write(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException { return os.write(fd, buffer); }
public int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException, InterruptedIOException { return os.write(fd, bytes, byteOffset, byteCount); }
public int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException, InterruptedIOException { return os.writev(fd, buffers, offsets, byteCounts); }
diff --git a/luni/src/main/java/libcore/io/IoBridge.java b/luni/src/main/java/libcore/io/IoBridge.java
index a67a7c50c2..a950bf5bcf 100644
--- a/luni/src/main/java/libcore/io/IoBridge.java
+++ b/luni/src/main/java/libcore/io/IoBridge.java
@@ -17,6 +17,7 @@
package libcore.io;
import android.system.ErrnoException;
+import android.system.Int32Ref;
import android.system.StructGroupReq;
import android.system.StructLinger;
import android.system.StructPollfd;
@@ -42,7 +43,6 @@ import java.net.UnknownHostException;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.concurrent.TimeUnit;
-import libcore.util.MutableInt;
import static android.system.OsConstants.*;
@@ -56,7 +56,7 @@ public final class IoBridge {
public static int available(FileDescriptor fd) throws IOException {
try {
- MutableInt available = new MutableInt(0);
+ Int32Ref available = new Int32Ref(0);
Libcore.os.ioctlInt(fd, FIONREAD, available);
if (available.value < 0) {
// If the fd refers to a regular file, the result is the difference between
diff --git a/luni/src/main/java/libcore/io/Linux.java b/luni/src/main/java/libcore/io/Linux.java
index 2fad632b21..36244f5138 100644
--- a/luni/src/main/java/libcore/io/Linux.java
+++ b/luni/src/main/java/libcore/io/Linux.java
@@ -18,6 +18,8 @@ package libcore.io;
import android.system.ErrnoException;
import android.system.GaiException;
+import android.system.Int32Ref;
+import android.system.Int64Ref;
import android.system.StructAddrinfo;
import android.system.StructCapUserData;
import android.system.StructCapUserHeader;
@@ -42,8 +44,6 @@ import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
import java.nio.NioUtils;
-import libcore.util.MutableInt;
-import libcore.util.MutableLong;
public final class Linux implements Os {
Linux() { }
@@ -108,7 +108,7 @@ public final class Linux implements Os {
public native InetAddress inet_pton(int family, String address);
public native int ioctlFlags(FileDescriptor fd, String interfaceName) throws ErrnoException;
public native InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException;
- public native int ioctlInt(FileDescriptor fd, int cmd, MutableInt arg) throws ErrnoException;
+ public native int ioctlInt(FileDescriptor fd, int cmd, Int32Ref arg) throws ErrnoException;
public native int ioctlMTU(FileDescriptor fd, String interfaceName) throws ErrnoException;
public native boolean isatty(FileDescriptor fd);
public native void kill(int pid, int signal) throws ErrnoException;
@@ -209,7 +209,7 @@ public final class Linux implements Os {
public native void remove(String path) throws ErrnoException;
public native void removexattr(String path, String name) throws ErrnoException;
public native void rename(String oldPath, String newPath) throws ErrnoException;
- public native long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount) throws ErrnoException;
+ public native long sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount) throws ErrnoException;
public int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException {
final int bytesSent;
final int position = buffer.position();
@@ -271,7 +271,7 @@ public final class Linux implements Os {
public native StructUtsname uname();
public native void unlink(String pathname) throws ErrnoException;
public native void unsetenv(String name) throws ErrnoException;
- public native int waitpid(int pid, MutableInt status, int options) throws ErrnoException;
+ public native int waitpid(int pid, Int32Ref status, int options) throws ErrnoException;
public int write(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException {
final int bytesWritten;
final int position = buffer.position();
diff --git a/luni/src/main/java/libcore/io/Os.java b/luni/src/main/java/libcore/io/Os.java
index f7ca995c32..fffc479b20 100644
--- a/luni/src/main/java/libcore/io/Os.java
+++ b/luni/src/main/java/libcore/io/Os.java
@@ -18,6 +18,8 @@ package libcore.io;
import android.system.ErrnoException;
import android.system.GaiException;
+import android.system.Int32Ref;
+import android.system.Int64Ref;
import android.system.StructAddrinfo;
import android.system.StructCapUserData;
import android.system.StructCapUserHeader;
@@ -41,8 +43,6 @@ import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
-import libcore.util.MutableInt;
-import libcore.util.MutableLong;
public interface Os {
public FileDescriptor accept(FileDescriptor fd, SocketAddress peerAddress) throws ErrnoException, SocketException;
@@ -106,7 +106,7 @@ public interface Os {
public InetAddress inet_pton(int family, String address);
public int ioctlFlags(FileDescriptor fd, String interfaceName) throws ErrnoException;
public InetAddress ioctlInetAddress(FileDescriptor fd, int cmd, String interfaceName) throws ErrnoException;
- public int ioctlInt(FileDescriptor fd, int cmd, MutableInt arg) throws ErrnoException;
+ public int ioctlInt(FileDescriptor fd, int cmd, Int32Ref arg) throws ErrnoException;
public int ioctlMTU(FileDescriptor fd, String interfaceName) throws ErrnoException;
public boolean isatty(FileDescriptor fd);
public void kill(int pid, int signal) throws ErrnoException;
@@ -147,7 +147,7 @@ public interface Os {
public int sendto(FileDescriptor fd, ByteBuffer buffer, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException;
public int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, InetAddress inetAddress, int port) throws ErrnoException, SocketException;
public int sendto(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount, int flags, SocketAddress address) throws ErrnoException, SocketException;
- public long sendfile(FileDescriptor outFd, FileDescriptor inFd, MutableLong inOffset, long byteCount) throws ErrnoException;
+ public long sendfile(FileDescriptor outFd, FileDescriptor inFd, Int64Ref offset, long byteCount) throws ErrnoException;
public void setegid(int egid) throws ErrnoException;
public void setenv(String name, String value, boolean overwrite) throws ErrnoException;
public void seteuid(int euid) throws ErrnoException;
@@ -181,7 +181,7 @@ public interface Os {
public StructUtsname uname();
public void unlink(String pathname) throws ErrnoException;
public void unsetenv(String name) throws ErrnoException;
- public int waitpid(int pid, MutableInt status, int options) throws ErrnoException;
+ public int waitpid(int pid, Int32Ref status, int options) throws ErrnoException;
public int write(FileDescriptor fd, ByteBuffer buffer) throws ErrnoException, InterruptedIOException;
public int write(FileDescriptor fd, byte[] bytes, int byteOffset, int byteCount) throws ErrnoException, InterruptedIOException;
public int writev(FileDescriptor fd, Object[] buffers, int[] offsets, int[] byteCounts) throws ErrnoException, InterruptedIOException;
diff --git a/luni/src/main/java/libcore/util/MutableInt.java b/luni/src/main/java/libcore/util/MutableInt.java
deleted file mode 100644
index 739a04b59c..0000000000
--- a/luni/src/main/java/libcore/util/MutableInt.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package libcore.util;
-
-/**
- * Libcore-internal version of {@code android.util.MutableInt}. Code outside libcore
- * should use that class instead.
- * @hide
- */
-public class MutableInt {
- public int value;
-
- public MutableInt(int value) {
- this.value = value;
- }
-}
diff --git a/luni/src/main/java/libcore/util/MutableLong.java b/luni/src/main/java/libcore/util/MutableLong.java
deleted file mode 100644
index 7725df4431..0000000000
--- a/luni/src/main/java/libcore/util/MutableLong.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package libcore.util;
-
-/**
- * Libcore-internal version of {@code android.util.MutableLong}. Code outside libcore
- * should use that class instead.
- * @hide
- */
-public class MutableLong {
- public long value;
-
- public MutableLong(long value) {
- this.value = value;
- }
-}
diff --git a/luni/src/main/native/libcore_io_Linux.cpp b/luni/src/main/native/libcore_io_Linux.cpp
index 15d8c708a0..9fa06a3518 100644
--- a/luni/src/main/native/libcore_io_Linux.cpp
+++ b/luni/src/main/native/libcore_io_Linux.cpp
@@ -78,8 +78,8 @@
namespace {
-jfieldID mutableIntValueFid;
-jfieldID mutableLongValueFid;
+jfieldID int32RefValueFid;
+jfieldID int64RefValueFid;
} // namespace
@@ -1695,10 +1695,10 @@ static jint Linux_ioctlInt(JNIEnv* env, jobject, jobject javaFd, jint cmd, jobje
// This is complicated because ioctls may return their result by updating their argument
// or via their return value, so we need to support both.
int fd = jniGetFDFromFileDescriptor(env, javaFd);
- jint arg = env->GetIntField(javaArg, mutableIntValueFid);
+ jint arg = env->GetIntField(javaArg, int32RefValueFid);
int rc = throwIfMinusOne(env, "ioctl", TEMP_FAILURE_RETRY(ioctl(fd, cmd, &arg)));
if (!env->ExceptionCheck()) {
- env->SetIntField(javaArg, mutableIntValueFid, arg);
+ env->SetIntField(javaArg, int32RefValueFid, arg);
}
return rc;
}
@@ -2106,7 +2106,7 @@ static jlong Linux_sendfile(JNIEnv* env, jobject, jobject javaOutFd, jobject jav
off_t* offsetPtr = NULL;
if (javaOffset != NULL) {
// TODO: fix bionic so we can have a 64-bit off_t!
- offset = env->GetLongField(javaOffset, mutableLongValueFid);
+ offset = env->GetLongField(javaOffset, int64RefValueFid);
offsetPtr = &offset;
}
jlong result = throwIfMinusOne(env, "sendfile", TEMP_FAILURE_RETRY(sendfile(outFd, inFd, offsetPtr, byteCount)));
@@ -2114,7 +2114,7 @@ static jlong Linux_sendfile(JNIEnv* env, jobject, jobject javaOutFd, jobject jav
return -1;
}
if (javaOffset != NULL) {
- env->SetLongField(javaOffset, mutableLongValueFid, offset);
+ env->SetLongField(javaOffset, int64RefValueFid, offset);
}
return result;
}
@@ -2422,7 +2422,7 @@ static jint Linux_waitpid(JNIEnv* env, jobject, jint pid, jobject javaStatus, ji
int status;
int rc = throwIfMinusOne(env, "waitpid", TEMP_FAILURE_RETRY(waitpid(pid, &status, options)));
if (rc != -1) {
- env->SetIntField(javaStatus, mutableIntValueFid, status);
+ env->SetIntField(javaStatus, int32RefValueFid, status);
}
return rc;
}
@@ -2506,7 +2506,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Linux, inet_pton, "(ILjava/lang/String;)Ljava/net/InetAddress;"),
NATIVE_METHOD(Linux, ioctlFlags, "(Ljava/io/FileDescriptor;Ljava/lang/String;)I"),
NATIVE_METHOD(Linux, ioctlInetAddress, "(Ljava/io/FileDescriptor;ILjava/lang/String;)Ljava/net/InetAddress;"),
- NATIVE_METHOD(Linux, ioctlInt, "(Ljava/io/FileDescriptor;ILlibcore/util/MutableInt;)I"),
+ NATIVE_METHOD(Linux, ioctlInt, "(Ljava/io/FileDescriptor;ILandroid/system/Int32Ref;)I"),
NATIVE_METHOD(Linux, ioctlMTU, "(Ljava/io/FileDescriptor;Ljava/lang/String;)I"),
NATIVE_METHOD(Linux, isatty, "(Ljava/io/FileDescriptor;)Z"),
NATIVE_METHOD(Linux, kill, "(II)V"),
@@ -2539,7 +2539,7 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Linux, remove, "(Ljava/lang/String;)V"),
NATIVE_METHOD(Linux, removexattr, "(Ljava/lang/String;Ljava/lang/String;)V"),
NATIVE_METHOD(Linux, rename, "(Ljava/lang/String;Ljava/lang/String;)V"),
- NATIVE_METHOD(Linux, sendfile, "(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Llibcore/util/MutableLong;J)J"),
+ NATIVE_METHOD(Linux, sendfile, "(Ljava/io/FileDescriptor;Ljava/io/FileDescriptor;Landroid/system/Int64Ref;J)J"),
NATIVE_METHOD(Linux, sendtoBytes, "(Ljava/io/FileDescriptor;Ljava/lang/Object;IIILjava/net/InetAddress;I)I"),
NATIVE_METHOD_OVERLOAD(Linux, sendtoBytes, "(Ljava/io/FileDescriptor;Ljava/lang/Object;IIILjava/net/SocketAddress;)I", SocketAddress),
NATIVE_METHOD(Linux, setegid, "(I)V"),
@@ -2575,22 +2575,22 @@ static JNINativeMethod gMethods[] = {
NATIVE_METHOD(Linux, uname, "()Landroid/system/StructUtsname;"),
NATIVE_METHOD(Linux, unlink, "(Ljava/lang/String;)V"),
NATIVE_METHOD(Linux, unsetenv, "(Ljava/lang/String;)V"),
- NATIVE_METHOD(Linux, waitpid, "(ILlibcore/util/MutableInt;I)I"),
+ NATIVE_METHOD(Linux, waitpid, "(ILandroid/system/Int32Ref;I)I"),
NATIVE_METHOD(Linux, writeBytes, "(Ljava/io/FileDescriptor;Ljava/lang/Object;II)I"),
NATIVE_METHOD(Linux, writev, "(Ljava/io/FileDescriptor;[Ljava/lang/Object;[I[I)I"),
};
void register_libcore_io_Linux(JNIEnv* env) {
// Note: it is safe to only cache the fields as boot classpath classes are never
// unloaded.
- ScopedLocalRef<jclass> mutableIntClass(env, env->FindClass("libcore/util/MutableInt"));
- CHECK(mutableIntClass != nullptr);
- mutableIntValueFid = env->GetFieldID(mutableIntClass.get(), "value", "I");
- CHECK(mutableIntValueFid != nullptr);
-
- ScopedLocalRef<jclass> mutableLongClass(env, env->FindClass("libcore/util/MutableLong"));
- CHECK(mutableLongClass != nullptr);
- mutableLongValueFid = env->GetFieldID(mutableLongClass.get(), "value", "J");
- CHECK(mutableLongValueFid != nullptr);
+ ScopedLocalRef<jclass> int32RefClass(env, env->FindClass("android/system/Int32Ref"));
+ CHECK(int32RefClass != nullptr);
+ int32RefValueFid = env->GetFieldID(int32RefClass.get(), "value", "I");
+ CHECK(int32RefValueFid != nullptr);
+
+ ScopedLocalRef<jclass> int64RefClass(env, env->FindClass("android/system/Int64Ref"));
+ CHECK(int64RefClass != nullptr);
+ int64RefValueFid = env->GetFieldID(int64RefClass.get(), "value", "J");
+ CHECK(int64RefValueFid != nullptr);
jniRegisterNativeMethods(env, "libcore/io/Linux", gMethods, NELEM(gMethods));
}
diff --git a/luni/src/test/java/libcore/java/util/TreeMapTest.java b/luni/src/test/java/libcore/java/util/TreeMapTest.java
index 7c98ecd22d..cdb9699948 100644
--- a/luni/src/test/java/libcore/java/util/TreeMapTest.java
+++ b/luni/src/test/java/libcore/java/util/TreeMapTest.java
@@ -614,33 +614,6 @@ public class TreeMapTest extends TestCase {
return bound == '[' || bound == '(';
}
- // http://b//26336181
- //
- // Note that this is only worth working around because these bogus comparators worked
- // somewhat-fine on M and below provided that :
- //
- // (1) put was called with distinct elements (i.e, with no two elements equal() to each other)
- // (2) get or get-like methods are never called
- //
- // These comparators are clearly bogus but are somewhat common.
- public void testTreeMapWithBogusComparator() {
- TreeMap<String, String> treeMap = new TreeMap<String, String>(
- new Comparator<String>() {
- @Override
- public int compare(String o1, String o2) {
- if (o1.equals(o2)) {
- throw new IllegalArgumentException("Expected unequal elements");
- }
-
- return o1.compareTo(o2);
- }
- }
- );
-
- treeMap.put("candy", "floss");
- treeMap.put("cheddar", "cheese");
- }
-
public void test_spliterator_keySet() {
TreeMap<String, String> treeMap = new TreeMap<>();
// Elements are added out of order to ensure ordering is still preserved.
diff --git a/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java b/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java
index d287b972ad..5e174bde5e 100644
--- a/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java
+++ b/luni/src/test/java/libcore/javax/crypto/spec/KeyFactoryTestRSA.java
@@ -15,10 +15,16 @@
*/
package libcore.javax.crypto.spec;
+import java.security.KeyFactory;
import java.security.KeyPair;
+import java.security.PrivateKey;
+import java.security.PublicKey;
+import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.RSAPrivateKeySpec;
import java.security.spec.RSAPublicKeySpec;
+import java.security.spec.X509EncodedKeySpec;
import tests.security.CipherAsymmetricCryptHelper;
+import tests.security.DefaultKeys;
import tests.security.KeyFactoryTest;
public class KeyFactoryTestRSA extends
@@ -33,4 +39,20 @@ public class KeyFactoryTestRSA extends
protected void check(KeyPair keyPair) throws Exception {
new CipherAsymmetricCryptHelper("RSA").test(keyPair);
}
+
+ public void testExtraBufferSpace_Private() throws Exception {
+ PrivateKey privateKey = DefaultKeys.getPrivateKey("RSA");
+ byte[] encoded = privateKey.getEncoded();
+ byte[] longBuffer = new byte[encoded.length + 147];
+ System.arraycopy(encoded, 0, longBuffer, 0, encoded.length);
+ KeyFactory.getInstance("RSA").generatePrivate(new PKCS8EncodedKeySpec(longBuffer));
+ }
+
+ public void testExtraBufferSpace_Public() throws Exception {
+ PublicKey publicKey = DefaultKeys.getPublicKey("RSA");
+ byte[] encoded = publicKey.getEncoded();
+ byte[] longBuffer = new byte[encoded.length + 147];
+ System.arraycopy(encoded, 0, longBuffer, 0, encoded.length);
+ KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(longBuffer));
+ }
}
diff --git a/luni/src/test/java/libcore/libcore/icu/TransliteratorTest.java b/luni/src/test/java/libcore/libcore/icu/TransliteratorTest.java
index fbfd73b440..d1e1483c7d 100644
--- a/luni/src/test/java/libcore/libcore/icu/TransliteratorTest.java
+++ b/luni/src/test/java/libcore/libcore/icu/TransliteratorTest.java
@@ -71,7 +71,7 @@ public class TransliteratorTest extends junit.framework.TestCase {
// Use alternative transliteration variants.
t = Transliterator.getInstance("Greek-Latin/BGN");
- assertEquals("Kalēméra kósme!", t.transliterate(greek));
+ assertEquals("Kaliméra kósme!", t.transliterate(greek));
t = Transliterator.getInstance("Greek-Latin/UNGEGN");
assertEquals("Kali̱méra kósme!",t.transliterate(greek));
}
diff --git a/luni/src/test/java/libcore/libcore/io/BlockGuardOsTest.java b/luni/src/test/java/libcore/libcore/io/BlockGuardOsTest.java
index 710d3be5dd..70155214f2 100644
--- a/luni/src/test/java/libcore/libcore/io/BlockGuardOsTest.java
+++ b/luni/src/test/java/libcore/libcore/io/BlockGuardOsTest.java
@@ -158,7 +158,7 @@ public class BlockGuardOsTest {
"inet_pton(int,java.lang.String)",
"ioctlFlags(java.io.FileDescriptor,java.lang.String)",
"ioctlInetAddress(java.io.FileDescriptor,int,java.lang.String)",
- "ioctlInt(java.io.FileDescriptor,int,libcore.util.MutableInt)",
+ "ioctlInt(java.io.FileDescriptor,int,android.system.Int32Ref)",
"ioctlMTU(java.io.FileDescriptor,java.lang.String)",
"isatty(java.io.FileDescriptor)",
"kill(int,int)",
@@ -197,7 +197,7 @@ public class BlockGuardOsTest {
"umask(int)",
"uname()",
"unsetenv(java.lang.String)",
- "waitpid(int,libcore.util.MutableInt,int)" );
+ "waitpid(int,android.system.Int32Ref,int)");
Set<String> methodsNotRequiredBlockGuardCheckSet = new HashSet<>(
methodsNotRequireBlockGuardChecks);
diff --git a/luni/src/test/java/libcore/libcore/io/OsTest.java b/luni/src/test/java/libcore/libcore/io/OsTest.java
index 5d3616cc83..bc15df09a8 100644
--- a/luni/src/test/java/libcore/libcore/io/OsTest.java
+++ b/luni/src/test/java/libcore/libcore/io/OsTest.java
@@ -54,7 +54,6 @@ import junit.framework.TestCase;
import libcore.io.IoBridge;
import libcore.io.IoUtils;
import libcore.io.Libcore;
-import libcore.util.MutableLong;
import static android.system.OsConstants.*;
import static libcore.libcore.io.OsTest.SendFileImpl.ANDROID_SYSTEM_OS_INT64_REF;
@@ -839,7 +838,7 @@ public class OsTest extends TestCase {
public void test_sendfile_errno() throws Exception {
try {
// FileDescriptor.out is not open for input, will cause EBADF
- MutableLong offset = new MutableLong(10);
+ Int64Ref offset = new Int64Ref(10);
Libcore.os.sendfile(FileDescriptor.out, FileDescriptor.out, offset, 10);
fail();
} catch(ErrnoException expected) {
@@ -901,8 +900,7 @@ public class OsTest extends TestCase {
break;
}
case LIBCORE_OS: {
- libcore.util.MutableLong offset = (startOffset == null) ? null :
- new libcore.util.MutableLong(startOffset);
+ Int64Ref offset = (startOffset == null) ? null : new Int64Ref(startOffset);
libcore.io.Libcore.os.sendfile(outFd, inFd, offset, maxBytes);
assertEquals(expectedEndOffset, offset == null ? null : offset.value);
break;
diff --git a/non_openjdk_java_files.bp b/non_openjdk_java_files.bp
index e37a84aa1b..63064c8280 100644
--- a/non_openjdk_java_files.bp
+++ b/non_openjdk_java_files.bp
@@ -27,8 +27,6 @@ filegroup {
"luni/src/main/java/android/system/StructTimespec.java",
"luni/src/main/java/android/system/StructUcred.java",
"luni/src/main/java/android/system/StructUtsname.java",
- "luni/src/main/java/libcore/util/MutableInt.java",
- "luni/src/main/java/libcore/util/MutableLong.java",
"dalvik/src/main/java/dalvik/annotation/AnnotationDefault.java",
"dalvik/src/main/java/dalvik/annotation/EnclosingClass.java",
"dalvik/src/main/java/dalvik/annotation/EnclosingMethod.java",
diff --git a/ojluni/src/main/java/java/lang/Thread.java b/ojluni/src/main/java/java/lang/Thread.java
index 0419edeef2..d4620337af 100644
--- a/ojluni/src/main/java/java/lang/Thread.java
+++ b/ojluni/src/main/java/java/lang/Thread.java
@@ -1941,7 +1941,7 @@ class Thread implements Runnable {
*
* @hide
*/
- // @VisibleForTesting (would be private if not for tests)
+ // @VisibleForTesting (would be package-private if not for tests)
public final void dispatchUncaughtException(Throwable e) {
Thread.UncaughtExceptionHandler initialUeh =
Thread.getUncaughtExceptionPreHandler();
diff --git a/ojluni/src/main/java/java/nio/ByteBuffer.java b/ojluni/src/main/java/java/nio/ByteBuffer.java
index 7f51a6144f..e4a8d0f358 100644
--- a/ojluni/src/main/java/java/nio/ByteBuffer.java
+++ b/ojluni/src/main/java/java/nio/ByteBuffer.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -38,43 +38,47 @@ import libcore.io.Memory;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(byte) </code><i>put</i><code>} methods that read and write
- * single bytes; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(byte) <i>put</i>} methods that read and write
+ * single bytes; </p></li>
*
- * <li><p> Relative {@link #get(byte[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of bytes from this buffer
- * into an array; </p></li>
+ * <li><p> Relative {@link #get(byte[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of bytes from this buffer
+ * into an array; </p></li>
*
- * <li><p> Relative {@link #put(byte[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of bytes from a
- * byte array or some other byte
- * buffer into this buffer; </p></li>
+ * <li><p> Relative {@link #put(byte[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of bytes from a
+ * byte array or some other byte
+ * buffer into this buffer; </p></li>
*
- * <li><p> Absolute and relative {@link #getChar() </code><i>get</i><code>}
- * and {@link #putChar(char) </code><i>put</i><code>} methods that read and
- * write values of other primitive types, translating them to and from
- * sequences of bytes in a particular byte order; </p></li>
*
- * <li><p> Methods for creating <i><a href="#views">view buffers</a></i>,
- * which allow a byte buffer to be viewed as a buffer containing values of
- * some other primitive type; and </p></li>
+ * <li><p> Absolute and relative {@link #getChar() <i>get</i>}
+ * and {@link #putChar(char) <i>put</i>} methods that read and
+ * write values of other primitive types, translating them to and from
+ * sequences of bytes in a particular byte order; </p></li>
*
+ * <li><p> Methods for creating <i><a href="#views">view buffers</a></i>,
+ * which allow a byte buffer to be viewed as a buffer containing values of
+ * some other primitive type; and </p></li>
*
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} a byte buffer. </p></li>
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * a byte buffer. </p></li>
*
* </ul>
*
* <p> Byte buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
- * content, or by {@link #wrap(byte[]) </code><i>wrapping</i><code>} an
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
+ *
+ * content, or by {@link #wrap(byte[]) <i>wrapping</i>} an
* existing byte array into a buffer.
*
- * <a name="direct">
- * <h4> Direct <i>vs.</i> non-direct buffers </h4>
+ *
+ *
+ * <a name="direct"></a>
+ * <h2> Direct <i>vs.</i> non-direct buffers </h2>
*
* <p> A byte buffer is either <i>direct</i> or <i>non-direct</i>. Given a
* direct byte buffer, the Java virtual machine will make a best effort to
@@ -95,7 +99,7 @@ import libcore.io.Memory;
* buffers only when they yield a measureable gain in program performance.
*
* <p> A direct byte buffer may also be created by {@link
- * java.nio.channels.FileChannel#map </code>mapping<code>} a region of a file
+ * java.nio.channels.FileChannel#map mapping} a region of a file
* directly into memory. An implementation of the Java platform may optionally
* support the creation of direct byte buffers from native code via JNI. If an
* instance of one of these kinds of buffers refers to an inaccessible region
@@ -107,8 +111,9 @@ import libcore.io.Memory;
* invoking its {@link #isDirect isDirect} method. This method is provided so
* that explicit buffer management can be done in performance-critical code.
*
- * <a name="bin">
- * <h4> Access to binary data </h4>
+ *
+ * <a name="bin"></a>
+ * <h2> Access to binary data </h2>
*
* <p> This class defines methods for reading and writing values of all other
* primitive types, except <tt>boolean</tt>. Primitive values are translated
@@ -127,14 +132,14 @@ import libcore.io.Memory;
* float {@link #getFloat()}
* float {@link #getFloat(int) getFloat(int index)}
* void {@link #putFloat(float) putFloat(float f)}
- * void {@link #putFloat(int, float) putFloat(int index, float f)}</pre></blockquote>
+ * void {@link #putFloat(int,float) putFloat(int index, float f)}</pre></blockquote>
*
* <p> Corresponding methods are defined for the types <tt>char</tt>,
* <tt>short</tt>, <tt>int</tt>, <tt>long</tt>, and <tt>double</tt>. The index
* parameters of the absolute <i>get</i> and <i>put</i> methods are in terms of
* bytes rather than of the type being read or written.
*
- * <a name="views">
+ * <a name="views"></a>
*
* <p> For access to homogeneous binary data, that is, sequences of values of
* the same type, this class defines methods that can create <i>views</i> of a
@@ -153,27 +158,31 @@ import libcore.io.Memory;
*
* <ul>
*
- * <li><p> A view buffer is indexed not in terms of bytes but rather in terms
- * of the type-specific size of its values; </p></li>
+ * <li><p> A view buffer is indexed not in terms of bytes but rather in terms
+ * of the type-specific size of its values; </p></li>
*
- * <li><p> A view buffer provides relative bulk <i>get</i> and <i>put</i>
- * methods that can transfer contiguous sequences of values between a buffer
- * and an array or some other buffer of the same type; and </p></li>
+ * <li><p> A view buffer provides relative bulk <i>get</i> and <i>put</i>
+ * methods that can transfer contiguous sequences of values between a buffer
+ * and an array or some other buffer of the same type; and </p></li>
*
- * <li><p> A view buffer is potentially much more efficient because it will
- * be direct if, and only if, its backing byte buffer is direct. </p></li>
+ * <li><p> A view buffer is potentially much more efficient because it will
+ * be direct if, and only if, its backing byte buffer is direct. </p></li>
*
* </ul>
*
* <p> The byte order of a view buffer is fixed to be that of its byte buffer
* at the time that the view is created. </p>
*
- * <h4> Invocation chaining </h4>
+*
+*
+ *
+ * <h2> Invocation chaining </h2>
*
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
*
+ *
* The sequence of statements
*
* <blockquote><pre>
@@ -186,14 +195,17 @@ import libcore.io.Memory;
* <blockquote><pre>
* bb.putInt(0xCAFEBABE).putShort(3).putShort(45);</pre></blockquote>
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class ByteBuffer
- extends Buffer
- implements Comparable<ByteBuffer> {
+ extends Buffer
+ implements Comparable<ByteBuffer>
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -207,7 +219,8 @@ public abstract class ByteBuffer
// backing array, and array offset
//
ByteBuffer(int mark, int pos, int lim, int cap, // package-private
- byte[] hb, int offset) {
+ byte[] hb, int offset)
+ {
super(mark, pos, lim, cap, 0);
this.hb = hb;
this.offset = offset;
@@ -226,11 +239,15 @@ public abstract class ByteBuffer
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
* initialized to zero. Whether or not it has a
- * {@link #hasArray </code>backing array<code>} is unspecified.
+ * {@link #hasArray backing array} is unspecified.
*
- * @param capacity The new buffer's capacity, in bytes
- * @return The new byte buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @param capacity
+ * The new buffer's capacity, in bytes
+ *
+ * @return The new byte buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static ByteBuffer allocateDirect(int capacity) {
if (capacity < 0) {
@@ -247,13 +264,16 @@ public abstract class ByteBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
+ *
+ * @param capacity
+ * The new buffer's capacity, in bytes
*
- * @param capacity The new buffer's capacity, in bytes
- * @return The new byte buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @return The new byte buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static ByteBuffer allocate(int capacity) {
if (capacity < 0)
@@ -269,24 +289,32 @@ public abstract class ByteBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new byte buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new byte buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static ByteBuffer wrap(byte[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapByteBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -301,12 +329,14 @@ public abstract class ByteBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new byte buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new byte buffer
*/
public static ByteBuffer wrap(byte[] array) {
return wrap(array, 0, array.length);
@@ -328,7 +358,7 @@ public abstract class ByteBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new byte buffer
+ * @return The new byte buffer
*/
public abstract ByteBuffer slice();
@@ -345,7 +375,7 @@ public abstract class ByteBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new byte buffer
+ * @return The new byte buffer
*/
public abstract ByteBuffer duplicate();
@@ -365,7 +395,7 @@ public abstract class ByteBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only byte buffer
+ * @return The new, read-only byte buffer
*/
public abstract ByteBuffer asReadOnlyBuffer();
@@ -374,11 +404,12 @@ public abstract class ByteBuffer
/**
* Relative <i>get</i> method. Reads the byte at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
+ *
+ * @return The byte at the buffer's current position
*
- * @return The byte at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract byte get();
@@ -388,22 +419,31 @@ public abstract class ByteBuffer
* <p> Writes the given byte into this buffer at the current
* position, and then increments the position. </p>
*
- * @param b The byte to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param b
+ * The byte to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer put(byte b);
/**
* Absolute <i>get</i> method. Reads the byte at the given
- * index. </p>
+ * index.
+ *
+ * @param index
+ * The index from which the byte will be read
*
- * @param index The index from which the byte will be read
- * @return The byte at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @return The byte at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract byte get(int index);
@@ -413,12 +453,20 @@ public abstract class ByteBuffer
* <p> Writes the given byte into this buffer at the given
* index. </p>
*
- * @param index The index at which the byte will be written
- * @param b The byte value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the byte will be written
+ *
+ * @param b
+ * The byte value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer put(int index, byte b);
@@ -444,26 +492,36 @@ public abstract class ByteBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient bytes in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which bytes are to be written
- * @param offset The offset within the array of the first byte to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of bytes to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> bytes
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which bytes are to be written
+ *
+ * @param offset
+ * The offset within the array of the first byte to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of bytes to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> bytes
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public ByteBuffer get(byte[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -485,9 +543,14 @@ public abstract class ByteBuffer
* <pre>
* src.get(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> bytes
- * remaining in this buffer
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> bytes
+ * remaining in this buffer
*/
public ByteBuffer get(byte[] dst) {
return get(dst, 0, dst.length);
@@ -519,15 +582,23 @@ public abstract class ByteBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The source buffer from which bytes are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining bytes in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which bytes are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining bytes in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public ByteBuffer put(ByteBuffer src) {
if (!isAccessible()) {
@@ -593,25 +664,37 @@ public abstract class ByteBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which bytes are to be read
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which bytes are to be read
+ *
+ * @param offset
+ * The offset within the array of the first byte to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of bytes to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public ByteBuffer put(byte[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -634,9 +717,16 @@ public abstract class ByteBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final ByteBuffer put(byte[] src) {
return put(src, 0, src.length);
@@ -653,11 +743,11 @@ public abstract class ByteBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
- return (hb != null) && !isReadOnly();
+ return (hb != null) && !isReadOnly;
}
/**
@@ -671,9 +761,13 @@ public abstract class ByteBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final byte[] array() {
if (hb == null)
@@ -694,10 +788,14 @@ public abstract class ByteBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -725,37 +823,42 @@ public abstract class ByteBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- *
+
*
* <p> Invoke this method after writing data from a buffer in case the
* write was incomplete. The following loop, for example, copies bytes
* from one channel to another via the buffer <tt>buf</tt>:
*
- * <blockquote><pre>
- * buf.clear(); // Prepare buffer for use
- * while (in.read(buf) >= 0 || buf.position != 0) {
- * buf.flip();
- * out.write(buf);
- * buf.compact(); // In case of partial write
+ * <blockquote><pre>{@code
+ * buf.clear(); // Prepare buffer for use
+ * while (in.read(buf) >= 0 || buf.position != 0) {
+ * buf.flip();
+ * out.write(buf);
+ * buf.compact(); // In case of partial write
+ * }
* }</pre></blockquote>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer compact();
/**
- * Tells whether or not this byte buffer is direct. </p>
+ * Tells whether or not this byte buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
/**
- * Returns a string summarizing the state of this buffer. </p>
+ * Returns a string summarizing the state of this buffer.
*
- * @return A summary string
+ * @return A summary string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -782,13 +885,13 @@ public abstract class ByteBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
int p = position();
for (int i = limit() - 1; i >= p; i--)
- h = 31 * h + (int) get(i);
+ h = 31 * h + (int)get(i);
return h;
}
@@ -797,38 +900,33 @@ public abstract class ByteBuffer
*
* <p> Two byte buffers are equal if, and only if,
*
- * <p><ol>
- *
- * <li><p> They have the same element type, </p></li>
- *
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
- *
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
- *
- *
+ * <ol>
*
+ * <li><p> They have the same element type, </p></li>
*
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- *
- *
- * </p></li>
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+
+ * </p></li>
*
* </ol>
*
* <p> A byte buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof ByteBuffer))
return false;
- ByteBuffer that = (ByteBuffer) ob;
+ ByteBuffer that = (ByteBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -860,13 +958,13 @@ public abstract class ByteBuffer
*
*
* Pairs of {@code byte} elements are compared as if by invoking
- * {@link Byte#compare(byte, byte)}.
- *
+ * {@link Byte#compare(byte,byte)}.
+
*
* <p> A byte buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(ByteBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -892,9 +990,9 @@ public abstract class ByteBuffer
boolean bigEndian // package-private
- = true;
+ = true;
boolean nativeByteOrder // package-private
- = (Bits.byteOrder() == ByteOrder.BIG_ENDIAN);
+ = (Bits.byteOrder() == ByteOrder.BIG_ENDIAN);
/**
* Retrieves this buffer's byte order.
@@ -904,31 +1002,32 @@ public abstract class ByteBuffer
* a newly-created byte buffer is always {@link ByteOrder#BIG_ENDIAN
* BIG_ENDIAN}. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public final ByteOrder order() {
return bigEndian ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN;
}
/**
- * Modifies this buffer's byte order. </p>
+ * Modifies this buffer's byte order.
+ *
+ * @param bo
+ * The new byte order,
+ * either {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}
+ * or {@link ByteOrder#LITTLE_ENDIAN LITTLE_ENDIAN}
*
- * @param bo The new byte order,
- * either {@link ByteOrder#BIG_ENDIAN BIG_ENDIAN}
- * or {@link ByteOrder#LITTLE_ENDIAN LITTLE_ENDIAN}
- * @return This buffer
+ * @return This buffer
*/
public final ByteBuffer order(ByteOrder bo) {
bigEndian = (bo == ByteOrder.BIG_ENDIAN);
nativeByteOrder =
- (bigEndian == (Bits.byteOrder() == ByteOrder.BIG_ENDIAN));
+ (bigEndian == (Bits.byteOrder() == ByteOrder.BIG_ENDIAN));
return this;
}
// Unchecked accessors, for use by ByteBufferAs-X-Buffer classes
//
abstract byte _get(int i); // package-private
-
abstract void _put(int i, byte b); // package-private
@@ -939,9 +1038,11 @@ public abstract class ByteBuffer
* composing them into a char value according to the current byte order,
* and then increments the position by two. </p>
*
- * @return The char value at the buffer's current position
- * @throws BufferUnderflowException If there are fewer than two bytes
- * remaining in this buffer
+ * @return The char value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
*/
public abstract char getChar();
@@ -953,11 +1054,17 @@ public abstract class ByteBuffer
* current byte order, into this buffer at the current position, and then
* increments the position by two. </p>
*
- * @param value The char value to be written
- * @return This buffer
- * @throws BufferOverflowException If there are fewer than two bytes
- * remaining in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param value
+ * The char value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putChar(char value);
@@ -967,11 +1074,15 @@ public abstract class ByteBuffer
* <p> Reads two bytes at the given index, composing them into a
* char value according to the current byte order. </p>
*
- * @param index The index from which the bytes will be read
- * @return The char value at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus one
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The char value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus one
*/
public abstract char getChar(int index);
@@ -990,13 +1101,21 @@ public abstract class ByteBuffer
* <p> Writes two bytes containing the given char value, in the
* current byte order, into this buffer at the given index. </p>
*
- * @param index The index at which the bytes will be written
- * @param value The char value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus one
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The char value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus one
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putChar(int index, char value);
@@ -1022,7 +1141,7 @@ public abstract class ByteBuffer
* if, and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return A new char buffer
+ * @return A new char buffer
*/
public abstract CharBuffer asCharBuffer();
@@ -1034,9 +1153,11 @@ public abstract class ByteBuffer
* composing them into a short value according to the current byte order,
* and then increments the position by two. </p>
*
- * @return The short value at the buffer's current position
- * @throws BufferUnderflowException If there are fewer than two bytes
- * remaining in this buffer
+ * @return The short value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
*/
public abstract short getShort();
@@ -1048,11 +1169,17 @@ public abstract class ByteBuffer
* current byte order, into this buffer at the current position, and then
* increments the position by two. </p>
*
- * @param value The short value to be written
- * @return This buffer
- * @throws BufferOverflowException If there are fewer than two bytes
- * remaining in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param value
+ * The short value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than two bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putShort(short value);
@@ -1062,11 +1189,15 @@ public abstract class ByteBuffer
* <p> Reads two bytes at the given index, composing them into a
* short value according to the current byte order. </p>
*
- * @param index The index from which the bytes will be read
- * @return The short value at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus one
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The short value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus one
*/
public abstract short getShort(int index);
@@ -1085,13 +1216,21 @@ public abstract class ByteBuffer
* <p> Writes two bytes containing the given short value, in the
* current byte order, into this buffer at the given index. </p>
*
- * @param index The index at which the bytes will be written
- * @param value The short value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus one
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The short value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus one
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putShort(int index, short value);
@@ -1117,7 +1256,7 @@ public abstract class ByteBuffer
* if, and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return A new short buffer
+ * @return A new short buffer
*/
public abstract ShortBuffer asShortBuffer();
@@ -1129,9 +1268,11 @@ public abstract class ByteBuffer
* composing them into an int value according to the current byte order,
* and then increments the position by four. </p>
*
- * @return The int value at the buffer's current position
- * @throws BufferUnderflowException If there are fewer than four bytes
- * remaining in this buffer
+ * @return The int value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
*/
public abstract int getInt();
@@ -1143,11 +1284,17 @@ public abstract class ByteBuffer
* current byte order, into this buffer at the current position, and then
* increments the position by four. </p>
*
- * @param value The int value to be written
- * @return This buffer
- * @throws BufferOverflowException If there are fewer than four bytes
- * remaining in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param value
+ * The int value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putInt(int value);
@@ -1157,11 +1304,15 @@ public abstract class ByteBuffer
* <p> Reads four bytes at the given index, composing them into a
* int value according to the current byte order. </p>
*
- * @param index The index from which the bytes will be read
- * @return The int value at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus three
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The int value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus three
*/
public abstract int getInt(int index);
@@ -1180,13 +1331,21 @@ public abstract class ByteBuffer
* <p> Writes four bytes containing the given int value, in the
* current byte order, into this buffer at the given index. </p>
*
- * @param index The index at which the bytes will be written
- * @param value The int value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus three
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The int value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus three
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putInt(int index, int value);
@@ -1212,7 +1371,7 @@ public abstract class ByteBuffer
* if, and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return A new int buffer
+ * @return A new int buffer
*/
public abstract IntBuffer asIntBuffer();
@@ -1224,9 +1383,11 @@ public abstract class ByteBuffer
* composing them into a long value according to the current byte order,
* and then increments the position by eight. </p>
*
- * @return The long value at the buffer's current position
- * @throws BufferUnderflowException If there are fewer than eight bytes
- * remaining in this buffer
+ * @return The long value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
*/
public abstract long getLong();
@@ -1238,11 +1399,17 @@ public abstract class ByteBuffer
* current byte order, into this buffer at the current position, and then
* increments the position by eight. </p>
*
- * @param value The long value to be written
- * @return This buffer
- * @throws BufferOverflowException If there are fewer than eight bytes
- * remaining in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param value
+ * The long value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putLong(long value);
@@ -1252,11 +1419,15 @@ public abstract class ByteBuffer
* <p> Reads eight bytes at the given index, composing them into a
* long value according to the current byte order. </p>
*
- * @param index The index from which the bytes will be read
- * @return The long value at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus seven
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The long value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
*/
public abstract long getLong(int index);
@@ -1275,13 +1446,21 @@ public abstract class ByteBuffer
* <p> Writes eight bytes containing the given long value, in the
* current byte order, into this buffer at the given index. </p>
*
- * @param index The index at which the bytes will be written
- * @param value The long value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus seven
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The long value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putLong(int index, long value);
@@ -1307,7 +1486,7 @@ public abstract class ByteBuffer
* if, and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return A new long buffer
+ * @return A new long buffer
*/
public abstract LongBuffer asLongBuffer();
@@ -1319,9 +1498,11 @@ public abstract class ByteBuffer
* composing them into a float value according to the current byte order,
* and then increments the position by four. </p>
*
- * @return The float value at the buffer's current position
- * @throws BufferUnderflowException If there are fewer than four bytes
- * remaining in this buffer
+ * @return The float value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
*/
public abstract float getFloat();
@@ -1333,11 +1514,17 @@ public abstract class ByteBuffer
* current byte order, into this buffer at the current position, and then
* increments the position by four. </p>
*
- * @param value The float value to be written
- * @return This buffer
- * @throws BufferOverflowException If there are fewer than four bytes
- * remaining in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param value
+ * The float value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than four bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putFloat(float value);
@@ -1347,11 +1534,15 @@ public abstract class ByteBuffer
* <p> Reads four bytes at the given index, composing them into a
* float value according to the current byte order. </p>
*
- * @param index The index from which the bytes will be read
- * @return The float value at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus three
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The float value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus three
*/
public abstract float getFloat(int index);
@@ -1370,13 +1561,21 @@ public abstract class ByteBuffer
* <p> Writes four bytes containing the given float value, in the
* current byte order, into this buffer at the given index. </p>
*
- * @param index The index at which the bytes will be written
- * @param value The float value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus three
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The float value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus three
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putFloat(int index, float value);
@@ -1402,7 +1601,7 @@ public abstract class ByteBuffer
* if, and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return A new float buffer
+ * @return A new float buffer
*/
public abstract FloatBuffer asFloatBuffer();
@@ -1414,9 +1613,11 @@ public abstract class ByteBuffer
* composing them into a double value according to the current byte order,
* and then increments the position by eight. </p>
*
- * @return The double value at the buffer's current position
- * @throws BufferUnderflowException If there are fewer than eight bytes
- * remaining in this buffer
+ * @return The double value at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
*/
public abstract double getDouble();
@@ -1428,11 +1629,17 @@ public abstract class ByteBuffer
* current byte order, into this buffer at the current position, and then
* increments the position by eight. </p>
*
- * @param value The double value to be written
- * @return This buffer
- * @throws BufferOverflowException If there are fewer than eight bytes
- * remaining in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param value
+ * The double value to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there are fewer than eight bytes
+ * remaining in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putDouble(double value);
@@ -1442,11 +1649,15 @@ public abstract class ByteBuffer
* <p> Reads eight bytes at the given index, composing them into a
* double value according to the current byte order. </p>
*
- * @param index The index from which the bytes will be read
- * @return The double value at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus seven
+ * @param index
+ * The index from which the bytes will be read
+ *
+ * @return The double value at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
*/
public abstract double getDouble(int index);
@@ -1465,13 +1676,21 @@ public abstract class ByteBuffer
* <p> Writes eight bytes containing the given double value, in the
* current byte order, into this buffer at the given index. </p>
*
- * @param index The index at which the bytes will be written
- * @param value The double value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit,
- * minus seven
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the bytes will be written
+ *
+ * @param value
+ * The double value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit,
+ * minus seven
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ByteBuffer putDouble(int index, double value);
@@ -1497,7 +1716,7 @@ public abstract class ByteBuffer
* if, and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return A new double buffer
+ * @return A new double buffer
*/
public abstract DoubleBuffer asDoubleBuffer();
diff --git a/ojluni/src/main/java/java/nio/CharBuffer.java b/ojluni/src/main/java/java/nio/CharBuffer.java
index 65eb2db60c..61265d7804 100644
--- a/ojluni/src/main/java/java/nio/CharBuffer.java
+++ b/ojluni/src/main/java/java/nio/CharBuffer.java
@@ -43,31 +43,37 @@ import java.util.stream.IntStream;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(char) </code><i>put</i><code>} methods that read and write
- * single chars; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(char) <i>put</i>} methods that read and write
+ * single chars; </p></li>
*
- * <li><p> Relative {@link #get(char[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of chars from this buffer
- * into an array; and</p></li>
+ * <li><p> Relative {@link #get(char[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of chars from this buffer
+ * into an array; and</p></li>
*
- * <li><p> Relative {@link #put(char[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of chars from a
- * char array,&#32;a&#32;string, or some other char
- * buffer into this buffer;&#32;and </p></li>
+ * <li><p> Relative {@link #put(char[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of chars from a
+ * char array,&#32;a&#32;string, or some other char
+ * buffer into this buffer;&#32;and </p></li>
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} a char buffer. </p></li>
+ *
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * a char buffer. </p></li>
*
* </ul>
*
* <p> Char buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
- * content, by {@link #wrap(char[]) </code><i>wrapping</i><code>} an existing
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
+ *
+ * content, by {@link #wrap(char[]) <i>wrapping</i>} an existing
* char array or&#32;string into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
+ *
+*
+ *
* <p> Like a byte buffer, a char buffer is either <a
* href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
* char buffer created via the <tt>wrap</tt> methods of this class will
@@ -76,11 +82,15 @@ import java.util.stream.IntStream;
* a char buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method. </p>
*
+*
+ *
* <p> This class implements the {@link CharSequence} interface so that
* character buffers may be used wherever character sequences are accepted, for
* example in the regular-expression package <tt>{@link java.util.regex}</tt>.
* </p>
*
+ *
+ *
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
@@ -99,14 +109,17 @@ import java.util.stream.IntStream;
* <blockquote><pre>
* cb.put("text/").put(subtype).put("; charset=").put(enc);</pre></blockquote>
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class CharBuffer
- extends Buffer
- implements Comparable<CharBuffer>, Appendable, CharSequence, Readable {
+ extends Buffer
+ implements Comparable<CharBuffer>, Appendable, CharSequence, Readable
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -120,7 +133,8 @@ public abstract class CharBuffer
// backing array, and array offset
//
CharBuffer(int mark, int pos, int lim, int cap, // package-private
- char[] hb, int offset) {
+ char[] hb, int offset)
+ {
super(mark, pos, lim, cap, 1);
this.hb = hb;
this.offset = offset;
@@ -138,13 +152,16 @@ public abstract class CharBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
+ *
+ * @param capacity
+ * The new buffer's capacity, in chars
+ *
+ * @return The new char buffer
*
- * @param capacity The new buffer's capacity, in chars
- * @return The new char buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static CharBuffer allocate(int capacity) {
if (capacity < 0)
@@ -160,24 +177,32 @@ public abstract class CharBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new char buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new char buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static CharBuffer wrap(char[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapCharBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -192,12 +217,14 @@ public abstract class CharBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new char buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new char buffer
*/
public static CharBuffer wrap(char[] array) {
return wrap(array, 0, array.length);
@@ -212,9 +239,9 @@ public abstract class CharBuffer
*
* @param target the buffer to read characters into
* @return The number of characters added to the buffer, or
- * -1 if this source of characters is at its end
- * @throws IOException if an I/O error occurs
- * @throws NullPointerException if target is null
+ * -1 if this source of characters is at its end
+ * @throws IOException if an I/O error occurs
+ * @throws NullPointerException if target is null
* @throws ReadOnlyBufferException if target is a read only buffer
* @since 1.5
*/
@@ -246,19 +273,26 @@ public abstract class CharBuffer
* <tt>csq.length()</tt>, its position will be <tt>start</tt>, its limit
* will be <tt>end</tt>, and its mark will be undefined. </p>
*
- * @param csq The character sequence from which the new character buffer is to
- * be created
- * @param start The index of the first character to be used;
- * must be non-negative and no larger than <tt>csq.length()</tt>.
- * The new buffer's position will be set to this value.
- * @param end The index of the character following the last character to be
- * used; must be no smaller than <tt>start</tt> and no larger
- * than <tt>csq.length()</tt>.
- * The new buffer's limit will be set to this value.
- * @return The new character buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>start</tt> and
- * <tt>end</tt>
- * parameters do not hold
+ * @param csq
+ * The character sequence from which the new character buffer is to
+ * be created
+ *
+ * @param start
+ * The index of the first character to be used;
+ * must be non-negative and no larger than <tt>csq.length()</tt>.
+ * The new buffer's position will be set to this value.
+ *
+ * @param end
+ * The index of the character following the last character to be
+ * used; must be no smaller than <tt>start</tt> and no larger
+ * than <tt>csq.length()</tt>.
+ * The new buffer's limit will be set to this value.
+ *
+ * @return The new character buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>start</tt> and <tt>end</tt>
+ * parameters do not hold
*/
public static CharBuffer wrap(CharSequence csq, int start, int end) {
try {
@@ -276,9 +310,11 @@ public abstract class CharBuffer
* <tt>csq.length()</tt>, its position will be zero, and its mark will be
* undefined. </p>
*
- * @param csq The character sequence from which the new character buffer is to
- * be created
- * @return The new character buffer
+ * @param csq
+ * The character sequence from which the new character buffer is to
+ * be created
+ *
+ * @return The new character buffer
*/
public static CharBuffer wrap(CharSequence csq) {
return wrap(csq, 0, csq.length());
@@ -300,7 +336,7 @@ public abstract class CharBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new char buffer
+ * @return The new char buffer
*/
public abstract CharBuffer slice();
@@ -317,7 +353,7 @@ public abstract class CharBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new char buffer
+ * @return The new char buffer
*/
public abstract CharBuffer duplicate();
@@ -337,7 +373,7 @@ public abstract class CharBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only char buffer
+ * @return The new, read-only char buffer
*/
public abstract CharBuffer asReadOnlyBuffer();
@@ -346,11 +382,12 @@ public abstract class CharBuffer
/**
* Relative <i>get</i> method. Reads the char at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
+ *
+ * @return The char at the buffer's current position
*
- * @return The char at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract char get();
@@ -360,22 +397,31 @@ public abstract class CharBuffer
* <p> Writes the given char into this buffer at the current
* position, and then increments the position. </p>
*
- * @param c The char to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param c
+ * The char to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract CharBuffer put(char c);
/**
* Absolute <i>get</i> method. Reads the char at the given
- * index. </p>
+ * index.
*
- * @param index The index from which the char will be read
- * @return The char at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @param index
+ * The index from which the char will be read
+ *
+ * @return The char at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract char get(int index);
@@ -396,12 +442,20 @@ public abstract class CharBuffer
* <p> Writes the given char into this buffer at the given
* index. </p>
*
- * @param index The index at which the char will be written
- * @param c The char value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the char will be written
+ *
+ * @param c
+ * The char value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract CharBuffer put(int index, char c);
@@ -427,26 +481,36 @@ public abstract class CharBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient chars in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which chars are to be written
- * @param offset The offset within the array of the first char to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of chars to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> chars
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which chars are to be written
+ *
+ * @param offset
+ * The offset within the array of the first char to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of chars to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> chars
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public CharBuffer get(char[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -502,15 +566,23 @@ public abstract class CharBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
+ * buffer and it is potentially much more efficient.
*
- * @param src The source buffer from which chars are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining chars in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source buffer from which chars are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining chars in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public CharBuffer put(CharBuffer src) {
if (src == this)
@@ -542,25 +614,37 @@ public abstract class CharBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which chars are to be read
- * @param offset The offset within the array of the first char to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of chars to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which chars are to be read
+ *
+ * @param offset
+ * The offset within the array of the first char to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of chars to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public CharBuffer put(char[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -583,9 +667,16 @@ public abstract class CharBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final CharBuffer put(char[] src) {
return put(src, 0, src.length);
@@ -612,26 +703,38 @@ public abstract class CharBuffer
* <tt>dst.put(src,&nbsp;start,&nbsp;end)</tt> has exactly the same effect
* as the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = start; i < end; i++)
- * dst.put(src.charAt(i)); </pre>
+ * dst.put(src.charAt(i));
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The string from which chars are to be read
- * @param start The offset within the string of the first char to be read;
- * must be non-negative and no larger than
- * <tt>string.length()</tt>
- * @param end The offset within the string of the last char to be read,
- * plus one; must be non-negative and no larger than
- * <tt>string.length()</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>start</tt> and
- * <tt>end</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The string from which chars are to be read
+ *
+ * @param start
+ * The offset within the string of the first char to be read;
+ * must be non-negative and no larger than
+ * <tt>string.length()</tt>
+ *
+ * @param end
+ * The offset within the string of the last char to be read,
+ * plus one; must be non-negative and no larger than
+ * <tt>string.length()</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>start</tt> and <tt>end</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public CharBuffer put(String src, int start, int end) {
checkBounds(start, end - start, src.length());
@@ -667,9 +770,16 @@ public abstract class CharBuffer
* <pre>
* dst.put(s, 0, s.length()) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source string
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final CharBuffer put(String src) {
return put(src, 0, src.length());
@@ -686,8 +796,8 @@ public abstract class CharBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
return (hb != null) && !isReadOnly;
@@ -704,9 +814,13 @@ public abstract class CharBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final char[] array() {
if (hb == null)
@@ -727,10 +841,14 @@ public abstract class CharBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -758,15 +876,19 @@ public abstract class CharBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract CharBuffer compact();
/**
- * Tells whether or not this char buffer is direct. </p>
+ * Tells whether or not this char buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
@@ -782,7 +904,7 @@ public abstract class CharBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
@@ -797,15 +919,15 @@ public abstract class CharBuffer
*
* <p> Two char buffers are equal if, and only if,
*
- * <p><ol>
+ * <ol>
*
- * <li><p> They have the same element type, </p></li>
+ * <li><p> They have the same element type, </p></li>
*
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
*
*
*
@@ -813,22 +935,23 @@ public abstract class CharBuffer
*
*
*
- * </p></li>
+ * </p></li>
*
* </ol>
*
* <p> A char buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof CharBuffer))
return false;
- CharBuffer that = (CharBuffer) ob;
+ CharBuffer that = (CharBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -860,13 +983,13 @@ public abstract class CharBuffer
*
*
* Pairs of {@code char} elements are compared as if by invoking
- * {@link Character#compare(char, char)}.
- *
+ * {@link Character#compare(char,char)}.
+
*
* <p> A char buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(CharBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -896,7 +1019,7 @@ public abstract class CharBuffer
* at index <tt>limit()</tt>&nbsp;-&nbsp;1. Invoking this method does not
* change the buffer's position. </p>
*
- * @return The specified string
+ * @return The specified string
*/
public String toString() {
return toString(position(), limit());
@@ -915,7 +1038,7 @@ public abstract class CharBuffer
* (inclusive) and the limit (exclusive); that is, it is equivalent to
* <tt>remaining()</tt>. </p>
*
- * @return The length of this character buffer
+ * @return The length of this character buffer
*/
public final int length() {
return remaining();
@@ -923,13 +1046,17 @@ public abstract class CharBuffer
/**
* Reads the character at the given index relative to the current
- * position. </p>
+ * position.
*
- * @param index The index of the character to be read, relative to the position;
- * must be non-negative and smaller than <tt>remaining()</tt>
- * @return The character at index
- * <tt>position()&nbsp;+&nbsp;index</tt>
- * @throws IndexOutOfBoundsException If the preconditions on <tt>index</tt> do not hold
+ * @param index
+ * The index of the character to be read, relative to the position;
+ * must be non-negative and smaller than <tt>remaining()</tt>
+ *
+ * @return The character at index
+ * <tt>position()&nbsp;+&nbsp;index</tt>
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on <tt>index</tt> do not hold
*/
public final char charAt(int index) {
return get(position() + checkIndex(index, 1));
@@ -948,16 +1075,22 @@ public abstract class CharBuffer
* direct if, and only if, this buffer is direct, and it will be read-only
* if, and only if, this buffer is read-only. </p>
*
- * @param start The index, relative to the current position, of the first
- * character in the subsequence; must be non-negative and no larger
- * than <tt>remaining()</tt>
- * @param end The index, relative to the current position, of the character
- * following the last character in the subsequence; must be no
- * smaller than <tt>start</tt> and no larger than
- * <tt>remaining()</tt>
- * @return The new character buffer
- * @throws IndexOutOfBoundsException If the preconditions on <tt>start</tt> and <tt>end</tt>
- * do not hold
+ * @param start
+ * The index, relative to the current position, of the first
+ * character in the subsequence; must be non-negative and no larger
+ * than <tt>remaining()</tt>
+ *
+ * @param end
+ * The index, relative to the current position, of the character
+ * following the last character in the subsequence; must be no
+ * smaller than <tt>start</tt> and no larger than
+ * <tt>remaining()</tt>
+ *
+ * @return The new character buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on <tt>start</tt> and <tt>end</tt>
+ * do not hold
*/
public abstract CharBuffer subSequence(int start, int end);
@@ -980,13 +1113,20 @@ public abstract class CharBuffer
* toString} method of a character buffer will return a subsequence whose
* content depends upon the buffer's position and limit.
*
- * @param csq The character sequence to append. If <tt>csq</tt> is
- * <tt>null</tt>, then the four characters <tt>"null"</tt> are
- * appended to this character buffer.
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
- * @since 1.5
+ * @param csq
+ * The character sequence to append. If <tt>csq</tt> is
+ * <tt>null</tt>, then the four characters <tt>"null"</tt> are
+ * appended to this character buffer.
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 1.5
*/
public CharBuffer append(CharSequence csq) {
if (csq == null)
@@ -1006,19 +1146,26 @@ public abstract class CharBuffer
* <pre>
* dst.put(csq.subSequence(start, end).toString()) </pre>
*
- * @param csq The character sequence from which a subsequence will be
- * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
- * will be appended as if <tt>csq</tt> contained the four
- * characters <tt>"null"</tt>.
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If <tt>start</tt> or <tt>end</tt> are negative,
- * <tt>start</tt>
- * is greater than <tt>end</tt>, or <tt>end</tt> is greater
- * than
- * <tt>csq.length()</tt>
- * @throws ReadOnlyBufferException If this buffer is read-only
- * @since 1.5
+ * @param csq
+ * The character sequence from which a subsequence will be
+ * appended. If <tt>csq</tt> is <tt>null</tt>, then characters
+ * will be appended as if <tt>csq</tt> contained the four
+ * characters <tt>"null"</tt>.
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
+ * is greater than <tt>end</tt>, or <tt>end</tt> is greater than
+ * <tt>csq.length()</tt>
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 1.5
*/
public CharBuffer append(CharSequence csq, int start, int end) {
CharSequence cs = (csq == null ? "null" : csq);
@@ -1035,11 +1182,18 @@ public abstract class CharBuffer
* <pre>
* dst.put(c) </pre>
*
- * @param c The 16-bit char to append
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
- * @since 1.5
+ * @param c
+ * The 16-bit char to append
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
+ *
+ * @since 1.5
*/
public CharBuffer append(char c) {
return put(c);
@@ -1054,12 +1208,12 @@ public abstract class CharBuffer
*
* <p> The byte order of a char buffer created by allocation or by
* wrapping an existing <tt>char</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of a char buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public abstract ByteOrder order();
diff --git a/ojluni/src/main/java/java/nio/DoubleBuffer.java b/ojluni/src/main/java/java/nio/DoubleBuffer.java
index 5f63d24f87..d0a0c153de 100644
--- a/ojluni/src/main/java/java/nio/DoubleBuffer.java
+++ b/ojluni/src/main/java/java/nio/DoubleBuffer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,30 +36,37 @@ package java.nio;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(double) </code><i>put</i><code>} methods that read and write
- * single doubles; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(double) <i>put</i>} methods that read and write
+ * single doubles; </p></li>
*
- * <li><p> Relative {@link #get(double[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of doubles from this buffer
- * into an array; and</p></li>
+ * <li><p> Relative {@link #get(double[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of doubles from this buffer
+ * into an array; and</p></li>
*
- * <li><p> Relative {@link #put(double[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of doubles from a
- * double array or some other double
- * buffer into this buffer;&#32;and </p></li>
+ * <li><p> Relative {@link #put(double[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of doubles from a
+ * double array or some other double
+ * buffer into this buffer;&#32;and </p></li>
+ *
+ *
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * a double buffer. </p></li>
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} a double buffer. </p></li>
* </ul>
*
* <p> Double buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
- * content, by {@link #wrap(double[]) </code><i>wrapping</i><code>} an existing
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
+ *
+ * content, by {@link #wrap(double[]) <i>wrapping</i>} an existing
* double array into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
+ *
+*
+ *
* <p> Like a byte buffer, a double buffer is either <a
* href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
* double buffer created via the <tt>wrap</tt> methods of this class will
@@ -68,18 +75,24 @@ package java.nio;
* a double buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method. </p>
*
+*
+ *
+ *
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class DoubleBuffer
- extends Buffer
- implements Comparable<DoubleBuffer> {
+ extends Buffer
+ implements Comparable<DoubleBuffer>
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -93,7 +106,8 @@ public abstract class DoubleBuffer
// backing array, and array offset
//
DoubleBuffer(int mark, int pos, int lim, int cap, // package-private
- double[] hb, int offset) {
+ double[] hb, int offset)
+ {
super(mark, pos, lim, cap, 3);
this.hb = hb;
this.offset = offset;
@@ -111,13 +125,16 @@ public abstract class DoubleBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
*
- * @param capacity The new buffer's capacity, in doubles
- * @return The new double buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @param capacity
+ * The new buffer's capacity, in doubles
+ *
+ * @return The new double buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static DoubleBuffer allocate(int capacity) {
if (capacity < 0)
@@ -133,24 +150,32 @@ public abstract class DoubleBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new double buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new double buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static DoubleBuffer wrap(double[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapDoubleBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -165,12 +190,14 @@ public abstract class DoubleBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new double buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new double buffer
*/
public static DoubleBuffer wrap(double[] array) {
return wrap(array, 0, array.length);
@@ -192,7 +219,7 @@ public abstract class DoubleBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new double buffer
+ * @return The new double buffer
*/
public abstract DoubleBuffer slice();
@@ -209,7 +236,7 @@ public abstract class DoubleBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new double buffer
+ * @return The new double buffer
*/
public abstract DoubleBuffer duplicate();
@@ -229,7 +256,7 @@ public abstract class DoubleBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only double buffer
+ * @return The new, read-only double buffer
*/
public abstract DoubleBuffer asReadOnlyBuffer();
@@ -238,11 +265,12 @@ public abstract class DoubleBuffer
/**
* Relative <i>get</i> method. Reads the double at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
+ *
+ * @return The double at the buffer's current position
*
- * @return The double at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract double get();
@@ -252,22 +280,31 @@ public abstract class DoubleBuffer
* <p> Writes the given double into this buffer at the current
* position, and then increments the position. </p>
*
- * @param d The double to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param d
+ * The double to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract DoubleBuffer put(double d);
/**
* Absolute <i>get</i> method. Reads the double at the given
- * index. </p>
+ * index.
+ *
+ * @param index
+ * The index from which the double will be read
*
- * @param index The index from which the double will be read
- * @return The double at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @return The double at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract double get(int index);
@@ -277,12 +314,20 @@ public abstract class DoubleBuffer
* <p> Writes the given double into this buffer at the given
* index. </p>
*
- * @param index The index at which the double will be written
- * @param d The double value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the double will be written
+ *
+ * @param d
+ * The double value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract DoubleBuffer put(int index, double d);
@@ -308,26 +353,36 @@ public abstract class DoubleBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient doubles in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which doubles are to be written
- * @param offset The offset within the array of the first double to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of doubles to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> doubles
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which doubles are to be written
+ *
+ * @param offset
+ * The offset within the array of the first double to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of doubles to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> doubles
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public DoubleBuffer get(double[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -349,9 +404,14 @@ public abstract class DoubleBuffer
* <pre>
* src.get(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> doubles
- * remaining in this buffer
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> doubles
+ * remaining in this buffer
*/
public DoubleBuffer get(double[] dst) {
return get(dst, 0, dst.length);
@@ -383,15 +443,23 @@ public abstract class DoubleBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The source buffer from which doubles are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining doubles in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which doubles are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining doubles in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public DoubleBuffer put(DoubleBuffer src) {
if (src == this)
@@ -423,25 +491,37 @@ public abstract class DoubleBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which doubles are to be read
- * @param offset The offset within the array of the first double to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of doubles to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which doubles are to be read
+ *
+ * @param offset
+ * The offset within the array of the first double to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of doubles to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public DoubleBuffer put(double[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -464,9 +544,16 @@ public abstract class DoubleBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final DoubleBuffer put(double[] src) {
return put(src, 0, src.length);
@@ -483,8 +570,8 @@ public abstract class DoubleBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
return (hb != null) && !isReadOnly;
@@ -501,9 +588,13 @@ public abstract class DoubleBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final double[] array() {
if (hb == null)
@@ -524,10 +615,14 @@ public abstract class DoubleBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -555,23 +650,27 @@ public abstract class DoubleBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract DoubleBuffer compact();
/**
- * Tells whether or not this double buffer is direct. </p>
+ * Tells whether or not this double buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
/**
- * Returns a string summarizing the state of this buffer. </p>
+ * Returns a string summarizing the state of this buffer.
*
- * @return A summary string
+ * @return A summary string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -598,7 +697,7 @@ public abstract class DoubleBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
@@ -613,38 +712,39 @@ public abstract class DoubleBuffer
*
* <p> Two double buffers are equal if, and only if,
*
- * <p><ol>
+ * <ol>
*
- * <li><p> They have the same element type, </p></li>
+ * <li><p> They have the same element type, </p></li>
*
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
- *
- * This method considers two double elements {@code a} and {@code b}
- * to be equal if
- * {@code (a == b) || (Double.isNaN(a) && Double.isNaN(b))}.
- * The values {@code -0.0} and {@code +0.0} are considered to be
- * equal, unlike {@link Double#equals(Object)}.
- *
- * </p></li>
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+
+ * This method considers two double elements {@code a} and {@code b}
+ * to be equal if
+ * {@code (a == b) || (Double.isNaN(a) && Double.isNaN(b))}.
+ * The values {@code -0.0} and {@code +0.0} are considered to be
+ * equal, unlike {@link Double#equals(Object)}.
+
+ * </p></li>
*
* </ol>
*
* <p> A double buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof DoubleBuffer))
return false;
- DoubleBuffer that = (DoubleBuffer) ob;
+ DoubleBuffer that = (DoubleBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -667,22 +767,19 @@ public abstract class DoubleBuffer
* <p> Two double buffers are compared by comparing their sequences of
* remaining elements lexicographically, without regard to the starting
* position of each sequence within its corresponding buffer.
- *
+
* Pairs of {@code double} elements are compared as if by invoking
- * {@link Double#compare(double, double)}, except that
+ * {@link Double#compare(double,double)}, except that
* {@code -0.0} and {@code 0.0} are considered to be equal.
* {@code Double.NaN} is considered by this method to be equal
* to itself and greater than all other {@code double} values
* (including {@code Double.POSITIVE_INFINITY}).
- *
- *
- *
- *
+
*
* <p> A double buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(DoubleBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -698,11 +795,10 @@ public abstract class DoubleBuffer
private static int compare(double x, double y) {
- return ((x < y) ? -1 :
- (x > y) ? +1 :
- (x == y) ? 0 :
- Double.isNaN(x) ? (Double.isNaN(y) ? 0 : +1) : -1);
-
+ return ((x < y) ? -1 :
+ (x > y) ? +1 :
+ (x == y) ? 0 :
+ Double.isNaN(x) ? (Double.isNaN(y) ? 0 : +1) : -1);
}
@@ -717,12 +813,12 @@ public abstract class DoubleBuffer
*
* <p> The byte order of a double buffer created by allocation or by
* wrapping an existing <tt>double</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of a double buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public abstract ByteOrder order();
diff --git a/ojluni/src/main/java/java/nio/FloatBuffer.java b/ojluni/src/main/java/java/nio/FloatBuffer.java
index cd2a502bf6..90e65ff143 100644
--- a/ojluni/src/main/java/java/nio/FloatBuffer.java
+++ b/ojluni/src/main/java/java/nio/FloatBuffer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,31 +36,37 @@ package java.nio;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(float) </code><i>put</i><code>} methods that read and write
- * single floats; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(float) <i>put</i>} methods that read and write
+ * single floats; </p></li>
*
- * <li><p> Relative {@link #get(float[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of floats from this buffer
- * into an array; and</p></li>
+ * <li><p> Relative {@link #get(float[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of floats from this buffer
+ * into an array; and</p></li>
*
- * <li><p> Relative {@link #put(float[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of floats from a
- * float array or some other float
- * buffer into this buffer;&#32;and </p></li>
+ * <li><p> Relative {@link #put(float[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of floats from a
+ * float array or some other float
+ * buffer into this buffer;&#32;and </p></li>
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} a float buffer. </p></li>
+ *
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * a float buffer. </p></li>
*
* </ul>
*
* <p> Float buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
- * content, by {@link #wrap(float[]) </code><i>wrapping</i><code>} an existing
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
+ *
+ * content, by {@link #wrap(float[]) <i>wrapping</i>} an existing
* float array into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
+ *
+*
+ *
* <p> Like a byte buffer, a float buffer is either <a
* href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
* float buffer created via the <tt>wrap</tt> methods of this class will
@@ -69,18 +75,24 @@ package java.nio;
* a float buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method. </p>
*
+*
+ *
+ *
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class FloatBuffer
- extends Buffer
- implements Comparable<FloatBuffer> {
+ extends Buffer
+ implements Comparable<FloatBuffer>
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -94,7 +106,8 @@ public abstract class FloatBuffer
// backing array, and array offset
//
FloatBuffer(int mark, int pos, int lim, int cap, // package-private
- float[] hb, int offset) {
+ float[] hb, int offset)
+ {
super(mark, pos, lim, cap, 2);
this.hb = hb;
this.offset = offset;
@@ -112,13 +125,16 @@ public abstract class FloatBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
*
- * @param capacity The new buffer's capacity, in floats
- * @return The new float buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @param capacity
+ * The new buffer's capacity, in floats
+ *
+ * @return The new float buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static FloatBuffer allocate(int capacity) {
if (capacity < 0)
@@ -134,24 +150,32 @@ public abstract class FloatBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new float buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new float buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static FloatBuffer wrap(float[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapFloatBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -166,12 +190,14 @@ public abstract class FloatBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new float buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new float buffer
*/
public static FloatBuffer wrap(float[] array) {
return wrap(array, 0, array.length);
@@ -193,7 +219,7 @@ public abstract class FloatBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new float buffer
+ * @return The new float buffer
*/
public abstract FloatBuffer slice();
@@ -210,7 +236,7 @@ public abstract class FloatBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new float buffer
+ * @return The new float buffer
*/
public abstract FloatBuffer duplicate();
@@ -230,7 +256,7 @@ public abstract class FloatBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only float buffer
+ * @return The new, read-only float buffer
*/
public abstract FloatBuffer asReadOnlyBuffer();
@@ -239,11 +265,12 @@ public abstract class FloatBuffer
/**
* Relative <i>get</i> method. Reads the float at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
+ *
+ * @return The float at the buffer's current position
*
- * @return The float at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract float get();
@@ -253,22 +280,31 @@ public abstract class FloatBuffer
* <p> Writes the given float into this buffer at the current
* position, and then increments the position. </p>
*
- * @param f The float to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param f
+ * The float to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract FloatBuffer put(float f);
/**
* Absolute <i>get</i> method. Reads the float at the given
- * index. </p>
+ * index.
+ *
+ * @param index
+ * The index from which the float will be read
*
- * @param index The index from which the float will be read
- * @return The float at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @return The float at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract float get(int index);
@@ -278,12 +314,20 @@ public abstract class FloatBuffer
* <p> Writes the given float into this buffer at the given
* index. </p>
*
- * @param index The index at which the float will be written
- * @param f The float value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the float will be written
+ *
+ * @param f
+ * The float value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract FloatBuffer put(int index, float f);
@@ -309,26 +353,36 @@ public abstract class FloatBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient floats in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which floats are to be written
- * @param offset The offset within the array of the first float to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of floats to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> floats
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which floats are to be written
+ *
+ * @param offset
+ * The offset within the array of the first float to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of floats to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> floats
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public FloatBuffer get(float[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -350,9 +404,14 @@ public abstract class FloatBuffer
* <pre>
* src.get(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> floats
- * remaining in this buffer
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> floats
+ * remaining in this buffer
*/
public FloatBuffer get(float[] dst) {
return get(dst, 0, dst.length);
@@ -384,15 +443,23 @@ public abstract class FloatBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The source buffer from which floats are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining floats in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which floats are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining floats in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public FloatBuffer put(FloatBuffer src) {
if (src == this)
@@ -424,25 +491,37 @@ public abstract class FloatBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which floats are to be read
- * @param offset The offset within the array of the first float to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of floats to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which floats are to be read
+ *
+ * @param offset
+ * The offset within the array of the first float to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of floats to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public FloatBuffer put(float[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -465,9 +544,16 @@ public abstract class FloatBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final FloatBuffer put(float[] src) {
return put(src, 0, src.length);
@@ -484,8 +570,8 @@ public abstract class FloatBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
return (hb != null) && !isReadOnly;
@@ -502,9 +588,13 @@ public abstract class FloatBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final float[] array() {
if (hb == null)
@@ -525,10 +615,14 @@ public abstract class FloatBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -556,23 +650,27 @@ public abstract class FloatBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract FloatBuffer compact();
/**
- * Tells whether or not this float buffer is direct. </p>
+ * Tells whether or not this float buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
/**
- * Returns a string summarizing the state of this buffer. </p>
+ * Returns a string summarizing the state of this buffer.
*
- * @return A summary string
+ * @return A summary string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -599,7 +697,7 @@ public abstract class FloatBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
@@ -614,38 +712,39 @@ public abstract class FloatBuffer
*
* <p> Two float buffers are equal if, and only if,
*
- * <p><ol>
- *
- * <li><p> They have the same element type, </p></li>
- *
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
+ * <ol>
*
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
+ * <li><p> They have the same element type, </p></li>
*
- * This method considers two float elements {@code a} and {@code b}
- * to be equal if
- * {@code (a == b) || (Float.isNaN(a) && Float.isNaN(b))}.
- * The values {@code -0.0} and {@code +0.0} are considered to be
- * equal, unlike {@link Float#equals(Object)}.
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- * </p></li>
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+
+ * This method considers two float elements {@code a} and {@code b}
+ * to be equal if
+ * {@code (a == b) || (Float.isNaN(a) && Float.isNaN(b))}.
+ * The values {@code -0.0} and {@code +0.0} are considered to be
+ * equal, unlike {@link Float#equals(Object)}.
+
+ * </p></li>
*
* </ol>
*
* <p> A float buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof FloatBuffer))
return false;
- FloatBuffer that = (FloatBuffer) ob;
+ FloatBuffer that = (FloatBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -668,9 +767,9 @@ public abstract class FloatBuffer
* <p> Two float buffers are compared by comparing their sequences of
* remaining elements lexicographically, without regard to the starting
* position of each sequence within its corresponding buffer.
- *
+
* Pairs of {@code float} elements are compared as if by invoking
- * {@link Float#compare(float, float)}, except that
+ * {@link Float#compare(float,float)}, except that
* {@code -0.0} and {@code 0.0} are considered to be equal.
* {@code Float.NaN} is considered by this method to be equal
* to itself and greater than all other {@code float} values
@@ -682,8 +781,8 @@ public abstract class FloatBuffer
*
* <p> A float buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(FloatBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -697,25 +796,28 @@ public abstract class FloatBuffer
private static int compare(float x, float y) {
- return ((x < y) ? -1 :
- (x > y) ? +1 :
- (x == y) ? 0 :
- Float.isNaN(x) ? (Float.isNaN(y) ? 0 : +1) : -1);
-
+ return ((x < y) ? -1 :
+ (x > y) ? +1 :
+ (x == y) ? 0 :
+ Float.isNaN(x) ? (Float.isNaN(y) ? 0 : +1) : -1);
}
+ // -- Other char stuff --
+
+ // -- Other byte stuff: Access to binary data --
+
/**
* Retrieves this buffer's byte order.
*
* <p> The byte order of a float buffer created by allocation or by
* wrapping an existing <tt>float</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of a float buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public abstract ByteOrder order();
diff --git a/ojluni/src/main/java/java/nio/IntBuffer.java b/ojluni/src/main/java/java/nio/IntBuffer.java
index 4a209491f6..a0004bad70 100644
--- a/ojluni/src/main/java/java/nio/IntBuffer.java
+++ b/ojluni/src/main/java/java/nio/IntBuffer.java
@@ -1,6 +1,6 @@
/*
* Copyright (C) 2014 The Android Open Source Project
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -37,32 +37,37 @@ package java.nio;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(int) </code><i>put</i><code>} methods that read and write
- * single ints; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(int) <i>put</i>} methods that read and write
+ * single ints; </p></li>
*
- * <li><p> Relative {@link #get(int[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of ints from this buffer
- * into an array; and</p></li>
+ * <li><p> Relative {@link #get(int[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of ints from this buffer
+ * into an array; and</p></li>
*
- * <li><p> Relative {@link #put(int[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of ints from an
- * int array or some other int
- * buffer into this buffer;&#32;and </p></li>
+ * <li><p> Relative {@link #put(int[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of ints from an
+ * int array or some other int
+ * buffer into this buffer;&#32;and </p></li>
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} an int buffer. </p></li>
+ *
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * an int buffer. </p></li>
*
* </ul>
*
* <p> Int buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
*
- * content, by {@link #wrap(int[]) </code><i>wrapping</i><code>} an existing
+ * content, by {@link #wrap(int[]) <i>wrapping</i>} an existing
* int array into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
+ *
+*
+ *
* <p> Like a byte buffer, an int buffer is either <a
* href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
* int buffer created via the <tt>wrap</tt> methods of this class will
@@ -71,18 +76,24 @@ package java.nio;
* an int buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method. </p>
*
+*
+ *
+ *
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class IntBuffer
- extends Buffer
- implements Comparable<IntBuffer> {
+ extends Buffer
+ implements Comparable<IntBuffer>
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -96,7 +107,8 @@ public abstract class IntBuffer
// backing array, and array offset
//
IntBuffer(int mark, int pos, int lim, int cap, // package-private
- int[] hb, int offset) {
+ int[] hb, int offset)
+ {
super(mark, pos, lim, cap, 2);
this.hb = hb;
this.offset = offset;
@@ -114,13 +126,16 @@ public abstract class IntBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
*
- * @param capacity The new buffer's capacity, in ints
- * @return The new int buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @param capacity
+ * The new buffer's capacity, in ints
+ *
+ * @return The new int buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static IntBuffer allocate(int capacity) {
if (capacity < 0)
@@ -136,24 +151,32 @@ public abstract class IntBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new int buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new int buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static IntBuffer wrap(int[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapIntBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -168,12 +191,14 @@ public abstract class IntBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new int buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new int buffer
*/
public static IntBuffer wrap(int[] array) {
return wrap(array, 0, array.length);
@@ -195,7 +220,7 @@ public abstract class IntBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new int buffer
+ * @return The new int buffer
*/
public abstract IntBuffer slice();
@@ -212,7 +237,7 @@ public abstract class IntBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new int buffer
+ * @return The new int buffer
*/
public abstract IntBuffer duplicate();
@@ -232,7 +257,7 @@ public abstract class IntBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only int buffer
+ * @return The new, read-only int buffer
*/
public abstract IntBuffer asReadOnlyBuffer();
@@ -241,11 +266,12 @@ public abstract class IntBuffer
/**
* Relative <i>get</i> method. Reads the int at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
*
- * @return The int at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @return The int at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract int get();
@@ -255,22 +281,31 @@ public abstract class IntBuffer
* <p> Writes the given int into this buffer at the current
* position, and then increments the position. </p>
*
- * @param i The int to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param i
+ * The int to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract IntBuffer put(int i);
/**
* Absolute <i>get</i> method. Reads the int at the given
- * index. </p>
+ * index.
+ *
+ * @param index
+ * The index from which the int will be read
*
- * @param index The index from which the int will be read
- * @return The int at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @return The int at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract int get(int index);
@@ -280,12 +315,20 @@ public abstract class IntBuffer
* <p> Writes the given int into this buffer at the given
* index. </p>
*
- * @param index The index at which the int will be written
- * @param i The int value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the int will be written
+ *
+ * @param i
+ * The int value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract IntBuffer put(int index, int i);
@@ -311,26 +354,36 @@ public abstract class IntBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient ints in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which ints are to be written
- * @param offset The offset within the array of the first int to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of ints to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> ints
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which ints are to be written
+ *
+ * @param offset
+ * The offset within the array of the first int to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of ints to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> ints
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public IntBuffer get(int[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -352,9 +405,14 @@ public abstract class IntBuffer
* <pre>
* src.get(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> ints
- * remaining in this buffer
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> ints
+ * remaining in this buffer
*/
public IntBuffer get(int[] dst) {
return get(dst, 0, dst.length);
@@ -386,15 +444,23 @@ public abstract class IntBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The source buffer from which ints are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining ints in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which ints are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining ints in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public IntBuffer put(IntBuffer src) {
if (src == this)
@@ -426,25 +492,37 @@ public abstract class IntBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which ints are to be read
- * @param offset The offset within the array of the first int to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of ints to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which ints are to be read
+ *
+ * @param offset
+ * The offset within the array of the first int to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of ints to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public IntBuffer put(int[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -467,9 +545,16 @@ public abstract class IntBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final IntBuffer put(int[] src) {
return put(src, 0, src.length);
@@ -486,8 +571,8 @@ public abstract class IntBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
return (hb != null) && !isReadOnly;
@@ -504,9 +589,13 @@ public abstract class IntBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int[] array() {
if (hb == null)
@@ -527,10 +616,14 @@ public abstract class IntBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -558,23 +651,27 @@ public abstract class IntBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract IntBuffer compact();
/**
- * Tells whether or not this int buffer is direct. </p>
+ * Tells whether or not this int buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
/**
- * Returns a string summarizing the state of this buffer. </p>
+ * Returns a string summarizing the state of this buffer.
*
- * @return A summary string
+ * @return A summary string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -601,7 +698,7 @@ public abstract class IntBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
@@ -616,15 +713,15 @@ public abstract class IntBuffer
*
* <p> Two int buffers are equal if, and only if,
*
- * <p><ol>
+ * <ol>
*
- * <li><p> They have the same element type, </p></li>
+ * <li><p> They have the same element type, </p></li>
*
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
*
*
*
@@ -632,22 +729,23 @@ public abstract class IntBuffer
*
*
*
- * </p></li>
+ * </p></li>
*
* </ol>
*
* <p> A int buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof IntBuffer))
return false;
- IntBuffer that = (IntBuffer) ob;
+ IntBuffer that = (IntBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -679,13 +777,13 @@ public abstract class IntBuffer
*
*
* Pairs of {@code int} elements are compared as if by invoking
- * {@link Integer#compare(int, int)}.
- *
+ * {@link Integer#compare(int,int)}.
+
*
* <p> A int buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(IntBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -715,12 +813,12 @@ public abstract class IntBuffer
*
* <p> The byte order of an int buffer created by allocation or by
* wrapping an existing <tt>int</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of an int buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public abstract ByteOrder order();
diff --git a/ojluni/src/main/java/java/nio/LongBuffer.java b/ojluni/src/main/java/java/nio/LongBuffer.java
index c1c2888bd6..80e506cf80 100644
--- a/ojluni/src/main/java/java/nio/LongBuffer.java
+++ b/ojluni/src/main/java/java/nio/LongBuffer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,31 +36,37 @@ package java.nio;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(long) </code><i>put</i><code>} methods that read and write
- * single longs; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(long) <i>put</i>} methods that read and write
+ * single longs; </p></li>
*
- * <li><p> Relative {@link #get(long[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of longs from this buffer
- * into an array; and</p></li>
+ * <li><p> Relative {@link #get(long[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of longs from this buffer
+ * into an array; and</p></li>
*
- * <li><p> Relative {@link #put(long[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of longs from a
- * long array or some other long
- * buffer into this buffer;&#32;and </p></li>
+ * <li><p> Relative {@link #put(long[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of longs from a
+ * long array or some other long
+ * buffer into this buffer;&#32;and </p></li>
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} a long buffer. </p></li>
+ *
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * a long buffer. </p></li>
*
* </ul>
*
* <p> Long buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
- * content, by {@link #wrap(long[]) </code><i>wrapping</i><code>} an existing
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
+ *
+ * content, by {@link #wrap(long[]) <i>wrapping</i>} an existing
* long array into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
+ *
+*
+ *
* <p> Like a byte buffer, a long buffer is either <a
* href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
* long buffer created via the <tt>wrap</tt> methods of this class will
@@ -69,18 +75,24 @@ package java.nio;
* a long buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method. </p>
*
+*
+ *
+ *
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class LongBuffer
- extends Buffer
- implements Comparable<LongBuffer> {
+ extends Buffer
+ implements Comparable<LongBuffer>
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -94,7 +106,8 @@ public abstract class LongBuffer
// backing array, and array offset
//
LongBuffer(int mark, int pos, int lim, int cap, // package-private
- long[] hb, int offset) {
+ long[] hb, int offset)
+ {
super(mark, pos, lim, cap, 3);
this.hb = hb;
this.offset = offset;
@@ -112,13 +125,16 @@ public abstract class LongBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
*
- * @param capacity The new buffer's capacity, in longs
- * @return The new long buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @param capacity
+ * The new buffer's capacity, in longs
+ *
+ * @return The new long buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static LongBuffer allocate(int capacity) {
if (capacity < 0)
@@ -134,24 +150,32 @@ public abstract class LongBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new long buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new long buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static LongBuffer wrap(long[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapLongBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -166,12 +190,14 @@ public abstract class LongBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new long buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new long buffer
*/
public static LongBuffer wrap(long[] array) {
return wrap(array, 0, array.length);
@@ -193,7 +219,7 @@ public abstract class LongBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new long buffer
+ * @return The new long buffer
*/
public abstract LongBuffer slice();
@@ -210,7 +236,7 @@ public abstract class LongBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new long buffer
+ * @return The new long buffer
*/
public abstract LongBuffer duplicate();
@@ -230,7 +256,7 @@ public abstract class LongBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only long buffer
+ * @return The new, read-only long buffer
*/
public abstract LongBuffer asReadOnlyBuffer();
@@ -239,11 +265,12 @@ public abstract class LongBuffer
/**
* Relative <i>get</i> method. Reads the long at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
+ *
+ * @return The long at the buffer's current position
*
- * @return The long at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract long get();
@@ -253,22 +280,31 @@ public abstract class LongBuffer
* <p> Writes the given long into this buffer at the current
* position, and then increments the position. </p>
*
- * @param l The long to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param l
+ * The long to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract LongBuffer put(long l);
/**
* Absolute <i>get</i> method. Reads the long at the given
- * index. </p>
+ * index.
+ *
+ * @param index
+ * The index from which the long will be read
*
- * @param index The index from which the long will be read
- * @return The long at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @return The long at the given index
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract long get(int index);
@@ -278,12 +314,20 @@ public abstract class LongBuffer
* <p> Writes the given long into this buffer at the given
* index. </p>
*
- * @param index The index at which the long will be written
- * @param l The long value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the long will be written
+ *
+ * @param l
+ * The long value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract LongBuffer put(int index, long l);
@@ -309,26 +353,36 @@ public abstract class LongBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient longs in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which longs are to be written
- * @param offset The offset within the array of the first long to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of longs to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> longs
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which longs are to be written
+ *
+ * @param offset
+ * The offset within the array of the first long to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of longs to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> longs
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public LongBuffer get(long[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -350,9 +404,14 @@ public abstract class LongBuffer
* <pre>
* src.get(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> longs
- * remaining in this buffer
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> longs
+ * remaining in this buffer
*/
public LongBuffer get(long[] dst) {
return get(dst, 0, dst.length);
@@ -384,15 +443,23 @@ public abstract class LongBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The source buffer from which longs are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining longs in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which longs are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining longs in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public LongBuffer put(LongBuffer src) {
if (src == this)
@@ -424,25 +491,37 @@ public abstract class LongBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which longs are to be read
- * @param offset The offset within the array of the first long to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of longs to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which longs are to be read
+ *
+ * @param offset
+ * The offset within the array of the first long to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of longs to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public LongBuffer put(long[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -465,9 +544,16 @@ public abstract class LongBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final LongBuffer put(long[] src) {
return put(src, 0, src.length);
@@ -484,8 +570,8 @@ public abstract class LongBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
return (hb != null) && !isReadOnly;
@@ -502,9 +588,13 @@ public abstract class LongBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final long[] array() {
if (hb == null)
@@ -525,10 +615,14 @@ public abstract class LongBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -556,23 +650,27 @@ public abstract class LongBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract LongBuffer compact();
/**
- * Tells whether or not this long buffer is direct. </p>
+ * Tells whether or not this long buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
/**
- * Returns a string summarizing the state of this buffer. </p>
+ * Returns a string summarizing the state of this buffer.
*
- * @return A summary string
+ * @return A summary string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -599,7 +697,7 @@ public abstract class LongBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
@@ -614,38 +712,33 @@ public abstract class LongBuffer
*
* <p> Two long buffers are equal if, and only if,
*
- * <p><ol>
- *
- * <li><p> They have the same element type, </p></li>
- *
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
- *
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
+ * <ol>
*
+ * <li><p> They have the same element type, </p></li>
*
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- *
- *
- *
- *
- * </p></li>
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+
+ * </p></li>
*
* </ol>
*
* <p> A long buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof LongBuffer))
return false;
- LongBuffer that = (LongBuffer) ob;
+ LongBuffer that = (LongBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -677,13 +770,13 @@ public abstract class LongBuffer
*
*
* Pairs of {@code long} elements are compared as if by invoking
- * {@link Long#compare(long, long)}.
- *
+ * {@link Long#compare(long,long)}.
+
*
* <p> A long buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(LongBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -713,12 +806,12 @@ public abstract class LongBuffer
*
* <p> The byte order of a long buffer created by allocation or by
* wrapping an existing <tt>long</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of a long buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public abstract ByteOrder order();
diff --git a/ojluni/src/main/java/java/nio/ShortBuffer.java b/ojluni/src/main/java/java/nio/ShortBuffer.java
index 9ca0f369b6..6903b542de 100644
--- a/ojluni/src/main/java/java/nio/ShortBuffer.java
+++ b/ojluni/src/main/java/java/nio/ShortBuffer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,32 +36,37 @@ package java.nio;
*
* <ul>
*
- * <li><p> Absolute and relative {@link #get() </code><i>get</i><code>} and
- * {@link #put(short) </code><i>put</i><code>} methods that read and write
- * single shorts; </p></li>
+ * <li><p> Absolute and relative {@link #get() <i>get</i>} and
+ * {@link #put(short) <i>put</i>} methods that read and write
+ * single shorts; </p></li>
*
- * <li><p> Relative {@link #get(short[]) </code><i>bulk get</i><code>}
- * methods that transfer contiguous sequences of shorts from this buffer
- * into an array; and</p></li>
+ * <li><p> Relative {@link #get(short[]) <i>bulk get</i>}
+ * methods that transfer contiguous sequences of shorts from this buffer
+ * into an array; and</p></li>
*
- * <li><p> Relative {@link #put(short[]) </code><i>bulk put</i><code>}
- * methods that transfer contiguous sequences of shorts from a
- * short array or some other short
- * buffer into this buffer;&#32;and </p></li>
+ * <li><p> Relative {@link #put(short[]) <i>bulk put</i>}
+ * methods that transfer contiguous sequences of shorts from a
+ * short array or some other short
+ * buffer into this buffer;&#32;and </p></li>
*
- * <li><p> Methods for {@link #compact </code>compacting<code>}, {@link
- * #duplicate </code>duplicating<code>}, and {@link #slice
- * </code>slicing<code>} a short buffer. </p></li>
+ *
+ * <li><p> Methods for {@link #compact compacting}, {@link
+ * #duplicate duplicating}, and {@link #slice slicing}
+ * a short buffer. </p></li>
*
* </ul>
*
* <p> Short buffers can be created either by {@link #allocate
- * </code><i>allocation</i><code>}, which allocates space for the buffer's
+ * <i>allocation</i>}, which allocates space for the buffer's
+ *
*
- * content, by {@link #wrap(short[]) </code><i>wrapping</i><code>} an existing
+ * content, by {@link #wrap(short[]) <i>wrapping</i>} an existing
* short array into a buffer, or by creating a
* <a href="ByteBuffer.html#views"><i>view</i></a> of an existing byte buffer.
*
+ *
+*
+ *
* <p> Like a byte buffer, a short buffer is either <a
* href="ByteBuffer.html#direct"><i>direct</i> or <i>non-direct</i></a>. A
* short buffer created via the <tt>wrap</tt> methods of this class will
@@ -70,18 +75,24 @@ package java.nio;
* a short buffer is direct may be determined by invoking the {@link
* #isDirect isDirect} method. </p>
*
+*
+ *
+ *
* <p> Methods in this class that do not otherwise have a value to return are
* specified to return the buffer upon which they are invoked. This allows
* method invocations to be chained.
*
+ *
+ *
* @author Mark Reinhold
* @author JSR-51 Expert Group
* @since 1.4
*/
public abstract class ShortBuffer
- extends Buffer
- implements Comparable<ShortBuffer> {
+ extends Buffer
+ implements Comparable<ShortBuffer>
+{
// These fields are declared here rather than in Heap-X-Buffer in order to
// reduce the number of virtual method invocations needed to access these
@@ -95,7 +106,8 @@ public abstract class ShortBuffer
// backing array, and array offset
//
ShortBuffer(int mark, int pos, int lim, int cap, // package-private
- short[] hb, int offset) {
+ short[] hb, int offset)
+ {
super(mark, pos, lim, cap, 1);
this.hb = hb;
this.offset = offset;
@@ -113,13 +125,16 @@ public abstract class ShortBuffer
*
* <p> The new buffer's position will be zero, its limit will be its
* capacity, its mark will be undefined, and each of its elements will be
- * initialized to zero. It will have a {@link #array
- * </code>backing array<code>}, and its {@link #arrayOffset </code>array
- * offset<code>} will be zero.
+ * initialized to zero. It will have a {@link #array backing array},
+ * and its {@link #arrayOffset array offset} will be zero.
+ *
+ * @param capacity
+ * The new buffer's capacity, in shorts
*
- * @param capacity The new buffer's capacity, in shorts
- * @return The new short buffer
- * @throws IllegalArgumentException If the <tt>capacity</tt> is a negative integer
+ * @return The new short buffer
+ *
+ * @throws IllegalArgumentException
+ * If the <tt>capacity</tt> is a negative integer
*/
public static ShortBuffer allocate(int capacity) {
if (capacity < 0)
@@ -135,24 +150,32 @@ public abstract class ShortBuffer
* and vice versa. The new buffer's capacity will be
* <tt>array.length</tt>, its position will be <tt>offset</tt>, its limit
* will be <tt>offset + length</tt>, and its mark will be undefined. Its
- * {@link #array </code>backing array<code>} will be the given array, and
- * its {@link #arrayOffset </code>array offset<code>} will be zero. </p>
- *
- * @param array The array that will back the new buffer
- * @param offset The offset of the subarray to be used; must be non-negative and
- * no larger than <tt>array.length</tt>. The new buffer's position
- * will be set to this value.
- * @param length The length of the subarray to be used;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>.
- * The new buffer's limit will be set to <tt>offset + length</tt>.
- * @return The new short buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * {@link #array backing array} will be the given array, and
+ * its {@link #arrayOffset array offset} will be zero. </p>
+ *
+ * @param array
+ * The array that will back the new buffer
+ *
+ * @param offset
+ * The offset of the subarray to be used; must be non-negative and
+ * no larger than <tt>array.length</tt>. The new buffer's position
+ * will be set to this value.
+ *
+ * @param length
+ * The length of the subarray to be used;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>.
+ * The new buffer's limit will be set to <tt>offset + length</tt>.
+ *
+ * @return The new short buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public static ShortBuffer wrap(short[] array,
- int offset, int length) {
+ int offset, int length)
+ {
try {
return new HeapShortBuffer(array, offset, length);
} catch (IllegalArgumentException x) {
@@ -167,12 +190,14 @@ public abstract class ShortBuffer
* that is, modifications to the buffer will cause the array to be modified
* and vice versa. The new buffer's capacity and limit will be
* <tt>array.length</tt>, its position will be zero, and its mark will be
- * undefined. Its {@link #array </code>backing array<code>} will be the
- * given array, and its {@link #arrayOffset </code>array offset<code>} will
+ * undefined. Its {@link #array backing array} will be the
+ * given array, and its {@link #arrayOffset array offset>} will
* be zero. </p>
*
- * @param array The array that will back this buffer
- * @return The new short buffer
+ * @param array
+ * The array that will back this buffer
+ *
+ * @return The new short buffer
*/
public static ShortBuffer wrap(short[] array) {
return wrap(array, 0, array.length);
@@ -194,7 +219,7 @@ public abstract class ShortBuffer
* buffer is direct, and it will be read-only if, and only if, this buffer
* is read-only. </p>
*
- * @return The new short buffer
+ * @return The new short buffer
*/
public abstract ShortBuffer slice();
@@ -211,7 +236,7 @@ public abstract class ShortBuffer
* and only if, this buffer is direct, and it will be read-only if, and
* only if, this buffer is read-only. </p>
*
- * @return The new short buffer
+ * @return The new short buffer
*/
public abstract ShortBuffer duplicate();
@@ -231,7 +256,7 @@ public abstract class ShortBuffer
* <p> If this buffer is itself read-only then this method behaves in
* exactly the same way as the {@link #duplicate duplicate} method. </p>
*
- * @return The new, read-only short buffer
+ * @return The new, read-only short buffer
*/
public abstract ShortBuffer asReadOnlyBuffer();
@@ -240,11 +265,12 @@ public abstract class ShortBuffer
/**
* Relative <i>get</i> method. Reads the short at this buffer's
- * current position, and then increments the position. </p>
+ * current position, and then increments the position.
*
- * @return The short at the buffer's current position
- * @throws BufferUnderflowException If the buffer's current position is not smaller than its
- * limit
+ * @return The short at the buffer's current position
+ *
+ * @throws BufferUnderflowException
+ * If the buffer's current position is not smaller than its limit
*/
public abstract short get();
@@ -254,22 +280,31 @@ public abstract class ShortBuffer
* <p> Writes the given short into this buffer at the current
* position, and then increments the position. </p>
*
- * @param s The short to be written
- * @return This buffer
- * @throws BufferOverflowException If this buffer's current position is not smaller than its
- * limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param s
+ * The short to be written
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If this buffer's current position is not smaller than its limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ShortBuffer put(short s);
/**
* Absolute <i>get</i> method. Reads the short at the given
- * index. </p>
+ * index.
+ *
+ * @param index
+ * The index from which the short will be read
+ *
+ * @return The short at the given index
*
- * @param index The index from which the short will be read
- * @return The short at the given index
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
*/
public abstract short get(int index);
@@ -279,12 +314,20 @@ public abstract class ShortBuffer
* <p> Writes the given short into this buffer at the given
* index. </p>
*
- * @param index The index at which the short will be written
- * @param s The short value to be written
- * @return This buffer
- * @throws IndexOutOfBoundsException If <tt>index</tt> is negative
- * or not smaller than the buffer's limit
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param index
+ * The index at which the short will be written
+ *
+ * @param s
+ * The short value to be written
+ *
+ * @return This buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If <tt>index</tt> is negative
+ * or not smaller than the buffer's limit
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ShortBuffer put(int index, short s);
@@ -310,26 +353,36 @@ public abstract class ShortBuffer
* <tt>src.get(dst,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst[i] = src.get(); </pre>
+ * dst[i] = src.get();
+ * }</pre>
*
* except that it first checks that there are sufficient shorts in
- * this buffer and it is potentially much more efficient. </p>
- *
- * @param dst The array into which shorts are to be written
- * @param offset The offset within the array of the first short to be
- * written; must be non-negative and no larger than
- * <tt>dst.length</tt>
- * @param length The maximum number of shorts to be written to the given
- * array; must be non-negative and no larger than
- * <tt>dst.length - offset</tt>
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> shorts
- * remaining in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
+ * this buffer and it is potentially much more efficient.
+ *
+ * @param dst
+ * The array into which shorts are to be written
+ *
+ * @param offset
+ * The offset within the array of the first short to be
+ * written; must be non-negative and no larger than
+ * <tt>dst.length</tt>
+ *
+ * @param length
+ * The maximum number of shorts to be written to the given
+ * array; must be non-negative and no larger than
+ * <tt>dst.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> shorts
+ * remaining in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
*/
public ShortBuffer get(short[] dst, int offset, int length) {
checkBounds(offset, length, dst.length);
@@ -351,9 +404,14 @@ public abstract class ShortBuffer
* <pre>
* src.get(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferUnderflowException If there are fewer than <tt>length</tt> shorts
- * remaining in this buffer
+ * @param dst
+ * The destination array
+ *
+ * @return This buffer
+ *
+ * @throws BufferUnderflowException
+ * If there are fewer than <tt>length</tt> shorts
+ * remaining in this buffer
*/
public ShortBuffer get(short[] dst) {
return get(dst, 0, dst.length);
@@ -385,15 +443,23 @@ public abstract class ShortBuffer
* dst.put(src.get()); </pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The source buffer from which shorts are to be read;
- * must not be this buffer
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * for the remaining shorts in the source buffer
- * @throws IllegalArgumentException If the source buffer is this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The source buffer from which shorts are to be read;
+ * must not be this buffer
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ * for the remaining shorts in the source buffer
+ *
+ * @throws IllegalArgumentException
+ * If the source buffer is this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public ShortBuffer put(ShortBuffer src) {
if (src == this)
@@ -425,25 +491,37 @@ public abstract class ShortBuffer
* <tt>dst.put(src,&nbsp;off,&nbsp;len)</tt> has exactly the same effect as
* the loop
*
- * <pre>
+ * <pre>{@code
* for (int i = off; i < off + len; i++)
- * dst.put(a[i]); </pre>
+ * dst.put(a[i]);
+ * }</pre>
*
* except that it first checks that there is sufficient space in this
- * buffer and it is potentially much more efficient. </p>
- *
- * @param src The array from which shorts are to be read
- * @param offset The offset within the array of the first short to be read;
- * must be non-negative and no larger than <tt>array.length</tt>
- * @param length The number of shorts to be read from the given array;
- * must be non-negative and no larger than
- * <tt>array.length - offset</tt>
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws IndexOutOfBoundsException If the preconditions on the <tt>offset</tt> and
- * <tt>length</tt>
- * parameters do not hold
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * buffer and it is potentially much more efficient.
+ *
+ * @param src
+ * The array from which shorts are to be read
+ *
+ * @param offset
+ * The offset within the array of the first short to be read;
+ * must be non-negative and no larger than <tt>array.length</tt>
+ *
+ * @param length
+ * The number of shorts to be read from the given array;
+ * must be non-negative and no larger than
+ * <tt>array.length - offset</tt>
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws IndexOutOfBoundsException
+ * If the preconditions on the <tt>offset</tt> and <tt>length</tt>
+ * parameters do not hold
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public ShortBuffer put(short[] src, int offset, int length) {
checkBounds(offset, length, src.length);
@@ -466,9 +544,16 @@ public abstract class ShortBuffer
* <pre>
* dst.put(a, 0, a.length) </pre>
*
- * @return This buffer
- * @throws BufferOverflowException If there is insufficient space in this buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+ * @param src
+ * The source array
+ *
+ * @return This buffer
+ *
+ * @throws BufferOverflowException
+ * If there is insufficient space in this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public final ShortBuffer put(short[] src) {
return put(src, 0, src.length);
@@ -485,8 +570,8 @@ public abstract class ShortBuffer
* and {@link #arrayOffset() arrayOffset} methods may safely be invoked.
* </p>
*
- * @return <tt>true</tt> if, and only if, this buffer
- * is backed by an array and is not read-only
+ * @return <tt>true</tt> if, and only if, this buffer
+ * is backed by an array and is not read-only
*/
public final boolean hasArray() {
return (hb != null) && !isReadOnly;
@@ -503,9 +588,13 @@ public abstract class ShortBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The array that backs this buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The array that backs this buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final short[] array() {
if (hb == null)
@@ -526,10 +615,14 @@ public abstract class ShortBuffer
* method in order to ensure that this buffer has an accessible backing
* array. </p>
*
- * @return The offset within this buffer's array
- * of the first element of the buffer
- * @throws ReadOnlyBufferException If this buffer is backed by an array but is read-only
- * @throws UnsupportedOperationException If this buffer is not backed by an accessible array
+ * @return The offset within this buffer's array
+ * of the first element of the buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is backed by an array but is read-only
+ *
+ * @throws UnsupportedOperationException
+ * If this buffer is not backed by an accessible array
*/
public final int arrayOffset() {
if (hb == null)
@@ -557,23 +650,27 @@ public abstract class ShortBuffer
* followed immediately by an invocation of another relative <i>put</i>
* method. </p>
*
- * @return This buffer
- * @throws ReadOnlyBufferException If this buffer is read-only
+
+ *
+ * @return This buffer
+ *
+ * @throws ReadOnlyBufferException
+ * If this buffer is read-only
*/
public abstract ShortBuffer compact();
/**
- * Tells whether or not this short buffer is direct. </p>
+ * Tells whether or not this short buffer is direct.
*
- * @return <tt>true</tt> if, and only if, this buffer is direct
+ * @return <tt>true</tt> if, and only if, this buffer is direct
*/
public abstract boolean isDirect();
/**
- * Returns a string summarizing the state of this buffer. </p>
+ * Returns a string summarizing the state of this buffer.
*
- * @return A summary string
+ * @return A summary string
*/
public String toString() {
StringBuffer sb = new StringBuffer();
@@ -600,7 +697,7 @@ public abstract class ShortBuffer
* to use buffers as keys in hash maps or similar data structures unless it
* is known that their contents will not change. </p>
*
- * @return The current hash code of this buffer
+ * @return The current hash code of this buffer
*/
public int hashCode() {
int h = 1;
@@ -615,38 +712,33 @@ public abstract class ShortBuffer
*
* <p> Two short buffers are equal if, and only if,
*
- * <p><ol>
- *
- * <li><p> They have the same element type, </p></li>
- *
- * <li><p> They have the same number of remaining elements, and
- * </p></li>
- *
- * <li><p> The two sequences of remaining elements, considered
- * independently of their starting positions, are pointwise equal.
+ * <ol>
*
+ * <li><p> They have the same element type, </p></li>
*
+ * <li><p> They have the same number of remaining elements, and
+ * </p></li>
*
- *
- *
- *
- *
- * </p></li>
+ * <li><p> The two sequences of remaining elements, considered
+ * independently of their starting positions, are pointwise equal.
+
+ * </p></li>
*
* </ol>
*
* <p> A short buffer is not equal to any other type of object. </p>
*
- * @param ob The object to which this buffer is to be compared
- * @return <tt>true</tt> if, and only if, this buffer is equal to the
- * given object
+ * @param ob The object to which this buffer is to be compared
+ *
+ * @return <tt>true</tt> if, and only if, this buffer is equal to the
+ * given object
*/
public boolean equals(Object ob) {
if (this == ob)
return true;
if (!(ob instanceof ShortBuffer))
return false;
- ShortBuffer that = (ShortBuffer) ob;
+ ShortBuffer that = (ShortBuffer)ob;
if (this.remaining() != that.remaining())
return false;
int p = this.position();
@@ -678,13 +770,13 @@ public abstract class ShortBuffer
*
*
* Pairs of {@code short} elements are compared as if by invoking
- * {@link Short#compare(short, short)}.
- *
+ * {@link Short#compare(short,short)}.
+
*
* <p> A short buffer is not comparable to any other type of object.
*
- * @return A negative integer, zero, or a positive integer as this buffer
- * is less than, equal to, or greater than the given buffer
+ * @return A negative integer, zero, or a positive integer as this buffer
+ * is less than, equal to, or greater than the given buffer
*/
public int compareTo(ShortBuffer that) {
int n = this.position() + Math.min(this.remaining(), that.remaining());
@@ -714,12 +806,12 @@ public abstract class ShortBuffer
*
* <p> The byte order of a short buffer created by allocation or by
* wrapping an existing <tt>short</tt> array is the {@link
- * ByteOrder#nativeOrder </code>native order<code>} of the underlying
+ * ByteOrder#nativeOrder native order} of the underlying
* hardware. The byte order of a short buffer created as a <a
* href="ByteBuffer.html#views">view</a> of a byte buffer is that of the
* byte buffer at the moment that the view is created. </p>
*
- * @return This buffer's byte order
+ * @return This buffer's byte order
*/
public abstract ByteOrder order();
diff --git a/ojluni/src/main/java/java/security/AlgorithmParameters.java b/ojluni/src/main/java/java/security/AlgorithmParameters.java
index 864866ef7d..bca4a5cb87 100644
--- a/ojluni/src/main/java/java/security/AlgorithmParameters.java
+++ b/ojluni/src/main/java/java/security/AlgorithmParameters.java
@@ -66,6 +66,10 @@ import sun.security.jca.Providers;
* <td>10+</td>
* </tr>
* <tr>
+ * <td>ChaCha20</td>
+ * <td>28+</td>
+ * </tr>
+ * <tr>
* <td>DES</td>
* <td>1+</td>
* </tr>
diff --git a/ojluni/src/main/java/java/util/TreeMap.java b/ojluni/src/main/java/java/util/TreeMap.java
index dc55ba6d2d..f46fbb79d5 100644
--- a/ojluni/src/main/java/java/util/TreeMap.java
+++ b/ojluni/src/main/java/java/util/TreeMap.java
@@ -536,34 +536,8 @@ public class TreeMap<K,V>
public V put(K key, V value) {
TreeMapEntry<K,V> t = root;
if (t == null) {
- // BEGIN Android-changed: Work around buggy comparators. http://b/34084348
- // We could just call compare(key, key) for its side effect of checking the type and
- // nullness of the input key. However, several applications seem to have written comparators
- // that only expect to be called on elements that aren't equal to each other (after
- // making assumptions about the domain of the map). Clearly, such comparators are bogus
- // because get() would never work, but TreeSets are frequently used for sorting a set
- // of distinct elements.
- //
- // As a temporary work around, we perform the null & instanceof checks by hand so that
- // we can guarantee that elements are never compared against themselves.
- //
- // **** THIS CHANGE WILL BE REVERTED IN A FUTURE ANDROID RELEASE ****
- //
- // Upstream code was:
- // compare(key, key); // type (and possibly null) check
- if (comparator != null) {
- if (key == null) {
- comparator.compare(key, key);
- }
- } else {
- if (key == null) {
- throw new NullPointerException("key == null");
- } else if (!(key instanceof Comparable)) {
- throw new ClassCastException(
- "Cannot cast" + key.getClass().getName() + " to Comparable.");
- }
- }
- // END Android-changed: Work around buggy comparators. http://b/34084348
+ compare(key, key); // type (and possibly null) check
+
root = new TreeMapEntry<>(key, value, null);
size = 1;
modCount++;
diff --git a/ojluni/src/main/java/java/util/concurrent/TimeUnit.java b/ojluni/src/main/java/java/util/concurrent/TimeUnit.java
index fa520832bd..44d7964c7e 100644
--- a/ojluni/src/main/java/java/util/concurrent/TimeUnit.java
+++ b/ojluni/src/main/java/java/util/concurrent/TimeUnit.java
@@ -37,10 +37,6 @@ package java.util.concurrent;
import java.util.Objects;
-// BEGIN android-note
-// removed java 9 ChronoUnit related code
-// END android-note
-
/**
* A {@code TimeUnit} represents time durations at a given unit of
* granularity and provides utility methods to convert across units,
@@ -395,4 +391,53 @@ public enum TimeUnit {
Thread.sleep(ms, ns);
}
}
+
+ // BEGIN Android-removed: OpenJDK 9 ChronoUnit related code.
+ /*
+ /**
+ * Converts this {@code TimeUnit} to the equivalent {@code ChronoUnit}.
+ *
+ * @return the converted equivalent ChronoUnit
+ * @since 9
+ *
+ public ChronoUnit toChronoUnit() {
+ switch (this) {
+ case NANOSECONDS: return ChronoUnit.NANOS;
+ case MICROSECONDS: return ChronoUnit.MICROS;
+ case MILLISECONDS: return ChronoUnit.MILLIS;
+ case SECONDS: return ChronoUnit.SECONDS;
+ case MINUTES: return ChronoUnit.MINUTES;
+ case HOURS: return ChronoUnit.HOURS;
+ case DAYS: return ChronoUnit.DAYS;
+ default: throw new AssertionError();
+ }
+ }
+
+ /**
+ * Converts a {@code ChronoUnit} to the equivalent {@code TimeUnit}.
+ *
+ * @param chronoUnit the ChronoUnit to convert
+ * @return the converted equivalent TimeUnit
+ * @throws IllegalArgumentException if {@code chronoUnit} has no
+ * equivalent TimeUnit
+ * @throws NullPointerException if {@code chronoUnit} is null
+ * @since 9
+ *
+ public static TimeUnit of(ChronoUnit chronoUnit) {
+ switch (Objects.requireNonNull(chronoUnit, "chronoUnit")) {
+ case NANOS: return TimeUnit.NANOSECONDS;
+ case MICROS: return TimeUnit.MICROSECONDS;
+ case MILLIS: return TimeUnit.MILLISECONDS;
+ case SECONDS: return TimeUnit.SECONDS;
+ case MINUTES: return TimeUnit.MINUTES;
+ case HOURS: return TimeUnit.HOURS;
+ case DAYS: return TimeUnit.DAYS;
+ default:
+ throw new IllegalArgumentException(
+ "No TimeUnit equivalent for " + chronoUnit);
+ }
+ }
+ */
+ // END Android-removed: OpenJDK 9 ChronoUnit related code.
+
}
diff --git a/ojluni/src/main/java/javax/crypto/Cipher.java b/ojluni/src/main/java/javax/crypto/Cipher.java
index 010587d40e..f3da67929e 100644
--- a/ojluni/src/main/java/javax/crypto/Cipher.java
+++ b/ojluni/src/main/java/javax/crypto/Cipher.java
@@ -174,18 +174,29 @@ import sun.security.jca.*;
* <td>26+</td>
* </tr>
* <tr>
- * <td>ARC4</td>
+ * <td rowspan="2">ARC4</td>
* <td>ECB</td>
* <td>NoPadding</td>
* <td>10+</td>
* </tr>
* <tr>
+ * <td>NONE</td>
+ * <td>NoPadding</td>
+ * <td>28+</td>
+ * </tr>
+ * <tr>
* <td>BLOWFISH</td>
* <td>CBC<br>CFB<br>CTR<br>CTS<br>ECB<br>OFB</td>
* <td>ISO10126Padding<br>NoPadding<br>PKCS5Padding</td>
* <td>10+</td>
* </tr>
* <tr>
+ * <td>ChaCha20</td>
+ * <td>NONE<br>Poly1305</td>
+ * <td>NoPadding</td>
+ * <td>28+</td>
+ * </tr>
+ * <tr>
* <td>DES</td>
* <td>CBC<br>CFB<br>CTR<br>CTS<br>ECB<br>OFB</td>
* <td>ISO10126Padding<br>NoPadding<br>PKCS5Padding</td>
diff --git a/ojluni/src/main/java/javax/crypto/KeyGenerator.java b/ojluni/src/main/java/javax/crypto/KeyGenerator.java
index b0977f0a5f..2d6f43dde6 100644
--- a/ojluni/src/main/java/javax/crypto/KeyGenerator.java
+++ b/ojluni/src/main/java/javax/crypto/KeyGenerator.java
@@ -109,6 +109,10 @@ import sun.security.jca.GetInstance.Instance;
* <td>10+</td>
* </tr>
* <tr>
+ * <td>ChaCha20</td>
+ * <td>28+</td>
+ * </tr>
+ * <tr>
* <td>DES</td>
* <td>1+</td>
* </tr>
diff --git a/ojluni/src/main/java/sun/invoke/util/VerifyAccess.java b/ojluni/src/main/java/sun/invoke/util/VerifyAccess.java
index d2e5820e87..94c401fa2f 100644
--- a/ojluni/src/main/java/sun/invoke/util/VerifyAccess.java
+++ b/ojluni/src/main/java/sun/invoke/util/VerifyAccess.java
@@ -143,6 +143,19 @@ public class VerifyAccess {
!lookupClass.isInterface(); // interfaces are types, not classes.
}
+ // Android-removed: Use public API instead of getClassModifiers() to check if public.
+ /*
+ static int getClassModifiers(Class<?> c) {
+ // This would return the mask stored by javac for the source-level modifiers.
+ // return c.getModifiers();
+ // But what we need for JVM access checks are the actual bits from the class header.
+ // ...But arrays and primitives are synthesized with their own odd flags:
+ if (c.isArray() || c.isPrimitive())
+ return c.getModifiers();
+ return Reflection.getClassAccessFlags(c);
+ }
+ */
+
/**
* Evaluate the JVM linkage rules for access to the given class on behalf of caller.
* <h3>JVM Specification, 5.4.4 "Access Control"</h3>
@@ -157,8 +170,13 @@ public class VerifyAccess {
public static boolean isClassAccessible(Class<?> refc, Class<?> lookupClass,
int allowedModes) {
if (allowedModes == 0) return false;
- // Android-changed: Use public APIs to figure out whether a class
- // is public or not.
+ // Android-changed: Use public API instead of getClassModifiers() to check if public.
+ /*
+ assert((allowedModes & PUBLIC) != 0 &&
+ (allowedModes & ~(ALL_ACCESS_MODES|PACKAGE_ALLOWED)) == 0);
+ int mods = getClassModifiers(refc);
+ if (isPublic(mods))
+ */
if (Modifier.isPublic(refc.getModifiers()))
return true;
if ((allowedModes & PACKAGE_ALLOWED) != 0 &&
@@ -215,6 +233,7 @@ public class VerifyAccess {
*/
public static boolean isSamePackage(Class<?> class1, Class<?> class2) {
// Android-changed: Throw IAE (instead of asserting) if called with array classes.
+ // assert(!class1.isArray() && !class2.isArray());
if (class1.isArray() || class2.isArray()) {
throw new IllegalArgumentException();
}
diff --git a/tools/docs/crypto/data/crypto_support.json b/tools/docs/crypto/data/crypto_support.json
index 124a457674..8730405440 100644
--- a/tools/docs/crypto/data/crypto_support.json
+++ b/tools/docs/crypto/data/crypto_support.json
@@ -1,6 +1,6 @@
# This file is autogenerated. See libcore/tools/docs/crypto/README for details.
{
- "api_level": "26",
+ "api_level": "28",
"categories": [
{
"algorithms": [
@@ -41,6 +41,10 @@
"supported_api_levels": "10+"
},
{
+ "name": "ChaCha20",
+ "supported_api_levels": "28+"
+ },
+ {
"name": "DES",
"supported_api_levels": "1+"
},
@@ -283,6 +287,10 @@
"supported_api_levels": "10+"
},
{
+ "name": "ARC4/NONE/NoPadding",
+ "supported_api_levels": "28+"
+ },
+ {
"name": "BLOWFISH/CBC/ISO10126Padding",
"supported_api_levels": "10+"
},
@@ -355,6 +363,14 @@
"supported_api_levels": "10+"
},
{
+ "name": "ChaCha20/NONE/NoPadding",
+ "supported_api_levels": "28+"
+ },
+ {
+ "name": "ChaCha20/Poly1305/NoPadding",
+ "supported_api_levels": "28+"
+ },
+ {
"name": "DES/CBC/ISO10126Padding",
"supported_api_levels": "1+"
},
@@ -624,6 +640,10 @@
"supported_api_levels": "10+"
},
{
+ "name": "ChaCha20",
+ "supported_api_levels": "28+"
+ },
+ {
"name": "DES",
"supported_api_levels": "1+"
},
@@ -2721,5 +2741,5 @@
"name": "TrustManagerFactory"
}
],
- "last_updated": "2017-05-05 07:40:17 UTC"
+ "last_updated": "2018-01-03 14:21:23 UTC"
} \ No newline at end of file