mirror of
https://github.com/gcc-mirror/gcc.git
synced 2026-05-06 23:25:24 +02:00
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
This commit is contained in:
committed by
Michael Koch
parent
250ab7c308
commit
3b6b673dab
@@ -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)
|
||||
{
|
||||
super (cap, lim, off, 0);
|
||||
this.backing_buffer = new byte [cap];
|
||||
readOnly = false;
|
||||
}
|
||||
|
||||
public ByteBufferImpl (byte[] array, int offset, int length)
|
||||
ByteBufferImpl (int capacity)
|
||||
{
|
||||
super (array.length, length, offset, 0);
|
||||
this.backing_buffer = array;
|
||||
readOnly = false;
|
||||
this (new byte [capacity], 0, capacity, capacity, 0, -1, false);
|
||||
}
|
||||
|
||||
ByteBufferImpl (byte[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
|
||||
{
|
||||
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 ()
|
||||
|
||||
Reference in New Issue
Block a user