diff options
Diffstat (limited to 'libjava/classpath/java/nio')
-rw-r--r-- | libjava/classpath/java/nio/ByteBufferImpl.java | 17 | ||||
-rw-r--r-- | libjava/classpath/java/nio/CharBufferImpl.java | 13 | ||||
-rw-r--r-- | libjava/classpath/java/nio/DoubleBufferImpl.java | 13 | ||||
-rw-r--r-- | libjava/classpath/java/nio/FloatBufferImpl.java | 13 | ||||
-rw-r--r-- | libjava/classpath/java/nio/IntBufferImpl.java | 13 | ||||
-rw-r--r-- | libjava/classpath/java/nio/LongBufferImpl.java | 13 | ||||
-rw-r--r-- | libjava/classpath/java/nio/MappedByteBuffer.java | 2 | ||||
-rw-r--r-- | libjava/classpath/java/nio/ShortBufferImpl.java | 13 | ||||
-rw-r--r-- | libjava/classpath/java/nio/channels/Channels.java | 4 | ||||
-rw-r--r-- | libjava/classpath/java/nio/class-dependencies.conf | 58 |
10 files changed, 44 insertions, 115 deletions
diff --git a/libjava/classpath/java/nio/ByteBufferImpl.java b/libjava/classpath/java/nio/ByteBufferImpl.java index 48d7152..aa51a65 100644 --- a/libjava/classpath/java/nio/ByteBufferImpl.java +++ b/libjava/classpath/java/nio/ByteBufferImpl.java @@ -115,18 +115,11 @@ final class ByteBufferImpl extends ByteBuffer checkIfReadOnly(); mark = -1; int pos = position(); - if (pos > 0) - { - int count = remaining(); - shiftDown(0, pos, count); - position(count); - limit(capacity()); - } - else - { - position(limit()); - limit(capacity()); - } + int n = limit() - pos; + if (n > 0) + shiftDown(0, pos, n); + position(n); + limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/CharBufferImpl.java b/libjava/classpath/java/nio/CharBufferImpl.java index 33f8dab..e6097cb 100644 --- a/libjava/classpath/java/nio/CharBufferImpl.java +++ b/libjava/classpath/java/nio/CharBufferImpl.java @@ -90,15 +90,14 @@ final class CharBufferImpl extends CharBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/DoubleBufferImpl.java b/libjava/classpath/java/nio/DoubleBufferImpl.java index 248ab45e..98e8e97 100644 --- a/libjava/classpath/java/nio/DoubleBufferImpl.java +++ b/libjava/classpath/java/nio/DoubleBufferImpl.java @@ -82,15 +82,14 @@ final class DoubleBufferImpl extends DoubleBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/FloatBufferImpl.java b/libjava/classpath/java/nio/FloatBufferImpl.java index b486878..f1182ba 100644 --- a/libjava/classpath/java/nio/FloatBufferImpl.java +++ b/libjava/classpath/java/nio/FloatBufferImpl.java @@ -82,15 +82,14 @@ final class FloatBufferImpl extends FloatBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/IntBufferImpl.java b/libjava/classpath/java/nio/IntBufferImpl.java index 2265748..2bd1842 100644 --- a/libjava/classpath/java/nio/IntBufferImpl.java +++ b/libjava/classpath/java/nio/IntBufferImpl.java @@ -82,15 +82,14 @@ final class IntBufferImpl extends IntBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/LongBufferImpl.java b/libjava/classpath/java/nio/LongBufferImpl.java index 8772f61..c04c417 100644 --- a/libjava/classpath/java/nio/LongBufferImpl.java +++ b/libjava/classpath/java/nio/LongBufferImpl.java @@ -82,15 +82,14 @@ final class LongBufferImpl extends LongBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/MappedByteBuffer.java b/libjava/classpath/java/nio/MappedByteBuffer.java index fa25bb7..25b0993 100644 --- a/libjava/classpath/java/nio/MappedByteBuffer.java +++ b/libjava/classpath/java/nio/MappedByteBuffer.java @@ -85,7 +85,7 @@ public abstract class MappedByteBuffer extends ByteBuffer forceImpl(); } - public void finalize() + protected void finalize() throws Throwable { unmapImpl(); diff --git a/libjava/classpath/java/nio/ShortBufferImpl.java b/libjava/classpath/java/nio/ShortBufferImpl.java index ee5bff2..50f65ec 100644 --- a/libjava/classpath/java/nio/ShortBufferImpl.java +++ b/libjava/classpath/java/nio/ShortBufferImpl.java @@ -82,15 +82,14 @@ final class ShortBufferImpl extends ShortBuffer { checkIfReadOnly(); mark = -1; - int copied = 0; - - while (remaining () > 0) + int p = position(); + int n = limit() - p; + if (n > 0) { - put (copied, get ()); - copied++; + System.arraycopy(backing_buffer, array_offset + p, + backing_buffer, array_offset, n); } - - position (copied); + position(n); limit(capacity()); return this; } diff --git a/libjava/classpath/java/nio/channels/Channels.java b/libjava/classpath/java/nio/channels/Channels.java index cfd8605..382a3d7 100644 --- a/libjava/classpath/java/nio/channels/Channels.java +++ b/libjava/classpath/java/nio/channels/Channels.java @@ -39,6 +39,7 @@ exception statement from your version. */ package java.nio.channels; import gnu.java.nio.ChannelReader; +import gnu.java.nio.ChannelWriter; import gnu.java.nio.InputStreamChannel; import gnu.java.nio.OutputStreamChannel; @@ -126,8 +127,7 @@ public final class Channels public static Writer newWriter(WritableByteChannel ch, CharsetEncoder enc, int minBufferCap) { - // FIXME: implement java.nio.channels.Channel.newWriter(WritableByteChannel, CharsetEncoder, int) - throw new Error("not implemented"); + return new ChannelWriter(ch, enc, minBufferCap); } /** diff --git a/libjava/classpath/java/nio/class-dependencies.conf b/libjava/classpath/java/nio/class-dependencies.conf deleted file mode 100644 index 4fbf75e..0000000 --- a/libjava/classpath/java/nio/class-dependencies.conf +++ /dev/null @@ -1,58 +0,0 @@ -# This property file contains dependencies of classes, methods, and -# field on other methods or classes. -# -# Syntax: -# -# <used>: <needed 1> [... <needed N>] -# -# means that when <used> is included, <needed 1> (... <needed N>) must -# be included as well. -# -# <needed X> and <used> are of the form -# -# <class.methodOrField(signature)> -# -# or just -# -# <class> -# -# Within dependencies, variables can be used. A variable is defined as -# follows: -# -# {variable}: value1 value2 ... value<n> -# -# variables can be used on the right side of dependencies as follows: -# -# <used>: com.bla.blu.{variable}.Class.m()V -# -# The use of the variable will expand to <n> dependencies of the form -# -# <used>: com.bla.blu.value1.Class.m()V -# <used>: com.bla.blu.value2.Class.m()V -# ... -# <used>: com.bla.blu.value<n>.Class.m()V -# -# Variables can be redefined when building a system to select the -# required support for features like encodings, protocols, etc. -# -# Hints: -# -# - For methods and fields, the signature is mandatory. For -# specification, please see the Java Virtual Machine Specification by -# SUN. Unlike in the spec, field signatures (types) are in brackets. -# -# - Package names must be separated by '/' (and not '.'). E.g., -# java/lang/Class (this is necessary, because the '.' is used to -# separate method or field names from classes) -# -# - In case <needed> refers to a class, only the class itself will be -# included in the resulting binary, NOT necessarily all its methods -# and fields. If you want to refer to all methods and fields, you can -# write class.* as an abbreviation. -# -# - Abbreviations for packages are also possible: my/package/* means all -# methods and fields of all classes in my/package. -# -# - A line with a trailing '\' continues in the next line. - -# end of file |