aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu
diff options
context:
space:
mode:
authorMichael Koch <konqueror@gmx.de>2003-05-13 06:04:19 +0000
committerMichael Koch <mkoch@gcc.gnu.org>2003-05-13 06:04:19 +0000
commit3b6b673dabbab53b8e57cc7ad533f336841356f5 (patch)
tree44f31eb3b58450408facde2f506a93324a6ebc41 /libjava/gnu
parent250ab7c3087404b67719302f92721f43b0bf365e (diff)
downloadgcc-3b6b673dabbab53b8e57cc7ad533f336841356f5.zip
gcc-3b6b673dabbab53b8e57cc7ad533f336841356f5.tar.gz
gcc-3b6b673dabbab53b8e57cc7ad533f336841356f5.tar.bz2
2003-05-13 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/ByteBufferImpl.java (ByteBufferImpl): All constructors revised. (slice): Reimplemented. (duplicate): Reimplemented. (asReadOnlyBuffer): Reimplemented. * java/nio/ByteBuffer.java: Reformatted. (array_offset): Renamed from "offset" to match all other buffer classes. (ByteBuffer): All constructors revised. (allocateDirect): Implemented. (allocate): New implementation, documentation reworked. (wrap): Likewise. (get): Documentation reworked. (put): New implementation, documentation reworked. (hasArray): Documentation reworked. (arrayOffset): Likewise. (hashCode): Likewise. (equals): Likewise. (compareTo): Likewise. (order): Likewise. (compact): Likewise. (isDirect): Likewise. (slice): Likewise. (duplicate): Likewise. (asReadOnlyBuffer): Likewise. * Makefile.am (ordinary_java_source_files): Added gnu/java/nio/DirectByteBufferImpl.java. (nat_source_files): Added gnu/java/nio/natDirectByteBufferImpl.cc. * Makefile.in: Regenerated. From-SVN: r66749
Diffstat (limited to 'libjava/gnu')
-rw-r--r--libjava/gnu/java/nio/ByteBufferImpl.java25
1 files changed, 10 insertions, 15 deletions
diff --git a/libjava/gnu/java/nio/ByteBufferImpl.java b/libjava/gnu/java/nio/ByteBufferImpl.java
index 7b7f72e..cc7fabb 100644
--- a/libjava/gnu/java/nio/ByteBufferImpl.java
+++ b/libjava/gnu/java/nio/ByteBufferImpl.java
@@ -53,19 +53,16 @@ import java.nio.ShortBuffer;
public final class ByteBufferImpl extends ByteBuffer
{
private boolean readOnly;
-
- public ByteBufferImpl (int cap, int off, int lim)
+
+ ByteBufferImpl (int capacity)
{
- super (cap, lim, off, 0);
- this.backing_buffer = new byte [cap];
- readOnly = false;
+ this (new byte [capacity], 0, capacity, capacity, 0, -1, false);
}
-
- public ByteBufferImpl (byte[] array, int offset, int length)
+
+ ByteBufferImpl (byte[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
{
- super (array.length, length, offset, 0);
- this.backing_buffer = array;
- readOnly = false;
+ super (buffer, offset, capacity, limit, position, mark);
+ this.readOnly = readOnly;
}
public ByteBufferImpl (ByteBufferImpl copy)
@@ -117,19 +114,17 @@ public final class ByteBufferImpl extends ByteBuffer
public ByteBuffer slice ()
{
- return new ByteBufferImpl (this);
+ return new ByteBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
}
public ByteBuffer duplicate ()
{
- return new ByteBufferImpl (this);
+ return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
}
public ByteBuffer asReadOnlyBuffer ()
{
- ByteBufferImpl a = new ByteBufferImpl (this);
- a.readOnly = true;
- return a;
+ return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
}
public ByteBuffer compact ()