Commit 3b6b673d by Michael Koch Committed by Michael Koch

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
parent 250ab7c3
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.
2003-05-12 Michael Koch <konqueror@gmx.de> 2003-05-12 Michael Koch <konqueror@gmx.de>
* gnu/java/nio/ByteBufferImpl.java: Reformatted. * gnu/java/nio/ByteBufferImpl.java: Reformatted.
......
...@@ -2100,6 +2100,7 @@ gnu/java/nio/ByteBufferImpl.java \ ...@@ -2100,6 +2100,7 @@ gnu/java/nio/ByteBufferImpl.java \
gnu/java/nio/CharBufferImpl.java \ gnu/java/nio/CharBufferImpl.java \
gnu/java/nio/CharViewBufferImpl.java \ gnu/java/nio/CharViewBufferImpl.java \
gnu/java/nio/DatagramChannelImpl.java \ gnu/java/nio/DatagramChannelImpl.java \
gnu/java/nio/DirectByteBufferImpl.java \
gnu/java/nio/DoubleBufferImpl.java \ gnu/java/nio/DoubleBufferImpl.java \
gnu/java/nio/DoubleViewBufferImpl.java \ gnu/java/nio/DoubleViewBufferImpl.java \
gnu/java/nio/FileChannelImpl.java \ gnu/java/nio/FileChannelImpl.java \
...@@ -2561,6 +2562,7 @@ gnu/gcj/runtime/natSharedLibLoader.cc \ ...@@ -2561,6 +2562,7 @@ gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natStackTrace.cc \ gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \ gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \ gnu/gcj/runtime/natVMClassLoader.cc \
gnu/java/nio/natDirectByteBufferImpl.cc \
gnu/java/nio/natFileChannelImpl.cc \ gnu/java/nio/natFileChannelImpl.cc \
gnu/java/nio/natMappedByteFileBuffer.cc \ gnu/java/nio/natMappedByteFileBuffer.cc \
gnu/java/nio/natSelectorImpl.cc \ gnu/java/nio/natSelectorImpl.cc \
......
...@@ -1862,6 +1862,7 @@ gnu/java/nio/ByteBufferImpl.java \ ...@@ -1862,6 +1862,7 @@ gnu/java/nio/ByteBufferImpl.java \
gnu/java/nio/CharBufferImpl.java \ gnu/java/nio/CharBufferImpl.java \
gnu/java/nio/CharViewBufferImpl.java \ gnu/java/nio/CharViewBufferImpl.java \
gnu/java/nio/DatagramChannelImpl.java \ gnu/java/nio/DatagramChannelImpl.java \
gnu/java/nio/DirectByteBufferImpl.java \
gnu/java/nio/DoubleBufferImpl.java \ gnu/java/nio/DoubleBufferImpl.java \
gnu/java/nio/DoubleViewBufferImpl.java \ gnu/java/nio/DoubleViewBufferImpl.java \
gnu/java/nio/FileChannelImpl.java \ gnu/java/nio/FileChannelImpl.java \
...@@ -2322,6 +2323,7 @@ gnu/gcj/runtime/natSharedLibLoader.cc \ ...@@ -2322,6 +2323,7 @@ gnu/gcj/runtime/natSharedLibLoader.cc \
gnu/gcj/runtime/natStackTrace.cc \ gnu/gcj/runtime/natStackTrace.cc \
gnu/gcj/runtime/natStringBuffer.cc \ gnu/gcj/runtime/natStringBuffer.cc \
gnu/gcj/runtime/natVMClassLoader.cc \ gnu/gcj/runtime/natVMClassLoader.cc \
gnu/java/nio/natDirectByteBufferImpl.cc \
gnu/java/nio/natFileChannelImpl.cc \ gnu/java/nio/natFileChannelImpl.cc \
gnu/java/nio/natMappedByteFileBuffer.cc \ gnu/java/nio/natMappedByteFileBuffer.cc \
gnu/java/nio/natSelectorImpl.cc \ gnu/java/nio/natSelectorImpl.cc \
...@@ -2496,7 +2498,9 @@ gnu/gcj/io/shs.lo gnu/gcj/protocol/core/natCoreInputStream.lo \ ...@@ -2496,7 +2498,9 @@ gnu/gcj/io/shs.lo gnu/gcj/protocol/core/natCoreInputStream.lo \
gnu/gcj/runtime/natFinalizerThread.lo gnu/gcj/runtime/natFirstThread.lo \ gnu/gcj/runtime/natFinalizerThread.lo gnu/gcj/runtime/natFirstThread.lo \
gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \ gnu/gcj/runtime/natNameFinder.lo gnu/gcj/runtime/natSharedLibLoader.lo \
gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \ gnu/gcj/runtime/natStackTrace.lo gnu/gcj/runtime/natStringBuffer.lo \
gnu/gcj/runtime/natVMClassLoader.lo gnu/java/nio/natFileChannelImpl.lo \ gnu/gcj/runtime/natVMClassLoader.lo \
gnu/java/nio/natDirectByteBufferImpl.lo \
gnu/java/nio/natFileChannelImpl.lo \
gnu/java/nio/natMappedByteFileBuffer.lo gnu/java/nio/natSelectorImpl.lo \ gnu/java/nio/natMappedByteFileBuffer.lo gnu/java/nio/natSelectorImpl.lo \
gnu/java/nio/natSocketChannelImpl.lo java/io/natFile.lo \ gnu/java/nio/natSocketChannelImpl.lo java/io/natFile.lo \
java/io/natFileDescriptor.lo java/io/natObjectInputStream.lo \ java/io/natFileDescriptor.lo java/io/natObjectInputStream.lo \
...@@ -2963,6 +2967,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2963,6 +2967,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/nio/CharBufferImpl.P \ .deps/gnu/java/nio/CharBufferImpl.P \
.deps/gnu/java/nio/CharViewBufferImpl.P \ .deps/gnu/java/nio/CharViewBufferImpl.P \
.deps/gnu/java/nio/DatagramChannelImpl.P \ .deps/gnu/java/nio/DatagramChannelImpl.P \
.deps/gnu/java/nio/DirectByteBufferImpl.P \
.deps/gnu/java/nio/DoubleBufferImpl.P \ .deps/gnu/java/nio/DoubleBufferImpl.P \
.deps/gnu/java/nio/DoubleViewBufferImpl.P \ .deps/gnu/java/nio/DoubleViewBufferImpl.P \
.deps/gnu/java/nio/FileChannelImpl.P \ .deps/gnu/java/nio/FileChannelImpl.P \
...@@ -2988,6 +2993,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ ...@@ -2988,6 +2993,7 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \
.deps/gnu/java/nio/charset/UTF_16Encoder.P \ .deps/gnu/java/nio/charset/UTF_16Encoder.P \
.deps/gnu/java/nio/charset/UTF_16LE.P \ .deps/gnu/java/nio/charset/UTF_16LE.P \
.deps/gnu/java/nio/charset/UTF_8.P \ .deps/gnu/java/nio/charset/UTF_8.P \
.deps/gnu/java/nio/natDirectByteBufferImpl.P \
.deps/gnu/java/nio/natFileChannelImpl.P \ .deps/gnu/java/nio/natFileChannelImpl.P \
.deps/gnu/java/nio/natMappedByteFileBuffer.P \ .deps/gnu/java/nio/natMappedByteFileBuffer.P \
.deps/gnu/java/nio/natSelectorImpl.P \ .deps/gnu/java/nio/natSelectorImpl.P \
......
...@@ -53,19 +53,16 @@ import java.nio.ShortBuffer; ...@@ -53,19 +53,16 @@ import java.nio.ShortBuffer;
public final class ByteBufferImpl extends ByteBuffer public final class ByteBufferImpl extends ByteBuffer
{ {
private boolean readOnly; private boolean readOnly;
public ByteBufferImpl (int cap, int off, int lim) ByteBufferImpl (int capacity)
{ {
super (cap, lim, off, 0); this (new byte [capacity], 0, capacity, capacity, 0, -1, false);
this.backing_buffer = new byte [cap];
readOnly = 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); super (buffer, offset, capacity, limit, position, mark);
this.backing_buffer = array; this.readOnly = readOnly;
readOnly = false;
} }
public ByteBufferImpl (ByteBufferImpl copy) public ByteBufferImpl (ByteBufferImpl copy)
...@@ -117,19 +114,17 @@ public final class ByteBufferImpl extends ByteBuffer ...@@ -117,19 +114,17 @@ public final class ByteBufferImpl extends ByteBuffer
public ByteBuffer slice () public ByteBuffer slice ()
{ {
return new ByteBufferImpl (this); return new ByteBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
} }
public ByteBuffer duplicate () public ByteBuffer duplicate ()
{ {
return new ByteBufferImpl (this); return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
} }
public ByteBuffer asReadOnlyBuffer () public ByteBuffer asReadOnlyBuffer ()
{ {
ByteBufferImpl a = new ByteBufferImpl (this); return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
a.readOnly = true;
return a;
} }
public ByteBuffer compact () public ByteBuffer compact ()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment