/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/* Type-specific source code for unit test
*
* Regenerate the BasicX classes via genBasic.sh whenever this file changes.
* We check in the generated source files so that the test tree can be used
* independently of the rest of the source tree.
*/
// -- This file was mechanically generated: Do not edit! -- //
public class BasicByte
extends Basic
{
private static final byte[] VALUES = {
(byte) -1,
(byte) 0,
(byte) 1,
};
int n = b.capacity();
byte v;
for (int i = 0; i < n; i++)
b.rewind();
}
int n = b.remaining();
byte v;
for (int i = start; i < n; i++)
b.rewind();
}
int n = b.capacity();
byte v;
for (int i = 0; i < n; i++)
b.rewind();
}
int n = b.capacity();
byte[] a = new byte[n + 7];
b.get(a, 7, n);
for (int i = 0; i < n; i++)
}
int n = b.capacity();
b.clear();
for (int i = 0; i < n; i++)
b.flip();
}
int n = b.capacity();
b.clear();
for (int i = 0; i < n; i++)
b.limit(n);
b.position(0);
}
int n = b.capacity();
b.clear();
byte[] a = new byte[n + 7];
for (int i = 0; i < n; i++)
a[i + 7] = (byte)ic(i);
b.put(a, 7, n);
b.flip();
}
int n = b.capacity();
b.clear();
c.position(7);
for (int i = 0; i < n; i++)
c.flip();
c.position(7);
b.put(c);
b.flip();
}
//6231529
b.position(0);
b.mark();
b.asReadOnlyBuffer().reset();
}
}
int p = b.position();
byte v;
for (int i = 0; i < n; i++)
} else {
for (int i = n - 1; i >= 0; i--)
}
b.position(p);
}
try {
m.setAccessible(true);
m.invoke(b);
} catch (Exception e) {
fail(e.getMessage(), b);
}
}
public void run() {
b.mark();
compact(b);
b.reset();
}});
}
}
int p = b.position();
b.putChar((char)1);
b.putShort((short)1);
b.putInt(1);
b.putLong((long)1);
b.putFloat((float)1);
b.putDouble((double)1);
b.position(p);
}
byte x, byte y) {
}
boolean caught = false;
try {
} catch (Throwable x) {
caught = true;
} else {
}
}
if (!caught)
}
}
fail("Wrong direction", b);
// Gets and puts
relPut(b);
relGet(b);
absGet(b);
bulkGet(b);
absPut(b);
relGet(b);
absGet(b);
bulkGet(b);
bulkPutArray(b);
relGet(b);
bulkPutBuffer(b);
relGet(b);
// Compact
relPut(b);
b.position(13);
b.compact();
b.flip();
relGet(b, 13);
// Exceptions
relPut(b);
public void run() {
b.get();
}});
public void run() {
b.put((byte)42);
}});
// The index must be non-negative and lesss than the buffer's limit.
public void run() {
}});
public void run() {
b.get(-1);
}});
public void run() {
}});
public void run() {
b.position(0);
b.mark();
b.compact();
b.reset();
}});
// Values
b.clear();
b.put((byte)0);
b.put((byte)-1);
b.put((byte)1);
byte v;
b.flip();
// Comparison
b.rewind();
b.position(2);
for (int i = 2; i < b.limit(); i++) {
byte x = b.get(i);
if (x != y
)
}
}
b.put((byte)99);
b.rewind();
// Check equals and compareTo with interesting values
for (byte x : VALUES) {
}
}
for (byte y : VALUES) {
fail("compareTo not anti-symmetric",
}
fail("compareTo inconsistent with equals",
}
fail("Incorrect results for ByteBuffer.compareTo",
}
fail("Incorrect results for ByteBuffer.equals",
}
}
}
// Sub, dup
relPut(b);
b.position(13);
// Slice
b.position(5);
checkSlice(b, sb);
b.position(0);
fail("Array offsets do not match: "
// Views
b.clear();
for (int i = 1; i <= 9; i++) {
b.position(i);
}
b.position(0);
// Heterogeneous accessors
for (int i = 0; i <= 9; i++) {
b.position(i);
}
b.position(3);
// Read-only views
b.rewind();
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
rb.arrayOffset();
}});
fail("Read-only heap buffer's backing array is accessible",
rb);
}
// Bulk puts from read-only buffers
b.clear();
// For byte buffers, test both the direct and non-direct cases
= (b.isDirect()
relPut(b); // Required by testViews
}
int offset = 47;
int length = 900;
show(0, b);
// The offset must be non-negative and no larger than <array.length>.
public void run() {
}});
public void run() {
}});
public void run() {
}});
public void run() {
}});
// A NullPointerException will be thrown if the array is null.
public void run() {
}});
public void run() {
}});
}
private static void testAllocate() {
// An IllegalArgumentException will be thrown for negative capacities.
public void run() {
}});
public void run() {
}});
}
public static void test() {
testAllocate();
test(new byte[1024]);
test(0, b, true);
}
}