diff options
author | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-13 06:04:19 +0000 |
---|---|---|
committer | mkoch <mkoch@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-05-13 06:04:19 +0000 |
commit | 6c6138d48eaedb67fabd9d1be7dc9b3d4b2ad13a (patch) | |
tree | 44f31eb3b58450408facde2f506a93324a6ebc41 /libjava/gnu/java | |
parent | e5153eedffa0b13cec9050f4a3d00ff65f1cf092 (diff) | |
download | ppe42-gcc-6c6138d48eaedb67fabd9d1be7dc9b3d4b2ad13a.tar.gz ppe42-gcc-6c6138d48eaedb67fabd9d1be7dc9b3d4b2ad13a.zip |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66749 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/java')
-rw-r--r-- | libjava/gnu/java/nio/ByteBufferImpl.java | 25 |
1 files changed, 10 insertions, 15 deletions
diff --git a/libjava/gnu/java/nio/ByteBufferImpl.java b/libjava/gnu/java/nio/ByteBufferImpl.java index 7b7f72e5fb0..cc7fabb5941 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 () |