aboutsummaryrefslogtreecommitdiff
path: root/libjava/java/nio
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2005-07-16 01:27:14 +0000
committerTom Tromey <tromey@gcc.gnu.org>2005-07-16 01:27:14 +0000
commitb0fa81eea9a270f23d6ad67ca7a6d25c18d20da1 (patch)
tree8762d1f992e2f725a6bde1ff966ed6f1e5f4f823 /libjava/java/nio
parentea54b29342c8506acb4f858c68340c44b72e3532 (diff)
downloadgcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.zip
gcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.tar.gz
gcc-b0fa81eea9a270f23d6ad67ca7a6d25c18d20da1.tar.bz2
Major merge with Classpath.
Removed many duplicate files. * HACKING: Updated.x * classpath: Imported new directory. * standard.omit: New file. * Makefile.in, aclocal.m4, configure: Rebuilt. * sources.am: New file. * configure.ac: Run Classpath configure script. Moved code around to support. Disable xlib AWT peers (temporarily). * Makefile.am (SUBDIRS): Added 'classpath' (JAVAC): Removed. (AM_CPPFLAGS): Added more -I options. (BOOTCLASSPATH): Simplified. Completely redid how sources are built. Include sources.am. * include/Makefile.am (tool_include__HEADERS): Removed jni.h. * include/jni.h: Removed (in Classpath). * scripts/classes.pl: Updated to look at built classes. * scripts/makemake.tcl: New file. * testsuite/libjava.jni/jni.exp (gcj_jni_compile_c_to_so): Added -I options. (gcj_jni_invocation_compile_c_to_binary): Likewise. From-SVN: r102082
Diffstat (limited to 'libjava/java/nio')
-rw-r--r--libjava/java/nio/BufferOverflowException.java51
-rw-r--r--libjava/java/nio/BufferUnderflowException.java51
-rw-r--r--libjava/java/nio/ByteBuffer.java651
-rw-r--r--libjava/java/nio/ByteBufferHelper.java344
-rw-r--r--libjava/java/nio/ByteBufferImpl.java379
-rw-r--r--libjava/java/nio/ByteOrder.java82
-rw-r--r--libjava/java/nio/CharBuffer.java508
-rw-r--r--libjava/java/nio/CharBufferImpl.java219
-rw-r--r--libjava/java/nio/CharViewBufferImpl.java187
-rw-r--r--libjava/java/nio/DoubleBuffer.java383
-rw-r--r--libjava/java/nio/DoubleBufferImpl.java172
-rw-r--r--libjava/java/nio/DoubleViewBufferImpl.java172
-rw-r--r--libjava/java/nio/FloatBuffer.java383
-rw-r--r--libjava/java/nio/FloatBufferImpl.java172
-rw-r--r--libjava/java/nio/FloatViewBufferImpl.java173
-rw-r--r--libjava/java/nio/IntBuffer.java383
-rw-r--r--libjava/java/nio/IntBufferImpl.java172
-rw-r--r--libjava/java/nio/IntViewBufferImpl.java173
-rw-r--r--libjava/java/nio/InvalidMarkException.java52
-rw-r--r--libjava/java/nio/LongBuffer.java383
-rw-r--r--libjava/java/nio/LongBufferImpl.java172
-rw-r--r--libjava/java/nio/LongViewBufferImpl.java173
-rw-r--r--libjava/java/nio/ReadOnlyBufferException.java52
-rw-r--r--libjava/java/nio/ShortBuffer.java383
-rw-r--r--libjava/java/nio/ShortBufferImpl.java172
-rw-r--r--libjava/java/nio/ShortViewBufferImpl.java173
-rw-r--r--libjava/java/nio/channels/AlreadyConnectedException.java48
-rw-r--r--libjava/java/nio/channels/AsynchronousCloseException.java53
-rw-r--r--libjava/java/nio/channels/ByteChannel.java43
-rw-r--r--libjava/java/nio/channels/CancelledKeyException.java53
-rw-r--r--libjava/java/nio/channels/Channel.java59
-rw-r--r--libjava/java/nio/channels/ClosedByInterruptException.java53
-rw-r--r--libjava/java/nio/channels/ClosedChannelException.java55
-rw-r--r--libjava/java/nio/channels/ClosedSelectorException.java53
-rw-r--r--libjava/java/nio/channels/ConnectionPendingException.java53
-rw-r--r--libjava/java/nio/channels/DatagramChannel.java210
-rw-r--r--libjava/java/nio/channels/FileChannel.java367
-rw-r--r--libjava/java/nio/channels/FileLock.java150
-rw-r--r--libjava/java/nio/channels/FileLockInterruptionException.java55
-rw-r--r--libjava/java/nio/channels/GatheringByteChannel.java79
-rw-r--r--libjava/java/nio/channels/IllegalBlockingModeException.java57
-rw-r--r--libjava/java/nio/channels/IllegalSelectorException.java53
-rw-r--r--libjava/java/nio/channels/InterruptibleChannel.java51
-rw-r--r--libjava/java/nio/channels/NoConnectionPendingException.java53
-rw-r--r--libjava/java/nio/channels/NonReadableChannelException.java53
-rw-r--r--libjava/java/nio/channels/NonWritableChannelException.java53
-rw-r--r--libjava/java/nio/channels/NotYetBoundException.java53
-rw-r--r--libjava/java/nio/channels/NotYetConnectedException.java53
-rw-r--r--libjava/java/nio/channels/OverlappingFileLockException.java53
-rw-r--r--libjava/java/nio/channels/Pipe.java121
-rw-r--r--libjava/java/nio/channels/ReadableByteChannel.java64
-rw-r--r--libjava/java/nio/channels/ScatteringByteChannel.java79
-rw-r--r--libjava/java/nio/channels/SelectableChannel.java140
-rw-r--r--libjava/java/nio/channels/SelectionKey.java164
-rw-r--r--libjava/java/nio/channels/Selector.java134
-rw-r--r--libjava/java/nio/channels/ServerSocketChannel.java98
-rw-r--r--libjava/java/nio/channels/SocketChannel.java248
-rw-r--r--libjava/java/nio/channels/UnresolvedAddressException.java53
-rw-r--r--libjava/java/nio/channels/UnsupportedAddressTypeException.java53
-rw-r--r--libjava/java/nio/channels/WritableByteChannel.java60
-rw-r--r--libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java119
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectableChannel.java256
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelectionKey.java78
-rw-r--r--libjava/java/nio/channels/spi/AbstractSelector.java167
-rw-r--r--libjava/java/nio/channels/spi/SelectorProvider.java151
-rw-r--r--libjava/java/nio/charset/CharacterCodingException.java53
-rw-r--r--libjava/java/nio/charset/CharsetDecoder.java313
-rw-r--r--libjava/java/nio/charset/CharsetEncoder.java365
-rw-r--r--libjava/java/nio/charset/CoderMalfunctionError.java52
-rw-r--r--libjava/java/nio/charset/CoderResult.java189
-rw-r--r--libjava/java/nio/charset/CodingErrorAction.java66
-rw-r--r--libjava/java/nio/charset/IllegalCharsetNameException.java73
-rw-r--r--libjava/java/nio/charset/MalformedInputException.java77
-rw-r--r--libjava/java/nio/charset/UnmappableCharacterException.java71
-rw-r--r--libjava/java/nio/charset/UnsupportedCharsetException.java69
-rw-r--r--libjava/java/nio/charset/spi/CharsetProvider.java91
76 files changed, 0 insertions, 11429 deletions
diff --git a/libjava/java/nio/BufferOverflowException.java b/libjava/java/nio/BufferOverflowException.java
deleted file mode 100644
index 588c032..0000000
--- a/libjava/java/nio/BufferOverflowException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* BufferOverflowException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public class BufferOverflowException extends RuntimeException
-{
- /**
- * Creates the exception
- */
- public BufferOverflowException ()
- {
- }
-}
diff --git a/libjava/java/nio/BufferUnderflowException.java b/libjava/java/nio/BufferUnderflowException.java
deleted file mode 100644
index 4b4161c..0000000
--- a/libjava/java/nio/BufferUnderflowException.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* BufferUnderflowException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public class BufferUnderflowException extends RuntimeException
-{
- /**
- * Creates the exception
- */
- public BufferUnderflowException ()
- {
- }
-}
diff --git a/libjava/java/nio/ByteBuffer.java b/libjava/java/nio/ByteBuffer.java
deleted file mode 100644
index 0ccf766..0000000
--- a/libjava/java/nio/ByteBuffer.java
+++ /dev/null
@@ -1,651 +0,0 @@
-/* ByteBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class ByteBuffer extends Buffer
- implements Comparable
-{
- ByteOrder endian = ByteOrder.BIG_ENDIAN;
-
- int array_offset;
- byte[] backing_buffer;
-
- ByteBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- }
-
- /**
- * Allocates a new direct byte buffer.
- */
- public static ByteBuffer allocateDirect (int capacity)
- {
- return DirectByteBufferImpl.allocate (capacity);
- }
-
- /**
- * Allocates a new <code>ByteBuffer</code> object with a given capacity.
- */
- public static ByteBuffer allocate (int capacity)
- {
- return wrap(new byte[capacity], 0, capacity);
- }
-
- /**
- * Wraps a <code>byte</code> array into a <code>ByteBuffer</code>
- * object.
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final ByteBuffer wrap (byte[] array, int offset, int length)
- {
- // FIXME: In GCJ and other implementations where arrays may not
- // move we might consider, at least when offset==0:
- // return new DirectByteBufferImpl(array,
- // address_of_data(array) + offset,
- // length, length, 0, false);
- // This may be more efficient, mainly because we can then use the
- // same logic for all ByteBuffers.
-
- return new ByteBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a <code>byte</code> array into a <code>ByteBuffer</code>
- * object.
- */
- public static final ByteBuffer wrap (byte[] array)
- {
- return wrap (array, 0, array.length);
- }
-
- /**
- * This method transfers <code>byte</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>byte</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>byte</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>byte</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public ByteBuffer get (byte[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>byte</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>byte</code>s remaining in this buffer.
- */
- public ByteBuffer get (byte[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>ByteBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>byte</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ByteBuffer put (ByteBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining());
-
- if (src.remaining () > 0)
- {
- byte[] toPut = new byte [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>byte array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>byte</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ByteBuffer put (byte[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>byte array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>byte</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final ByteBuffer put (byte[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>byte</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>byte</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final byte[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with <code>int</code> arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data. Note that the hashcode is dependent
- * on buffer content, and therefore is not useful if the buffer
- * content may change.
- *
- * @return the hash code
- */
- public int hashCode ()
- {
- int hashCode = get(position()) + 31;
- int multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
- }
- return hashCode;
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof ByteBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>ByteBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>ByteBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- ByteBuffer other = (ByteBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- byte a = get(pos_this++);
- byte b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public final ByteOrder order ()
- {
- return endian;
- }
-
- /**
- * Modifies this buffer's byte order.
- */
- public final ByteBuffer order (ByteOrder endian)
- {
- this.endian = endian;
- return this;
- }
-
- /**
- * Reads the <code>byte</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>byte</code>s in this buffer.
- */
- public abstract byte get ();
-
- /**
- * Writes the <code>byte</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>byte</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract ByteBuffer put (byte b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract byte get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract ByteBuffer put (int index, byte b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract ByteBuffer compact ();
-
- void shiftDown (int dst_offset, int src_offset, int count)
- {
- for (int i = 0; i < count; i++)
- put(dst_offset + i, get(src_offset + i));
- }
-
- /**
- * Tells whether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>ByteBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract ByteBuffer slice ();
-
- /**
- * Creates a new <code>ByteBuffer</code> that shares this buffer's
- * content.
- */
- public abstract ByteBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>ByteBuffer</code> that shares this
- * buffer's content.
- */
- public abstract ByteBuffer asReadOnlyBuffer ();
-
- /**
- * Creates a view of this byte buffer as a short buffer.
- */
- public abstract ShortBuffer asShortBuffer ();
-
- /**
- * Creates a view of this byte buffer as a char buffer.
- */
- public abstract CharBuffer asCharBuffer ();
-
- /**
- * Creates a view of this byte buffer as an integer buffer.
- */
- public abstract IntBuffer asIntBuffer ();
-
- /**
- * Creates a view of this byte buffer as a long buffer.
- */
- public abstract LongBuffer asLongBuffer ();
-
- /**
- * Creates a view of this byte buffer as a float buffer.
- */
- public abstract FloatBuffer asFloatBuffer ();
-
- /**
- * Creates a view of this byte buffer as a double buffer.
- */
- public abstract DoubleBuffer asDoubleBuffer ();
-
- /**
- * Relative get method for reading a character value.
- *
- * @exception BufferUnderflowException If there are fewer than two bytes
- * remaining in this buffer.
- */
- public abstract char getChar ();
-
- /**
- * Relative put method for writing a character value.
- *
- * @exception BufferOverflowException If this buffer's current position is
- * not smaller than its limit.
- */
- public abstract ByteBuffer putChar (char value);
-
- /**
- * Absolute get method for reading a character value.
- *
- * @exception IndexOutOfBoundsException If there are fewer than two bytes
- * remaining in this buffer
- */
- public abstract char getChar (int index);
-
- /**
- * Absolute put method for writing a character value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus one.
- */
- public abstract ByteBuffer putChar (int index, char value);
-
- /**
- * Relative get method for reading a short value.
- *
- * @exception BufferUnderflowException If index is negative or not smaller
- * than the buffer's limit, minus one.
- */
- public abstract short getShort ();
-
- /**
- * Relative put method for writing a short value.
- *
- * @exception BufferOverflowException If this buffer's current position is
- * not smaller than its limit.
- */
- public abstract ByteBuffer putShort (short value);
-
- /**
- * Absolute get method for reading a short value.
- *
- * @exception IndexOutOfBoundsException If there are fewer than two bytes
- * remaining in this buffer
- */
- public abstract short getShort (int index);
-
- /**
- * Absolute put method for writing a short value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus one.
- */
- public abstract ByteBuffer putShort (int index, short value);
-
- /**
- * Relative get method for reading an integer value.
- *
- * @exception BufferUnderflowException If there are fewer than four bytes
- * remaining in this buffer.
- */
- public abstract int getInt ();
-
- /**
- * Relative put method for writing an integer value.
- *
- * @exception BufferOverflowException If this buffer's current position is
- * not smaller than its limit.
- */
- public abstract ByteBuffer putInt (int value);
-
- /**
- * Absolute get method for reading an integer value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus three.
- */
- public abstract int getInt (int index);
-
- /**
- * Absolute put method for writing an integer value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus three.
- */
- public abstract ByteBuffer putInt (int index, int value);
-
- /**
- * Relative get method for reading a long value.
- *
- * @exception BufferUnderflowException If there are fewer than eight bytes
- * remaining in this buffer.
- */
- public abstract long getLong ();
-
- /**
- * Relative put method for writing a long value.
- *
- * @exception BufferOverflowException If this buffer's current position is
- * not smaller than its limit.
- */
- public abstract ByteBuffer putLong (long value);
-
- /**
- * Absolute get method for reading a long value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus seven.
- */
- public abstract long getLong (int index);
-
- /**
- * Absolute put method for writing a float value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus seven.
- */
- public abstract ByteBuffer putLong (int index, long value);
-
- /**
- * Relative get method for reading a float value.
- *
- * @exception BufferUnderflowException If there are fewer than four bytes
- * remaining in this buffer.
- */
- public abstract float getFloat ();
-
- /**
- * Relative put method for writing a float value.
- *
- * @exception BufferOverflowException If there are fewer than four bytes
- * remaining in this buffer.
- */
- public abstract ByteBuffer putFloat (float value);
-
- /**
- * Absolute get method for reading a float value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus three.
- */
- public abstract float getFloat (int index);
-
- /**
- * Relative put method for writing a float value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus three.
- */
- public abstract ByteBuffer putFloat (int index, float value);
-
- /**
- * Relative get method for reading a double value.
- *
- * @exception BufferUnderflowException If there are fewer than eight bytes
- * remaining in this buffer.
- */
- public abstract double getDouble ();
-
- /**
- * Relative put method for writing a double value.
- *
- * @exception BufferOverflowException If this buffer's current position is
- * not smaller than its limit.
- */
- public abstract ByteBuffer putDouble (double value);
-
- /**
- * Absolute get method for reading a double value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus seven.
- */
- public abstract double getDouble (int index);
-
- /**
- * Absolute put method for writing a double value.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit, minus seven.
- */
- public abstract ByteBuffer putDouble (int index, double value);
-
- /**
- * Returns a string summarizing the state of this buffer.
- */
- public String toString ()
- {
- return getClass ().getName () +
- "[pos=" + position () +
- " lim=" + limit () +
- " cap=" + capacity () + "]";
- }
-}
diff --git a/libjava/java/nio/ByteBufferHelper.java b/libjava/java/nio/ByteBufferHelper.java
deleted file mode 100644
index 6c46ca5..0000000
--- a/libjava/java/nio/ByteBufferHelper.java
+++ /dev/null
@@ -1,344 +0,0 @@
-/* ByteBufferImpl.java --
- Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- */
-final class ByteBufferHelper
-{
- public static char getChar (ByteBuffer buffer, ByteOrder order)
- {
- return (char) getShort (buffer, order);
- }
-
- public static void putChar (ByteBuffer buffer, char value, ByteOrder order)
- {
- putShort (buffer, (short) value, order);
- }
-
- public static char getChar (ByteBuffer buffer, int index, ByteOrder order)
- {
- return (char) getShort (buffer, index, order);
- }
-
- public static void putChar (ByteBuffer buffer, int index,
- char value, ByteOrder order)
- {
- putShort (buffer, index, (short) value, order);
- }
-
- public static short getShort (ByteBuffer buffer, ByteOrder order)
- {
- buffer.checkForUnderflow(2);
-
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- return (short) ((buffer.get() & 0xff)
- + (buffer.get() << 8));
- }
-
- return (short) ((buffer.get() << 8)
- + (buffer.get() & 0xff));
- }
-
- public static void putShort (ByteBuffer buffer, short value, ByteOrder order)
- {
- buffer.checkForOverflow(2);
-
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- buffer.put ((byte) value);
- buffer.put ((byte) (value >> 8));
- }
- else
- {
- buffer.put ((byte) (value >> 8));
- buffer.put ((byte) value);
- }
- }
-
- public static short getShort (ByteBuffer buffer,
- int index, ByteOrder order)
- {
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- return (short) ((buffer.get (index) & 0xff)
- + (buffer.get (++index) << 8));
- }
-
- return (short) ((buffer.get (index) << 8)
- + (buffer.get (++index) & 0xff));
- }
-
- public static void putShort (ByteBuffer buffer, int index,
- short value, ByteOrder order)
- {
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- buffer.put (index, (byte) value);
- buffer.put (++index, (byte) (value >> 8));
- }
- else
- {
- buffer.put (index, (byte) (value >> 8));
- buffer.put (++index, (byte) value);
- }
- }
-
- public static int getInt (ByteBuffer buffer, ByteOrder order)
- {
- buffer.checkForUnderflow(4);
-
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- return ((buffer.get() & 0xff)
- + ((buffer.get() & 0xff) << 8)
- + ((buffer.get() & 0xff) << 16)
- + (buffer.get() << 24));
- }
-
- return (int) ((buffer.get() << 24)
- + ((buffer.get() & 0xff) << 16)
- + ((buffer.get() & 0xff) << 8)
- + (buffer.get() & 0xff));
- }
-
- public static void putInt (ByteBuffer buffer, int value, ByteOrder order)
- {
- buffer.checkForOverflow(4);
-
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- buffer.put ((byte) value);
- buffer.put ((byte) (value >> 8));
- buffer.put ((byte) (value >> 16));
- buffer.put ((byte) (value >> 24));
- }
- else
- {
- buffer.put ((byte) (value >> 24));
- buffer.put ((byte) (value >> 16));
- buffer.put ((byte) (value >> 8));
- buffer.put ((byte) value);
- }
- }
-
- public static int getInt (ByteBuffer buffer, int index, ByteOrder order)
- {
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- return ((buffer.get (index) & 0xff)
- + ((buffer.get (++index) & 0xff) << 8)
- + ((buffer.get (++index) & 0xff) << 16)
- + (buffer.get (++index) << 24));
- }
-
- return ((buffer.get (index) << 24)
- + ((buffer.get (++index) & 0xff) << 16)
- + ((buffer.get (++index) & 0xff) << 8)
- + (buffer.get (++index) & 0xff));
- }
-
- public static void putInt (ByteBuffer buffer, int index,
- int value, ByteOrder order)
- {
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- buffer.put (index, (byte) value);
- buffer.put (++index, (byte) (value >> 8));
- buffer.put (++index, (byte) (value >> 16));
- buffer.put (++index, (byte) (value >> 24));
- }
- else
- {
- buffer.put (index, (byte) (value >> 24));
- buffer.put (++index, (byte) (value >> 16));
- buffer.put (++index, (byte) (value >> 8));
- buffer.put (++index, (byte) value);
- }
- }
-
- public static long getLong (ByteBuffer buffer, ByteOrder order)
- {
- buffer.checkForUnderflow(8);
-
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- return ((buffer.get() & 0xff)
- + (((buffer.get() & 0xff)) << 8)
- + (((buffer.get() & 0xff)) << 16)
- + (((buffer.get() & 0xffL)) << 24)
- + (((buffer.get() & 0xffL)) << 32)
- + (((buffer.get() & 0xffL)) << 40)
- + (((buffer.get() & 0xffL)) << 48)
- + (((long) buffer.get()) << 56));
- }
-
- return ((((long) buffer.get()) << 56)
- + ((buffer.get() & 0xffL) << 48)
- + ((buffer.get() & 0xffL) << 40)
- + ((buffer.get() & 0xffL) << 32)
- + ((buffer.get() & 0xffL) << 24)
- + ((buffer.get() & 0xff) << 16)
- + ((buffer.get() & 0xff) << 8)
- + (buffer.get() & 0xff));
- }
-
- public static void putLong (ByteBuffer buffer, long value, ByteOrder order)
- {
- buffer.checkForOverflow(8);
-
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- buffer.put ((byte) value);
- buffer.put ((byte) (value >> 8));
- buffer.put ((byte) (value >> 16));
- buffer.put ((byte) (value >> 24));
- buffer.put ((byte) (value >> 32));
- buffer.put ((byte) (value >> 40));
- buffer.put ((byte) (value >> 48));
- buffer.put ((byte) (value >> 56));
- }
- else
- {
- buffer.put ((byte) (value >> 56));
- buffer.put ((byte) (value >> 48));
- buffer.put ((byte) (value >> 40));
- buffer.put ((byte) (value >> 32));
- buffer.put ((byte) (value >> 24));
- buffer.put ((byte) (value >> 16));
- buffer.put ((byte) (value >> 8));
- buffer.put ((byte) value);
- }
- }
-
- public static long getLong (ByteBuffer buffer, int index, ByteOrder order)
- {
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- return ((buffer.get (index) & 0xff)
- + ((buffer.get (++index) & 0xff) << 8)
- + ((buffer.get (++index) & 0xff) << 16)
- + ((buffer.get (++index) & 0xffL) << 24)
- + ((buffer.get (++index) & 0xffL) << 32)
- + ((buffer.get (++index) & 0xffL) << 40)
- + ((buffer.get (++index) & 0xffL) << 48)
- + (((long) buffer.get (++index)) << 56));
- }
-
- return ((((long) buffer.get (index)) << 56)
- + ((buffer.get (++index) & 0xffL) << 48)
- + ((buffer.get (++index) & 0xffL) << 40)
- + ((buffer.get (++index) & 0xffL) << 32)
- + ((buffer.get (++index) & 0xffL) << 24)
- + ((buffer.get (++index) & 0xff) << 16)
- + ((buffer.get (++index) & 0xff) << 8)
- + (buffer.get (++index) & 0xff));
- }
-
- public static void putLong (ByteBuffer buffer, int index,
- long value, ByteOrder order)
- {
- if (order == ByteOrder.LITTLE_ENDIAN)
- {
- buffer.put (index, (byte) value);
- buffer.put (++index, (byte) (value >> 8));
- buffer.put (++index, (byte) (value >> 16));
- buffer.put (++index, (byte) (value >> 24));
- buffer.put (++index, (byte) (value >> 32));
- buffer.put (++index, (byte) (value >> 40));
- buffer.put (++index, (byte) (value >> 48));
- buffer.put (++index, (byte) (value >> 56));
- }
- else
- {
- buffer.put (index, (byte) (value >> 56));
- buffer.put (++index, (byte) (value >> 48));
- buffer.put (++index, (byte) (value >> 40));
- buffer.put (++index, (byte) (value >> 32));
- buffer.put (++index, (byte) (value >> 24));
- buffer.put (++index, (byte) (value >> 16));
- buffer.put (++index, (byte) (value >> 8));
- buffer.put (++index, (byte) value);
- }
- }
-
- public static float getFloat (ByteBuffer buffer, ByteOrder order)
- {
- return Float.intBitsToFloat (getInt (buffer, order));
- }
-
- public static void putFloat (ByteBuffer buffer, float value, ByteOrder order)
- {
- putInt (buffer, Float.floatToRawIntBits (value), order);
- }
-
- public static float getFloat (ByteBuffer buffer, int index, ByteOrder order)
- {
- return Float.intBitsToFloat (getInt (buffer, index, order));
- }
-
- public static void putFloat (ByteBuffer buffer, int index,
- float value, ByteOrder order)
- {
- putInt (buffer, index, Float.floatToRawIntBits (value), order);
- }
-
- public static double getDouble (ByteBuffer buffer, ByteOrder order)
- {
- return Double.longBitsToDouble (getLong (buffer, order));
- }
-
- public static void putDouble (ByteBuffer buffer, double value, ByteOrder order)
- {
- putLong (buffer, Double.doubleToRawLongBits (value), order);
- }
-
- public static double getDouble (ByteBuffer buffer, int index, ByteOrder order)
- {
- return Double.longBitsToDouble (getLong (buffer, index, order));
- }
-
- public static void putDouble (ByteBuffer buffer, int index,
- double value, ByteOrder order)
- {
- putLong (buffer, index, Double.doubleToRawLongBits (value), order);
- }
-} // ByteBufferHelper
-
diff --git a/libjava/java/nio/ByteBufferImpl.java b/libjava/java/nio/ByteBufferImpl.java
deleted file mode 100644
index 48d7152..0000000
--- a/libjava/java/nio/ByteBufferImpl.java
+++ /dev/null
@@ -1,379 +0,0 @@
-/* ByteBufferImpl.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class ByteBufferImpl extends ByteBuffer
-{
- private boolean readOnly;
-
- ByteBufferImpl (byte[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public CharBuffer asCharBuffer ()
- {
- return new CharViewBufferImpl (this, remaining() >> 1);
- }
-
- public ShortBuffer asShortBuffer ()
- {
- return new ShortViewBufferImpl (this, remaining() >> 1);
- }
-
- public IntBuffer asIntBuffer ()
- {
- return new IntViewBufferImpl (this, remaining() >> 2);
- }
-
- public LongBuffer asLongBuffer ()
- {
- return new LongViewBufferImpl (this, remaining() >> 3);
- }
-
- public FloatBuffer asFloatBuffer ()
- {
- return new FloatViewBufferImpl (this, remaining() >> 2);
- }
-
- public DoubleBuffer asDoubleBuffer ()
- {
- return new DoubleViewBufferImpl (this, remaining() >> 3);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public ByteBuffer slice ()
- {
- return new ByteBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public ByteBuffer duplicate ()
- {
- return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public ByteBuffer asReadOnlyBuffer ()
- {
- return new ByteBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- void shiftDown (int dst_offset, int src_offset, int count)
- {
- System.arraycopy(backing_buffer, array_offset + src_offset,
- backing_buffer, array_offset + dst_offset,
- count);
- }
-
- public ByteBuffer compact ()
- {
- 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());
- }
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- /**
- * Reads the <code>byte</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>bytes</code> in this buffer.
- */
- public byte get ()
- {
- if (pos >= limit)
- throw new BufferUnderflowException();
-
- return backing_buffer [(pos++) + array_offset];
- }
-
- /**
- * Bulk get
- */
- public ByteBuffer get (byte[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- if ( (limit - pos) < length) // check for overflow
- throw new BufferUnderflowException();
-
- System.arraycopy(backing_buffer, pos + array_offset,
- dst, offset, length);
- pos += length;
-
- return this;
- }
-
- /**
- * Relative bulk put(), overloads the ByteBuffer impl.
- */
- public ByteBuffer put (byte[] src, int offset, int length)
- {
- if ( (limit - pos) < length) // check for overflow
- throw new BufferOverflowException();
- checkArraySize(src.length, offset, length);
-
- System.arraycopy(src, offset, backing_buffer, pos + array_offset, length);
- pos += length;
-
- return this;
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception BufferOverflowException If there is no remaining
- * space in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ByteBuffer put (byte value)
- {
- if (readOnly)
- throw new ReadOnlyBufferException();
- if (pos >= limit)
- throw new BufferOverflowException();
-
- backing_buffer [(pos++) + array_offset] = value;
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>byte</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public byte get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index + array_offset];
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ByteBuffer put (int index, byte value)
- {
- checkIfReadOnly();
- checkIndex(index);
-
- backing_buffer [index + array_offset] = value;
- return this;
- }
-
- public char getChar ()
- {
- return ByteBufferHelper.getChar(this, order());
- }
-
- public ByteBuffer putChar (char value)
- {
- if (readOnly)
- throw new ReadOnlyBufferException ();
- if ( (limit-pos) < 2)
- throw new BufferOverflowException();
-
- if (endian == ByteOrder.LITTLE_ENDIAN)
- {
- backing_buffer [(pos++) + array_offset] = (byte)(value&0xFF);
- backing_buffer [(pos++) + array_offset] = (byte)(value>>8);
- }
- else
- {
- backing_buffer [(pos++) + array_offset] = (byte)(value>>8);
- backing_buffer [(pos++) + array_offset] = (byte)(value&0xFF);
- }
- return this;
- }
-
- public char getChar (int index)
- {
- return ByteBufferHelper.getChar(this, index, order());
- }
-
- public ByteBuffer putChar (int index, char value)
- {
- ByteBufferHelper.putChar(this, index, value, order());
- return this;
- }
-
- public short getShort ()
- {
- return ByteBufferHelper.getShort(this, order());
- }
-
- public ByteBuffer putShort (short value)
- {
- ByteBufferHelper.putShort(this, value, order());
- return this;
- }
-
- public short getShort (int index)
- {
- return ByteBufferHelper.getShort(this, index, order());
- }
-
- public ByteBuffer putShort (int index, short value)
- {
- ByteBufferHelper.putShort(this, index, value, order());
- return this;
- }
-
- public int getInt ()
- {
- return ByteBufferHelper.getInt(this, order());
- }
-
- public ByteBuffer putInt (int value)
- {
- ByteBufferHelper.putInt(this, value, order());
- return this;
- }
-
- public int getInt (int index)
- {
- return ByteBufferHelper.getInt(this, index, order());
- }
-
- public ByteBuffer putInt (int index, int value)
- {
- ByteBufferHelper.putInt(this, index, value, order());
- return this;
- }
-
- public long getLong ()
- {
- return ByteBufferHelper.getLong(this, order());
- }
-
- public ByteBuffer putLong (long value)
- {
- ByteBufferHelper.putLong (this, value, order());
- return this;
- }
-
- public long getLong (int index)
- {
- return ByteBufferHelper.getLong (this, index, order());
- }
-
- public ByteBuffer putLong (int index, long value)
- {
- ByteBufferHelper.putLong (this, index, value, order());
- return this;
- }
-
- public float getFloat ()
- {
- return ByteBufferHelper.getFloat (this, order());
- }
-
- public ByteBuffer putFloat (float value)
- {
- ByteBufferHelper.putFloat (this, value, order());
- return this;
- }
-
- public float getFloat (int index)
- {
- return ByteBufferHelper.getFloat (this, index, order());
- }
-
- public ByteBuffer putFloat (int index, float value)
- {
- ByteBufferHelper.putFloat (this, index, value, order());
- return this;
- }
-
- public double getDouble ()
- {
- return ByteBufferHelper.getDouble (this, order());
- }
-
- public ByteBuffer putDouble (double value)
- {
- ByteBufferHelper.putDouble (this, value, order());
- return this;
- }
-
- public double getDouble (int index)
- {
- return ByteBufferHelper.getDouble (this, index, order());
- }
-
- public ByteBuffer putDouble (int index, double value)
- {
- ByteBufferHelper.putDouble (this, index, value, order());
- return this;
- }
-}
diff --git a/libjava/java/nio/ByteOrder.java b/libjava/java/nio/ByteOrder.java
deleted file mode 100644
index 39a3ff8..0000000
--- a/libjava/java/nio/ByteOrder.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/* ByteOrder.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.4
- */
-public final class ByteOrder
-{
- /**
- * Constant indicating big endian byte order.
- */
- public static final ByteOrder BIG_ENDIAN = new ByteOrder();
-
- /**
- * Constant indicating little endian byte order.
- */
- public static final ByteOrder LITTLE_ENDIAN = new ByteOrder();
-
- /**
- * Returns the native byte order of the platform currently running.
- *
- * @return the native byte order
- */
- public static ByteOrder nativeOrder()
- {
- return (System.getProperty ("gnu.cpu.endian").equals("big")
- ? BIG_ENDIAN : LITTLE_ENDIAN);
- }
-
- /**
- * Returns a string representation of the byte order.
- *
- * @return the string
- */
- public String toString()
- {
- return this == BIG_ENDIAN ? "BIG_ENDIAN" : "LITTLE_ENDIAN";
- }
-
- // This class can only be instantiated here.
- private ByteOrder()
- {
- }
-}
diff --git a/libjava/java/nio/CharBuffer.java b/libjava/java/nio/CharBuffer.java
deleted file mode 100644
index 6551555..0000000
--- a/libjava/java/nio/CharBuffer.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/* CharBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class CharBuffer extends Buffer
- implements Comparable, CharSequence
-{
- int array_offset;
- char[] backing_buffer;
-
- CharBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- array_offset = 0;
- }
-
- /**
- * Allocates a new <code>CharBuffer</code> object with a given capacity.
- */
- public static CharBuffer allocate (int capacity)
- {
- return new CharBufferImpl (capacity);
- }
-
- /**
- * Wraps a <code>char</code> array into a <code>CharBuffer</code>
- * object.
- *
- * @param array the array to wrap
- * @param offset the offset of the region in the array to wrap
- * @param length the length of the region in the array to wrap
- *
- * @return a new <code>CharBuffer</code> object
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final CharBuffer wrap(char[] array, int offset, int length)
- {
- return new CharBufferImpl(array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a character sequence into a <code>CharBuffer</code> object.
- *
- * @param seq the sequence to wrap
- *
- * @return a new <code>CharBuffer</code> object
- */
- public static final CharBuffer wrap(CharSequence seq)
- {
- return wrap(seq, 0, seq.length());
- }
-
- /**
- * Wraps a character sequence into a <code>CharBuffer</code> object.
- *
- * @param seq the sequence to wrap
- * @param start the index of the first character to wrap
- * @param end the index of the first character not to wrap
- *
- * @return a new <code>CharBuffer</code> object
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final CharBuffer wrap(CharSequence seq, int start, int end)
- {
- // FIXME: implement better handling of java.lang.String.
- // Probably share data with String via reflection.
-
- if ((start < 0)
- || (start > seq.length())
- || (end < start)
- || (end > (seq.length() - start)))
- throw new IndexOutOfBoundsException();
-
- int len = end - start;
- char[] buffer = new char[len];
-
- for (int i = 0; i < len; i++)
- buffer[i] = seq.charAt(i + start);
-
- return wrap(buffer, 0, len).asReadOnlyBuffer();
- }
-
- /**
- * Wraps a <code>char</code> array into a <code>CharBuffer</code>
- * object.
- *
- * @param array the array to wrap
- *
- * @return a new <code>CharBuffer</code> object
- */
- public static final CharBuffer wrap(char[] array)
- {
- return wrap(array, 0, array.length);
- }
-
- /**
- * This method transfers <code>char</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>char</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>char</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>char</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public CharBuffer get (char[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>char</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>char</code>s remaining in this buffer.
- */
- public CharBuffer get (char[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>CharBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>char</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public CharBuffer put (CharBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining());
-
- if (src.remaining () > 0)
- {
- char[] toPut = new char [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>char array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>char</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public CharBuffer put (char[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>char array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>char</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final CharBuffer put (char[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>char</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>char</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final char[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with int arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data. Note that the hashcode is dependent
- * on buffer content, and therefore is not useful if the buffer
- * content may change.
- */
- public int hashCode ()
- {
- int hashCode = get(position()) + 31;
- int multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
- }
- return hashCode;
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof CharBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>CharBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>CharBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- CharBuffer other = (CharBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- char a = get(pos_this++);
- char b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public abstract ByteOrder order ();
-
- /**
- * Reads the <code>char</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>char</code>s in this buffer.
- */
- public abstract char get ();
-
- /**
- * Writes the <code>char</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>char</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract CharBuffer put (char b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract char get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract CharBuffer put (int index, char b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract CharBuffer compact ();
-
- /**
- * Tells wether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>CharBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract CharBuffer slice ();
-
- /**
- * Creates a new <code>CharBuffer</code> that shares this buffer's
- * content.
- */
- public abstract CharBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>CharBuffer</code> that shares this
- * buffer's content.
- */
- public abstract CharBuffer asReadOnlyBuffer ();
-
- /**
- * Returns the remaining content of the buffer as a string.
- */
- public String toString ()
- {
- if (hasArray ())
- return new String (array (), position (), length ());
-
- char[] buf = new char [length ()];
- int pos = position ();
- get (buf, 0, buf.length);
- position (pos);
- return new String (buf);
- }
-
- /**
- * Returns the length of the remaining chars in this buffer.
- */
- public final int length ()
- {
- return remaining ();
- }
-
- /**
- * Creates a new character buffer that represents the specified subsequence
- * of this buffer, relative to the current position.
- *
- * @exception IndexOutOfBoundsException If the preconditions on start and
- * end do not hold.
- */
- public abstract CharSequence subSequence (int start, int length);
-
- /**
- * Relative put method.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the start
- * and end parameters do not hold.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public CharBuffer put (String str, int start, int length)
- {
- return put (str.toCharArray (), start, length);
- }
-
- /**
- * Relative put method.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final CharBuffer put (String str)
- {
- return put (str.toCharArray (), 0, str.length ());
- }
-
- /**
- * Returns the character at <code>position() + index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative not smaller than
- * <code>remaining()</code>.
- */
- public final char charAt (int index)
- {
- if (index < 0
- || index >= remaining ())
- throw new IndexOutOfBoundsException ();
-
- return get (position () + index);
- }
-}
diff --git a/libjava/java/nio/CharBufferImpl.java b/libjava/java/nio/CharBufferImpl.java
deleted file mode 100644
index 33f8dab..0000000
--- a/libjava/java/nio/CharBufferImpl.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/* CharBufferImpl.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class CharBufferImpl extends CharBuffer
-{
- private boolean readOnly;
-
- CharBufferImpl (int capacity)
- {
- this (new char [capacity], 0, capacity, capacity, 0, -1, false);
- }
-
- CharBufferImpl (char[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public CharBufferImpl (CharBufferImpl copy)
- {
- super (copy.capacity (), copy.limit (), copy.position (), 0);
- backing_buffer = copy.backing_buffer;
- array_offset = copy.array_offset;
- readOnly = copy.isReadOnly ();
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public CharBuffer slice ()
- {
- return new CharBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public CharBuffer duplicate ()
- {
- return new CharBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public CharBuffer asReadOnlyBuffer ()
- {
- return new CharBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- public CharBuffer compact ()
- {
- checkIfReadOnly();
- mark = -1;
- int copied = 0;
-
- while (remaining () > 0)
- {
- put (copied, get ());
- copied++;
- }
-
- position (copied);
- limit(capacity());
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- public CharSequence subSequence (int start, int end)
- {
- if (start < 0
- || start > length ()
- || end < start
- || end > length ())
- throw new IndexOutOfBoundsException ();
-
- return new CharBufferImpl (backing_buffer, array_offset, capacity (), position () + end, position () + start, -1, isReadOnly ());
- }
-
- /**
- * Reads the <code>char</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>char</code>s in this buffer.
- */
- public char get ()
- {
- if (pos >= limit)
- throw new BufferUnderflowException();
-
- return backing_buffer [(pos++) + array_offset];
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public CharBuffer put (char value)
- {
- if (readOnly)
- throw new ReadOnlyBufferException();
- if (pos >= limit)
- throw new BufferOverflowException();
-
- backing_buffer [(pos++) + array_offset] = value;
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>char</code> at position
- * <code>index</code>.
- *
- * @param index Position to read the <code>char</code> from.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public char get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index + array_offset];
- }
-
- /**
- * Bulk get, overloaded for speed.
- */
- public CharBuffer get (char[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- System.arraycopy(backing_buffer, pos + array_offset,
- dst, offset, length);
- pos += length;
- return this;
- }
-
- /**
- * Bulk put, overloaded for speed.
- */
- public CharBuffer put (char[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- System.arraycopy(src, offset,
- backing_buffer, pos + array_offset, length);
- pos += length;
- return this;
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public CharBuffer put (int index, char value)
- {
- checkIndex(index);
- checkIfReadOnly();
-
- backing_buffer [index + array_offset] = value;
- return this;
- }
-
- public ByteOrder order ()
- {
- return ByteOrder.nativeOrder ();
- }
-}
diff --git a/libjava/java/nio/CharViewBufferImpl.java b/libjava/java/nio/CharViewBufferImpl.java
deleted file mode 100644
index 3198315..0000000
--- a/libjava/java/nio/CharViewBufferImpl.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/* CharViewBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-class CharViewBufferImpl extends CharBuffer
-{
- /** Position in bb (i.e. a byte offset) where this buffer starts. */
- private int offset;
- private ByteBuffer bb;
- private boolean readOnly;
- private ByteOrder endian;
-
- CharViewBufferImpl (ByteBuffer bb, int capacity)
- {
- super (capacity, capacity, 0, -1);
- this.bb = bb;
- this.offset = bb.position();
- this.readOnly = bb.isReadOnly();
- this.endian = bb.order();
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- public CharViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
- {
- super (capacity, limit, position, mark);
- this.bb = bb;
- this.offset = offset;
- this.readOnly = readOnly;
- this.endian = endian;
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- /**
- * Reads the <code>char</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>char</code>s in this buffer.
- */
- public char get ()
- {
- int p = position();
- char result = ByteBufferHelper.getChar(bb, (p << 1) + offset, endian);
- position(p + 1);
- return result;
- }
-
- /**
- * Absolute get method. Reads the <code>char</code> at position
- * <code>index</code>.
- *
- * @param index Position to read the <code>char</code> from.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public char get (int index)
- {
- return ByteBufferHelper.getChar(bb, (index << 1) + offset, endian);
- }
-
- public CharBuffer put (char value)
- {
- int p = position();
- ByteBufferHelper.putChar(bb, (p << 1) + offset, value, endian);
- position(p + 1);
- return this;
- }
-
- public CharBuffer put (int index, char value)
- {
- ByteBufferHelper.putChar(bb, (index << 1) + offset, value, endian);
- return this;
- }
-
- public CharBuffer compact ()
- {
- if (position () > 0)
- {
- int count = limit () - position ();
- bb.shiftDown(offset, offset + 2 * position(), 2 * count);
- position (count);
- limit (capacity ());
- }
- else
- {
- position(limit());
- limit(capacity());
- }
- return this;
- }
-
- public CharBuffer slice ()
- {
- // Create a sliced copy of this object that shares its content.
- return new CharViewBufferImpl (bb, (position () >> 1) + offset,
- remaining (), remaining (), 0, -1,
- isReadOnly (), endian);
- }
-
- CharBuffer duplicate (boolean readOnly)
- {
- int pos = position();
- reset();
- int mark = position();
- position(pos);
- return new CharViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
- }
-
- public CharBuffer duplicate ()
- {
- return duplicate(readOnly);
- }
-
- public CharBuffer asReadOnlyBuffer ()
- {
- return duplicate(true);
- }
-
- public CharSequence subSequence (int start, int end)
- {
- if (start < 0
- || end < start
- || end > length ())
- throw new IndexOutOfBoundsException ();
-
- return new CharViewBufferImpl (bb, array_offset, capacity (),
- position () + end, position () + start,
- -1, isReadOnly (), endian);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public boolean isDirect ()
- {
- return bb.isDirect ();
- }
-
- public ByteOrder order ()
- {
- return endian;
- }
-}
diff --git a/libjava/java/nio/DoubleBuffer.java b/libjava/java/nio/DoubleBuffer.java
deleted file mode 100644
index 381bb71..0000000
--- a/libjava/java/nio/DoubleBuffer.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/* DoubleBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class DoubleBuffer extends Buffer
- implements Comparable
-{
- int array_offset;
- double[] backing_buffer;
-
- DoubleBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- array_offset = 0;
- }
-
- /**
- * Allocates a new <code>DoubleBuffer</code> object with a given capacity.
- */
- public static DoubleBuffer allocate (int capacity)
- {
- return new DoubleBufferImpl (capacity);
- }
-
- /**
- * Wraps a <code>double</code> array into a <code>DoubleBuffer</code>
- * object.
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final DoubleBuffer wrap (double[] array, int offset, int length)
- {
- return new DoubleBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a <code>double</code> array into a <code>DoubleBuffer</code>
- * object.
- */
- public static final DoubleBuffer wrap (double[] array)
- {
- return wrap (array, 0, array.length);
- }
-
- /**
- * This method transfers <code>double</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>double</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>double</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>double</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public DoubleBuffer get (double[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>double</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>double</code>s remaining in this buffer.
- */
- public DoubleBuffer get (double[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>DoubleBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>double</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public DoubleBuffer put (DoubleBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining ());
-
- if (src.remaining () > 0)
- {
- double[] toPut = new double [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>double array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>double</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public DoubleBuffer put (double[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>double array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>double</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final DoubleBuffer put (double[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>double</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>double</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final double[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with <code>long</code> arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data, in Double.doubleToLongBits() form
- * Note that the hashcode is dependent on buffer content,
- * and therefore is not useful if the buffer content may change.
- *
- * @return the hash code (casted to int)
- */
- public int hashCode ()
- {
- long hashCode = Double.doubleToLongBits(get(position())) + 31;
- long multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (Double.doubleToLongBits(get(i)) + 30)*multiplier;
- }
- return ((int)hashCode);
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof DoubleBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>DoubleBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>DoubleBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- DoubleBuffer other = (DoubleBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- double a = get(pos_this++);
- double b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public abstract ByteOrder order ();
-
- /**
- * Reads the <code>double</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>double</code>s in this buffer.
- */
- public abstract double get ();
-
- /**
- * Writes the <code>double</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>double</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract DoubleBuffer put (double b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract double get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract DoubleBuffer put (int index, double b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract DoubleBuffer compact ();
-
- /**
- * Tells wether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>DoubleBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract DoubleBuffer slice ();
-
- /**
- * Creates a new <code>DoubleBuffer</code> that shares this buffer's
- * content.
- */
- public abstract DoubleBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>DoubleBuffer</code> that shares this
- * buffer's content.
- */
- public abstract DoubleBuffer asReadOnlyBuffer ();
-}
diff --git a/libjava/java/nio/DoubleBufferImpl.java b/libjava/java/nio/DoubleBufferImpl.java
deleted file mode 100644
index 248ab45e..0000000
--- a/libjava/java/nio/DoubleBufferImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* DoubleBufferImpl.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class DoubleBufferImpl extends DoubleBuffer
-{
- private boolean readOnly;
-
- DoubleBufferImpl (int capacity)
- {
- this (new double [capacity], 0, capacity, capacity, 0, -1, false);
- }
-
- DoubleBufferImpl (double[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public DoubleBuffer slice ()
- {
- return new DoubleBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public DoubleBuffer duplicate ()
- {
- return new DoubleBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public DoubleBuffer asReadOnlyBuffer ()
- {
- return new DoubleBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- public DoubleBuffer compact ()
- {
- checkIfReadOnly();
- mark = -1;
- int copied = 0;
-
- while (remaining () > 0)
- {
- put (copied, get ());
- copied++;
- }
-
- position (copied);
- limit(capacity());
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- /**
- * Reads the <code>double</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>double</code>s in this buffer.
- */
- public double get ()
- {
- checkForUnderflow();
-
- double result = backing_buffer [position ()];
- position (position () + 1);
- return result;
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception BufferOverflowException If there no remaining
- * space in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public DoubleBuffer put (double value)
- {
- checkIfReadOnly();
- checkForOverflow();
-
- backing_buffer [position ()] = value;
- position (position () + 1);
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>double</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public double get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index];
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public DoubleBuffer put (int index, double value)
- {
- checkIfReadOnly();
- checkIndex(index);
-
- backing_buffer [index] = value;
- return this;
- }
-
- public ByteOrder order ()
- {
- return ByteOrder.nativeOrder ();
- }
-}
diff --git a/libjava/java/nio/DoubleViewBufferImpl.java b/libjava/java/nio/DoubleViewBufferImpl.java
deleted file mode 100644
index e860f2f..0000000
--- a/libjava/java/nio/DoubleViewBufferImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* DoubleViewBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-final class DoubleViewBufferImpl extends DoubleBuffer
-{
- /** Position in bb (i.e. a byte offset) where this buffer starts. */
- private int offset;
- private ByteBuffer bb;
- private boolean readOnly;
- private ByteOrder endian;
-
- DoubleViewBufferImpl (ByteBuffer bb, int capacity)
- {
- super (capacity, capacity, 0, -1);
- this.bb = bb;
- this.offset = bb.position();
- this.readOnly = bb.isReadOnly();
- this.endian = bb.order();
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- public DoubleViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
- {
- super (capacity, limit, position, mark);
- this.bb = bb;
- this.offset = offset;
- this.readOnly = readOnly;
- this.endian = endian;
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- /**
- * Reads the <code>double</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>double</code>s in this buffer.
- */
- public double get ()
- {
- int p = position();
- double result = ByteBufferHelper.getDouble(bb, (p << 3) + offset, endian);
- position(p + 1);
- return result;
- }
-
- /**
- * Absolute get method. Reads the <code>double</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public double get (int index)
- {
- return ByteBufferHelper.getDouble(bb, (index << 3) + offset, endian);
- }
-
- public DoubleBuffer put (double value)
- {
- int p = position();
- ByteBufferHelper.putDouble(bb, (p << 3) + offset, value, endian);
- position(p + 1);
- return this;
- }
-
- public DoubleBuffer put (int index, double value)
- {
- ByteBufferHelper.putDouble(bb, (index << 3) + offset, value, endian);
- return this;
- }
-
- public DoubleBuffer compact ()
- {
- if (position () > 0)
- {
- int count = limit () - position ();
- bb.shiftDown(offset, offset + 8 * position(), 8 * count);
- position (count);
- limit (capacity ());
- }
- else
- {
- position(limit());
- limit(capacity());
- }
- return this;
- }
-
- public DoubleBuffer slice ()
- {
- return new DoubleViewBufferImpl (bb, (position () >> 3) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
- }
-
- DoubleBuffer duplicate (boolean readOnly)
- {
- int pos = position();
- reset();
- int mark = position();
- position(pos);
- return new DoubleViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
- }
-
- public DoubleBuffer duplicate ()
- {
- return duplicate(readOnly);
- }
-
- public DoubleBuffer asReadOnlyBuffer ()
- {
- return duplicate(true);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public boolean isDirect ()
- {
- return bb.isDirect ();
- }
-
- public ByteOrder order ()
- {
- return endian;
- }
-}
diff --git a/libjava/java/nio/FloatBuffer.java b/libjava/java/nio/FloatBuffer.java
deleted file mode 100644
index 8042333..0000000
--- a/libjava/java/nio/FloatBuffer.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/* FloatBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class FloatBuffer extends Buffer
- implements Comparable
-{
- int array_offset;
- float[] backing_buffer;
-
- FloatBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- array_offset = 0;
- }
-
- /**
- * Allocates a new <code>FloatBuffer</code> object with a given capacity.
- */
- public static FloatBuffer allocate (int capacity)
- {
- return new FloatBufferImpl (capacity);
- }
-
- /**
- * Wraps a <code>float</code> array into a <code>FloatBuffer</code>
- * object.
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final FloatBuffer wrap (float[] array, int offset, int length)
- {
- return new FloatBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a <code>float</code> array into a <code>FloatBuffer</code>
- * object.
- */
- public static final FloatBuffer wrap (float[] array)
- {
- return wrap (array, 0, array.length);
- }
-
- /**
- * This method transfers <code>float</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>float</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>float</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>float</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public FloatBuffer get (float[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>float</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>float</code>s remaining in this buffer.
- */
- public FloatBuffer get (float[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>FloatBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>float</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public FloatBuffer put (FloatBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining());
-
- if (src.remaining () > 0)
- {
- float[] toPut = new float [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>float array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>float</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public FloatBuffer put (float[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>float array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>float</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final FloatBuffer put (float[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>float</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>float</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final float[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with <code>int</code> arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data, in Float.floatToIntBits() form
- * Note that the hashcode is dependent on buffer content,
- * and therefore is not useful if the buffer content may change.
- *
- * @return the hash code
- */
- public int hashCode ()
- {
- int hashCode = Float.floatToIntBits(get(position())) + 31;
- int multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (Float.floatToIntBits(get(i)) + 30)*multiplier;
- }
- return hashCode;
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof FloatBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>FloatBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>FloatBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- FloatBuffer other = (FloatBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- float a = get(pos_this++);
- float b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public abstract ByteOrder order ();
-
- /**
- * Reads the <code>float</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>float</code>s in this buffer.
- */
- public abstract float get ();
-
- /**
- * Writes the <code>float</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>float</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract FloatBuffer put (float b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract float get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract FloatBuffer put (int index, float b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract FloatBuffer compact ();
-
- /**
- * Tells wether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>FloatBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract FloatBuffer slice ();
-
- /**
- * Creates a new <code>FloatBuffer</code> that shares this buffer's
- * content.
- */
- public abstract FloatBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>FloatBuffer</code> that shares this
- * buffer's content.
- */
- public abstract FloatBuffer asReadOnlyBuffer ();
-}
diff --git a/libjava/java/nio/FloatBufferImpl.java b/libjava/java/nio/FloatBufferImpl.java
deleted file mode 100644
index b486878..0000000
--- a/libjava/java/nio/FloatBufferImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* FloatBufferImpl.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class FloatBufferImpl extends FloatBuffer
-{
- private boolean readOnly;
-
- FloatBufferImpl (int capacity)
- {
- this (new float [capacity], 0, capacity, capacity, 0, -1, false);
- }
-
- FloatBufferImpl (float[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public FloatBuffer slice ()
- {
- return new FloatBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public FloatBuffer duplicate ()
- {
- return new FloatBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public FloatBuffer asReadOnlyBuffer ()
- {
- return new FloatBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- public FloatBuffer compact ()
- {
- checkIfReadOnly();
- mark = -1;
- int copied = 0;
-
- while (remaining () > 0)
- {
- put (copied, get ());
- copied++;
- }
-
- position (copied);
- limit(capacity());
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- /**
- * Reads the <code>float</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>floats</code> in this buffer.
- */
- public float get ()
- {
- checkForUnderflow();
-
- float result = backing_buffer [position ()];
- position (position () + 1);
- return result;
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception BufferOverflowException If there no remaining
- * space in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public FloatBuffer put (float value)
- {
- checkIfReadOnly();
- checkForOverflow();
-
- backing_buffer [position ()] = value;
- position (position () + 1);
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>float</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public float get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index];
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public FloatBuffer put (int index, float value)
- {
- checkIfReadOnly();
- checkIndex(index);
-
- backing_buffer [index] = value;
- return this;
- }
-
- public ByteOrder order ()
- {
- return ByteOrder.nativeOrder ();
- }
-}
diff --git a/libjava/java/nio/FloatViewBufferImpl.java b/libjava/java/nio/FloatViewBufferImpl.java
deleted file mode 100644
index 55770d5..0000000
--- a/libjava/java/nio/FloatViewBufferImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* FloatViewBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-final class FloatViewBufferImpl extends FloatBuffer
-{
- /** Position in bb (i.e. a byte offset) where this buffer starts. */
- private int offset;
- private ByteBuffer bb;
- private boolean readOnly;
- private ByteOrder endian;
-
- FloatViewBufferImpl (ByteBuffer bb, int capacity)
- {
- super (capacity, capacity, 0, -1);
- this.bb = bb;
- this.offset = bb.position();
- this.readOnly = bb.isReadOnly();
- this.endian = bb.order();
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- public FloatViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
- {
- super (capacity, limit, position, mark);
- this.bb = bb;
- this.offset = offset;
- this.readOnly = readOnly;
- this.endian = endian;
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- /**
- * Reads the <code>float</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>floats</code> in this buffer.
- */
- public float get ()
- {
- int p = position();
- float result = ByteBufferHelper.getFloat(bb, (p << 2) + offset, endian);
- position(p + 1);
- return result;
- }
-
- /**
- * Absolute get method. Reads the <code>float</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public float get (int index)
- {
- return ByteBufferHelper.getFloat(bb, (index << 2) + offset, endian);
- }
-
- public FloatBuffer put (float value)
- {
- int p = position();
- ByteBufferHelper.putFloat(bb, (p << 2) + offset, value, endian);
- position(p + 1);
- return this;
- }
-
- public FloatBuffer put (int index, float value)
- {
- ByteBufferHelper.putFloat(bb, (index << 2) + offset, value, endian);
- return this;
- }
-
- public FloatBuffer compact ()
- {
- if (position () > 0)
- {
- int count = limit () - position ();
- bb.shiftDown(offset, offset + 4 * position(), 4 * count);
- position (count);
- limit (capacity ());
- }
- else
- {
- position(limit());
- limit(capacity());
- }
- return this;
- }
-
- public FloatBuffer slice ()
- {
- // Create a sliced copy of this object that shares its content.
- return new FloatViewBufferImpl (bb, (position () >> 2) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
- }
-
- FloatBuffer duplicate (boolean readOnly)
- {
- int pos = position();
- reset();
- int mark = position();
- position(pos);
- return new FloatViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
- }
-
- public FloatBuffer duplicate ()
- {
- return duplicate(readOnly);
- }
-
- public FloatBuffer asReadOnlyBuffer ()
- {
- return duplicate(true);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public boolean isDirect ()
- {
- return bb.isDirect ();
- }
-
- public ByteOrder order ()
- {
- return endian;
- }
-}
diff --git a/libjava/java/nio/IntBuffer.java b/libjava/java/nio/IntBuffer.java
deleted file mode 100644
index 1e1fe9c..0000000
--- a/libjava/java/nio/IntBuffer.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/* IntBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class IntBuffer extends Buffer
- implements Comparable
-{
- int array_offset;
- int[] backing_buffer;
-
- IntBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- array_offset = 0;
- }
-
- /**
- * Allocates a new <code>IntBuffer</code> object with a given capacity.
- */
- public static IntBuffer allocate (int capacity)
- {
- return new IntBufferImpl (capacity);
- }
-
- /**
- * Wraps a <code>int</code> array into a <code>IntBuffer</code>
- * object.
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final IntBuffer wrap (int[] array, int offset, int length)
- {
- return new IntBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a <code>int</code> array into a <code>IntBuffer</code>
- * object.
- */
- public static final IntBuffer wrap (int[] array)
- {
- return wrap (array, 0, array.length);
- }
-
- /**
- * This method transfers <code>int</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>int</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>int</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>int</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public IntBuffer get (int[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>int</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>int</code>s remaining in this buffer.
- */
- public IntBuffer get (int[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>IntBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>int</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public IntBuffer put (IntBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining ());
-
- if (src.remaining () > 0)
- {
- int[] toPut = new int [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>int array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>int</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public IntBuffer put (int[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>int array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>int</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final IntBuffer put (int[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>int</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>int</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with <code>int</code> arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data. Note that the hashcode is dependent
- * on buffer content, and therefore is not useful if the buffer
- * content may change.
- *
- * @return the hash code
- */
- public int hashCode ()
- {
- int hashCode = get(position()) + 31;
- int multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
- }
- return hashCode;
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof IntBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>IntBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>IntBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- IntBuffer other = (IntBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- int a = get(pos_this++);
- int b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public abstract ByteOrder order ();
-
- /**
- * Reads the <code>int</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>int</code>s in this buffer.
- */
- public abstract int get ();
-
- /**
- * Writes the <code>int</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>int</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract IntBuffer put (int b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract int get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract IntBuffer put (int index, int b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract IntBuffer compact ();
-
- /**
- * Tells wether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>IntBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract IntBuffer slice ();
-
- /**
- * Creates a new <code>IntBuffer</code> that shares this buffer's
- * content.
- */
- public abstract IntBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>IntBuffer</code> that shares this
- * buffer's content.
- */
- public abstract IntBuffer asReadOnlyBuffer ();
-}
diff --git a/libjava/java/nio/IntBufferImpl.java b/libjava/java/nio/IntBufferImpl.java
deleted file mode 100644
index 2265748..0000000
--- a/libjava/java/nio/IntBufferImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* IntBufferImpl.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class IntBufferImpl extends IntBuffer
-{
- private boolean readOnly;
-
- IntBufferImpl (int capacity)
- {
- this (new int [capacity], 0, capacity, capacity, 0, -1, false);
- }
-
- IntBufferImpl (int[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public IntBuffer slice ()
- {
- return new IntBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public IntBuffer duplicate ()
- {
- return new IntBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public IntBuffer asReadOnlyBuffer ()
- {
- return new IntBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- public IntBuffer compact ()
- {
- checkIfReadOnly();
- mark = -1;
- int copied = 0;
-
- while (remaining () > 0)
- {
- put (copied, get ());
- copied++;
- }
-
- position (copied);
- limit(capacity());
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- /**
- * Reads the <code>int</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>ints</code> in this buffer.
- */
- public int get ()
- {
- checkForUnderflow();
-
- int result = backing_buffer [position ()];
- position (position () + 1);
- return result;
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception BufferOverflowException If there no remaining
- * space in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public IntBuffer put (int value)
- {
- checkIfReadOnly();
- checkForOverflow();
-
- backing_buffer [position ()] = value;
- position (position () + 1);
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>int</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public int get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index];
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public IntBuffer put (int index, int value)
- {
- checkIfReadOnly();
- checkIndex(index);
-
- backing_buffer [index] = value;
- return this;
- }
-
- public ByteOrder order ()
- {
- return ByteOrder.nativeOrder ();
- }
-}
diff --git a/libjava/java/nio/IntViewBufferImpl.java b/libjava/java/nio/IntViewBufferImpl.java
deleted file mode 100644
index d0b0057..0000000
--- a/libjava/java/nio/IntViewBufferImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* IntViewBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-final class IntViewBufferImpl extends IntBuffer
-{
- /** Position in bb (i.e. a byte offset) where this buffer starts. */
- private int offset;
- private ByteBuffer bb;
- private boolean readOnly;
- private ByteOrder endian;
-
- IntViewBufferImpl (ByteBuffer bb, int capacity)
- {
- super (capacity, capacity, 0, -1);
- this.bb = bb;
- this.offset = bb.position();
- this.readOnly = bb.isReadOnly();
- this.endian = bb.order();
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- public IntViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
- {
- super (capacity, limit, position, mark);
- this.bb = bb;
- this.offset = offset;
- this.readOnly = readOnly;
- this.endian = endian;
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- /**
- * Reads the <code>int</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>ints</code> in this buffer.
- */
- public int get ()
- {
- int p = position();
- int result = ByteBufferHelper.getInt(bb, (p << 2) + offset, endian);
- position(p + 1);
- return result;
- }
-
- /**
- * Absolute get method. Reads the <code>int</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public int get (int index)
- {
- return ByteBufferHelper.getInt(bb, (index << 2) + offset, endian);
- }
-
- public IntBuffer put (int value)
- {
- int p = position();
- ByteBufferHelper.putInt(bb, (p << 2) + offset, value, endian);
- position(p + 1);
- return this;
- }
-
- public IntBuffer put (int index, int value)
- {
- ByteBufferHelper.putInt(bb, (index << 2) + offset, value, endian);
- return this;
- }
-
- public IntBuffer compact ()
- {
- if (position () > 0)
- {
- int count = limit () - position ();
- bb.shiftDown(offset, offset + 4 * position(), 4 * count);
- position (count);
- limit (capacity ());
- }
- else
- {
- position(limit());
- limit(capacity());
- }
- return this;
- }
-
- public IntBuffer slice ()
- {
- // Create a sliced copy of this object that shares its content.
- return new IntViewBufferImpl (bb, (position () >> 2) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
- }
-
- IntBuffer duplicate (boolean readOnly)
- {
- int pos = position();
- reset();
- int mark = position();
- position(pos);
- return new IntViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
- }
-
- public IntBuffer duplicate ()
- {
- return duplicate(readOnly);
- }
-
- public IntBuffer asReadOnlyBuffer ()
- {
- return duplicate(true);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public boolean isDirect ()
- {
- return bb.isDirect ();
- }
-
- public ByteOrder order ()
- {
- return endian;
- }
-}
diff --git a/libjava/java/nio/InvalidMarkException.java b/libjava/java/nio/InvalidMarkException.java
deleted file mode 100644
index 937d417..0000000
--- a/libjava/java/nio/InvalidMarkException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* InvalidMarkException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio;
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class InvalidMarkException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public InvalidMarkException ()
- {
- }
-}
diff --git a/libjava/java/nio/LongBuffer.java b/libjava/java/nio/LongBuffer.java
deleted file mode 100644
index b3d3557..0000000
--- a/libjava/java/nio/LongBuffer.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/* LongBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class LongBuffer extends Buffer
- implements Comparable
-{
- int array_offset;
- long[] backing_buffer;
-
- LongBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- array_offset = 0;
- }
-
- /**
- * Allocates a new <code>LongBuffer</code> object with a given capacity.
- */
- public static LongBuffer allocate (int capacity)
- {
- return new LongBufferImpl (capacity);
- }
-
- /**
- * Wraps a <code>long</code> array into a <code>LongBuffer</code>
- * object.
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final LongBuffer wrap (long[] array, int offset, int length)
- {
- return new LongBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a <code>long</code> array into a <code>LongBuffer</code>
- * object.
- */
- public static final LongBuffer wrap (long[] array)
- {
- return wrap (array, 0, array.length);
- }
-
- /**
- * This method transfers <code>long</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>long</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>long</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>long</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public LongBuffer get (long[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>long</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>long</code>s remaining in this buffer.
- */
- public LongBuffer get (long[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>LongBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>long</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public LongBuffer put (LongBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining ());
-
- if (src.remaining () > 0)
- {
- long[] toPut = new long [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>long array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>long</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public LongBuffer put (long[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>long array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>long</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final LongBuffer put (long[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>long</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>long</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final long[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with <code>long</code> arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data. Note that the hashcode is dependent
- * on buffer content, and therefore is not useful if the buffer
- * content may change.
- *
- * @return the hash code (casted to int)
- */
- public int hashCode ()
- {
- long hashCode = get(position()) + 31;
- long multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
- }
- return ((int)hashCode);
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof LongBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>LongBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>LongBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- LongBuffer other = (LongBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- long a = get(pos_this++);
- long b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public abstract ByteOrder order ();
-
- /**
- * Reads the <code>long</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>long</code>s in this buffer.
- */
- public abstract long get ();
-
- /**
- * Writes the <code>long</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>long</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract LongBuffer put (long b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract long get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract LongBuffer put (int index, long b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract LongBuffer compact ();
-
- /**
- * Tells wether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>LongBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract LongBuffer slice ();
-
- /**
- * Creates a new <code>LongBuffer</code> that shares this buffer's
- * content.
- */
- public abstract LongBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>LongBuffer</code> that shares this
- * buffer's content.
- */
- public abstract LongBuffer asReadOnlyBuffer ();
-}
diff --git a/libjava/java/nio/LongBufferImpl.java b/libjava/java/nio/LongBufferImpl.java
deleted file mode 100644
index 8772f61..0000000
--- a/libjava/java/nio/LongBufferImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* LongBufferImpl.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class LongBufferImpl extends LongBuffer
-{
- private boolean readOnly;
-
- LongBufferImpl (int capacity)
- {
- this (new long [capacity], 0, capacity, capacity, 0, -1, false);
- }
-
- LongBufferImpl (long[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public LongBuffer slice ()
- {
- return new LongBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public LongBuffer duplicate ()
- {
- return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public LongBuffer asReadOnlyBuffer ()
- {
- return new LongBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- public LongBuffer compact ()
- {
- checkIfReadOnly();
- mark = -1;
- int copied = 0;
-
- while (remaining () > 0)
- {
- put (copied, get ());
- copied++;
- }
-
- position (copied);
- limit(capacity());
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- /**
- * Reads the <code>long</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>longs</code> in this buffer.
- */
- public long get ()
- {
- checkForUnderflow();
-
- long result = backing_buffer [position ()];
- position (position () + 1);
- return result;
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public LongBuffer put (long value)
- {
- checkIfReadOnly();
- checkForOverflow();
-
- backing_buffer [position ()] = value;
- position (position () + 1);
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>long</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public long get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index];
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public LongBuffer put (int index, long value)
- {
- checkIfReadOnly();
- checkIndex(index);
-
- backing_buffer [index] = value;
- return this;
- }
-
- public ByteOrder order ()
- {
- return ByteOrder.nativeOrder ();
- }
-}
diff --git a/libjava/java/nio/LongViewBufferImpl.java b/libjava/java/nio/LongViewBufferImpl.java
deleted file mode 100644
index 9c3452a..0000000
--- a/libjava/java/nio/LongViewBufferImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* LongViewBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-final class LongViewBufferImpl extends LongBuffer
-{
- /** Position in bb (i.e. a byte offset) where this buffer starts. */
- private int offset;
- private ByteBuffer bb;
- private boolean readOnly;
- private ByteOrder endian;
-
- LongViewBufferImpl (ByteBuffer bb, int capacity)
- {
- super (capacity, capacity, 0, -1);
- this.bb = bb;
- this.offset = bb.position();
- this.readOnly = bb.isReadOnly();
- this.endian = bb.order();
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- public LongViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
- {
- super (capacity, limit, position, mark);
- this.bb = bb;
- this.offset = offset;
- this.readOnly = readOnly;
- this.endian = endian;
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- /**
- * Reads the <code>long</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>longs</code> in this buffer.
- */
- public long get ()
- {
- int p = position();
- long result = ByteBufferHelper.getLong(bb, (p << 3) + offset, endian);
- position(p + 1);
- return result;
- }
-
- /**
- * Absolute get method. Reads the <code>long</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public long get (int index)
- {
- return ByteBufferHelper.getLong(bb, (index << 3) + offset, endian);
- }
-
- public LongBuffer put (long value)
- {
- int p = position();
- ByteBufferHelper.putLong(bb, (p << 3) + offset, value, endian);
- position(p + 1);
- return this;
- }
-
- public LongBuffer put (int index, long value)
- {
- ByteBufferHelper.putLong(bb, (index << 3) + offset, value, endian);
- return this;
- }
-
- public LongBuffer compact ()
- {
- if (position () > 0)
- {
- int count = limit () - position ();
- bb.shiftDown(offset, offset + 8 * position(), 8 * count);
- position (count);
- limit (capacity ());
- }
- else
- {
- position(limit());
- limit(capacity());
- }
- return this;
- }
-
- public LongBuffer slice ()
- {
- // Create a sliced copy of this object that shares its content.
- return new LongViewBufferImpl (bb, (position () >> 3) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
- }
-
- LongBuffer duplicate (boolean readOnly)
- {
- int pos = position();
- reset();
- int mark = position();
- position(pos);
- return new LongViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
- }
-
- public LongBuffer duplicate ()
- {
- return duplicate(readOnly);
- }
-
- public LongBuffer asReadOnlyBuffer ()
- {
- return duplicate(true);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public boolean isDirect ()
- {
- return bb.isDirect ();
- }
-
- public ByteOrder order ()
- {
- return endian;
- }
-}
diff --git a/libjava/java/nio/ReadOnlyBufferException.java b/libjava/java/nio/ReadOnlyBufferException.java
deleted file mode 100644
index d710e1b..0000000
--- a/libjava/java/nio/ReadOnlyBufferException.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* ReadOnlyBufferException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio;
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class ReadOnlyBufferException extends UnsupportedOperationException
-{
- /**
- * Creates the exception
- */
- public ReadOnlyBufferException ()
- {
- }
-}
diff --git a/libjava/java/nio/ShortBuffer.java b/libjava/java/nio/ShortBuffer.java
deleted file mode 100644
index 958fe8c..0000000
--- a/libjava/java/nio/ShortBuffer.java
+++ /dev/null
@@ -1,383 +0,0 @@
-/* ShortBuffer.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * @since 1.4
- */
-public abstract class ShortBuffer extends Buffer
- implements Comparable
-{
- int array_offset;
- short[] backing_buffer;
-
- ShortBuffer (int capacity, int limit, int position, int mark)
- {
- super (capacity, limit, position, mark);
- array_offset = 0;
- }
-
- /**
- * Allocates a new <code>ShortBuffer</code> object with a given capacity.
- */
- public static ShortBuffer allocate (int capacity)
- {
- return new ShortBufferImpl (capacity);
- }
-
- /**
- * Wraps a <code>short</code> array into a <code>ShortBuffer</code>
- * object.
- *
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- */
- public static final ShortBuffer wrap (short[] array, int offset, int length)
- {
- return new ShortBufferImpl (array, 0, array.length, offset + length, offset, -1, false);
- }
-
- /**
- * Wraps a <code>short</code> array into a <code>ShortBuffer</code>
- * object.
- */
- public static final ShortBuffer wrap (short[] array)
- {
- return wrap (array, 0, array.length);
- }
-
- /**
- * This method transfers <code>short</code>s from this buffer into the given
- * destination array. Before the transfer, it checks if there are fewer than
- * length <code>short</code>s remaining in this buffer.
- *
- * @param dst The destination array
- * @param offset The offset within the array of the first <code>short</code>
- * to be written; must be non-negative and no larger than dst.length.
- * @param length The maximum number of bytes to be written to the given array;
- * must be non-negative and no larger than dst.length - offset.
- *
- * @exception BufferUnderflowException If there are fewer than length
- * <code>short</code>s remaining in this buffer.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold.
- */
- public ShortBuffer get (short[] dst, int offset, int length)
- {
- checkArraySize(dst.length, offset, length);
- checkForUnderflow(length);
-
- for (int i = offset; i < offset + length; i++)
- {
- dst [i] = get ();
- }
-
- return this;
- }
-
- /**
- * This method transfers <code>short</code>s from this buffer into the given
- * destination array.
- *
- * @param dst The byte array to write into.
- *
- * @exception BufferUnderflowException If there are fewer than dst.length
- * <code>short</code>s remaining in this buffer.
- */
- public ShortBuffer get (short[] dst)
- {
- return get (dst, 0, dst.length);
- }
-
- /**
- * Writes the content of the the <code>ShortBUFFER</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * <code>src.remaining()</code> space remaining in this buffer.
- *
- * @param src The source data.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>short</code>s in the source buffer.
- * @exception IllegalArgumentException If the source buffer is this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ShortBuffer put (ShortBuffer src)
- {
- if (src == this)
- throw new IllegalArgumentException ();
-
- checkForOverflow(src.remaining ());
-
- if (src.remaining () > 0)
- {
- short[] toPut = new short [src.remaining ()];
- src.get (toPut);
- put (toPut);
- }
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>short array</code> src
- * into the buffer. Before the transfer, it checks if there is fewer than
- * length space remaining in this buffer.
- *
- * @param src The array to copy into the buffer.
- * @param offset The offset within the array of the first byte to be read;
- * must be non-negative and no larger than src.length.
- * @param length The number of bytes to be read from the given array;
- * must be non-negative and no larger than src.length - offset.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>short</code>s in the source array.
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ShortBuffer put (short[] src, int offset, int length)
- {
- checkArraySize(src.length, offset, length);
- checkForOverflow(length);
-
- for (int i = offset; i < offset + length; i++)
- put (src [i]);
-
- return this;
- }
-
- /**
- * Writes the content of the the <code>short array</code> src
- * into the buffer.
- *
- * @param src The array to copy into the buffer.
- *
- * @exception BufferOverflowException If there is insufficient space in this
- * buffer for the remaining <code>short</code>s in the source array.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public final ShortBuffer put (short[] src)
- {
- return put (src, 0, src.length);
- }
-
- /**
- * Tells whether ot not this buffer is backed by an accessible
- * <code>short</code> array.
- */
- public final boolean hasArray ()
- {
- return (backing_buffer != null
- && !isReadOnly ());
- }
-
- /**
- * Returns the <code>short</code> array that backs this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final short[] array ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return backing_buffer;
- }
-
- /**
- * Returns the offset within this buffer's backing array of the first element.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- * @exception UnsupportedOperationException If this buffer is not backed
- * by an accessible array.
- */
- public final int arrayOffset ()
- {
- if (backing_buffer == null)
- throw new UnsupportedOperationException ();
-
- checkIfReadOnly();
-
- return array_offset;
- }
-
- /**
- * Calculates a hash code for this buffer.
- *
- * This is done with <code>int</code> arithmetic,
- * where ** represents exponentiation, by this formula:<br>
- * <code>s[position()] + 31 + (s[position()+1] + 30)*31**1 + ... +
- * (s[limit()-1]+30)*31**(limit()-1)</code>.
- * Where s is the buffer data. Note that the hashcode is dependent
- * on buffer content, and therefore is not useful if the buffer
- * content may change.
- *
- * @return the hash code
- */
- public int hashCode ()
- {
- int hashCode = get(position()) + 31;
- int multiplier = 1;
- for (int i = position() + 1; i < limit(); ++i)
- {
- multiplier *= 31;
- hashCode += (get(i) + 30)*multiplier;
- }
- return hashCode;
- }
-
- /**
- * Checks if this buffer is equal to obj.
- */
- public boolean equals (Object obj)
- {
- if (obj instanceof ShortBuffer)
- {
- return compareTo (obj) == 0;
- }
-
- return false;
- }
-
- /**
- * Compares two <code>ShortBuffer</code> objects.
- *
- * @exception ClassCastException If obj is not an object derived from
- * <code>ShortBuffer</code>.
- */
- public int compareTo (Object obj)
- {
- ShortBuffer other = (ShortBuffer) obj;
-
- int num = Math.min(remaining(), other.remaining());
- int pos_this = position();
- int pos_other = other.position();
-
- for (int count = 0; count < num; count++)
- {
- short a = get(pos_this++);
- short b = other.get(pos_other++);
-
- if (a == b)
- continue;
-
- if (a < b)
- return -1;
-
- return 1;
- }
-
- return remaining() - other.remaining();
- }
-
- /**
- * Returns the byte order of this buffer.
- */
- public abstract ByteOrder order ();
-
- /**
- * Reads the <code>short</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>short</code>s in this buffer.
- */
- public abstract short get ();
-
- /**
- * Writes the <code>short</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferOverflowException If there no remaining
- * <code>short</code>s in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract ShortBuffer put (short b);
-
- /**
- * Absolute get method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public abstract short get (int index);
-
- /**
- * Absolute put method.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract ShortBuffer put (int index, short b);
-
- /**
- * Compacts this buffer.
- *
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public abstract ShortBuffer compact ();
-
- /**
- * Tells wether or not this buffer is direct.
- */
- public abstract boolean isDirect ();
-
- /**
- * Creates a new <code>ShortBuffer</code> whose content is a shared
- * subsequence of this buffer's content.
- */
- public abstract ShortBuffer slice ();
-
- /**
- * Creates a new <code>ShortBuffer</code> that shares this buffer's
- * content.
- */
- public abstract ShortBuffer duplicate ();
-
- /**
- * Creates a new read-only <code>ShortBuffer</code> that shares this
- * buffer's content.
- */
- public abstract ShortBuffer asReadOnlyBuffer ();
-}
diff --git a/libjava/java/nio/ShortBufferImpl.java b/libjava/java/nio/ShortBufferImpl.java
deleted file mode 100644
index ee5bff2..0000000
--- a/libjava/java/nio/ShortBufferImpl.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/* ShortBufferImpl.java --
- Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-/**
- * This is a Heap memory implementation
- */
-final class ShortBufferImpl extends ShortBuffer
-{
- private boolean readOnly;
-
- ShortBufferImpl (int capacity)
- {
- this (new short [capacity], 0, capacity, capacity, 0, -1, false);
- }
-
- ShortBufferImpl (short[] buffer, int offset, int capacity, int limit, int position, int mark, boolean readOnly)
- {
- super (capacity, limit, position, mark);
- this.backing_buffer = buffer;
- this.array_offset = offset;
- this.readOnly = readOnly;
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public ShortBuffer slice ()
- {
- return new ShortBufferImpl (backing_buffer, array_offset + position (), remaining (), remaining (), 0, -1, isReadOnly ());
- }
-
- public ShortBuffer duplicate ()
- {
- return new ShortBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, isReadOnly ());
- }
-
- public ShortBuffer asReadOnlyBuffer ()
- {
- return new ShortBufferImpl (backing_buffer, array_offset, capacity (), limit (), position (), mark, true);
- }
-
- public ShortBuffer compact ()
- {
- checkIfReadOnly();
- mark = -1;
- int copied = 0;
-
- while (remaining () > 0)
- {
- put (copied, get ());
- copied++;
- }
-
- position (copied);
- limit(capacity());
- return this;
- }
-
- public boolean isDirect ()
- {
- return false;
- }
-
- /**
- * Reads the <code>short</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>short</code>s in this buffer.
- */
- public short get ()
- {
- checkForUnderflow();
-
- short result = backing_buffer [position ()];
- position (position () + 1);
- return result;
- }
-
- /**
- * Relative put method. Writes <code>value</code> to the next position
- * in the buffer.
- *
- * @exception BufferOverflowException If there no remaining
- * space in this buffer.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ShortBuffer put (short value)
- {
- checkIfReadOnly();
- checkForOverflow();
-
- backing_buffer [position ()] = value;
- position (position () + 1);
- return this;
- }
-
- /**
- * Absolute get method. Reads the <code>short</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public short get (int index)
- {
- checkIndex(index);
-
- return backing_buffer [index];
- }
-
- /**
- * Absolute put method. Writes <code>value</code> to position
- * <code>index</code> in the buffer.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- * @exception ReadOnlyBufferException If this buffer is read-only.
- */
- public ShortBuffer put (int index, short value)
- {
- checkIfReadOnly();
- checkIndex(index);
-
- backing_buffer [index] = value;
- return this;
- }
-
- public ByteOrder order ()
- {
- return ByteOrder.nativeOrder ();
- }
-}
diff --git a/libjava/java/nio/ShortViewBufferImpl.java b/libjava/java/nio/ShortViewBufferImpl.java
deleted file mode 100644
index cdd5595..0000000
--- a/libjava/java/nio/ShortViewBufferImpl.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/* ShortViewBufferImpl.java --
- Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio;
-
-final class ShortViewBufferImpl extends ShortBuffer
-{
- /** Position in bb (i.e. a byte offset) where this buffer starts. */
- private int offset;
- private ByteBuffer bb;
- private boolean readOnly;
- private ByteOrder endian;
-
- ShortViewBufferImpl (ByteBuffer bb, int capacity)
- {
- super (capacity, capacity, 0, -1);
- this.bb = bb;
- this.offset = bb.position();
- this.readOnly = bb.isReadOnly();
- this.endian = bb.order();
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- public ShortViewBufferImpl (ByteBuffer bb, int offset, int capacity,
- int limit, int position, int mark,
- boolean readOnly, ByteOrder endian)
- {
- super (capacity, limit, position, mark);
- this.bb = bb;
- this.offset = offset;
- this.readOnly = readOnly;
- this.endian = endian;
- if (bb.isDirect())
- this.address = VMDirectByteBuffer.adjustAddress(bb.address, offset);
- }
-
- /**
- * Reads the <code>short</code> at this buffer's current position,
- * and then increments the position.
- *
- * @exception BufferUnderflowException If there are no remaining
- * <code>short</code>s in this buffer.
- */
- public short get ()
- {
- int p = position();
- short result = ByteBufferHelper.getShort(bb, (p << 1) + offset, endian);
- position(p + 1);
- return result;
- }
-
- /**
- * Absolute get method. Reads the <code>short</code> at position
- * <code>index</code>.
- *
- * @exception IndexOutOfBoundsException If index is negative or not smaller
- * than the buffer's limit.
- */
- public short get (int index)
- {
- return ByteBufferHelper.getShort(bb, (index << 1) + offset, endian);
- }
-
- public ShortBuffer put (short value)
- {
- int p = position();
- ByteBufferHelper.putShort(bb, (p << 1) + offset, value, endian);
- position(p + 1);
- return this;
- }
-
- public ShortBuffer put (int index, short value)
- {
- ByteBufferHelper.putShort(bb, (index << 1) + offset, value, endian);
- return this;
- }
-
- public ShortBuffer compact ()
- {
- if (position () > 0)
- {
- int count = limit () - position ();
- bb.shiftDown(offset, offset + 2 * position(), 2 * count);
- position (count);
- limit (capacity ());
- }
- else
- {
- position(limit());
- limit(capacity());
- }
- return this;
- }
-
- public ShortBuffer slice ()
- {
- // Create a sliced copy of this object that shares its content.
- return new ShortViewBufferImpl (bb, (position () >> 1) + offset,
- remaining(), remaining(), 0, -1,
- readOnly, endian);
- }
-
- ShortBuffer duplicate (boolean readOnly)
- {
- int pos = position();
- reset();
- int mark = position();
- position(pos);
- return new ShortViewBufferImpl (bb, offset, capacity(), limit(),
- pos, mark, readOnly, endian);
- }
-
- public ShortBuffer duplicate ()
- {
- return duplicate(readOnly);
- }
-
- public ShortBuffer asReadOnlyBuffer ()
- {
- return duplicate(true);
- }
-
- public boolean isReadOnly ()
- {
- return readOnly;
- }
-
- public boolean isDirect ()
- {
- return bb.isDirect ();
- }
-
- public ByteOrder order ()
- {
- return endian;
- }
-}
diff --git a/libjava/java/nio/channels/AlreadyConnectedException.java b/libjava/java/nio/channels/AlreadyConnectedException.java
deleted file mode 100644
index 133547e..0000000
--- a/libjava/java/nio/channels/AlreadyConnectedException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/* AlreadyConnectedException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-public class AlreadyConnectedException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public AlreadyConnectedException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/AsynchronousCloseException.java b/libjava/java/nio/channels/AsynchronousCloseException.java
deleted file mode 100644
index f45fdd8..0000000
--- a/libjava/java/nio/channels/AsynchronousCloseException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* AsynchronousCloseException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class AsynchronousCloseException extends ClosedChannelException
-{
- /**
- * Creates the exception
- */
- public AsynchronousCloseException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/ByteChannel.java b/libjava/java/nio/channels/ByteChannel.java
deleted file mode 100644
index d7d7a45..0000000
--- a/libjava/java/nio/channels/ByteChannel.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ByteChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-public interface ByteChannel extends ReadableByteChannel,
- WritableByteChannel
-{
-}
diff --git a/libjava/java/nio/channels/CancelledKeyException.java b/libjava/java/nio/channels/CancelledKeyException.java
deleted file mode 100644
index 02108f6..0000000
--- a/libjava/java/nio/channels/CancelledKeyException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* CancelledKeyException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class CancelledKeyException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public CancelledKeyException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/Channel.java b/libjava/java/nio/channels/Channel.java
deleted file mode 100644
index d488bd2..0000000
--- a/libjava/java/nio/channels/Channel.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Channel.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio.channels;
-
-import java.io.IOException;
-
-public interface Channel
-{
- /**
- * Tells whether this channel is open or not
- *
- * @return <code>true</code>if channel is open,
- * <code>false</code> otherwise
- */
- boolean isOpen();
-
- /**
- * Closes this channel
- *
- * @exception IOException If an error occurs
- */
- void close() throws IOException;
-}
diff --git a/libjava/java/nio/channels/ClosedByInterruptException.java b/libjava/java/nio/channels/ClosedByInterruptException.java
deleted file mode 100644
index 17858f6..0000000
--- a/libjava/java/nio/channels/ClosedByInterruptException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ClosedByInterruptException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class ClosedByInterruptException extends AsynchronousCloseException
-{
- /**
- * Creates the exception
- */
- public ClosedByInterruptException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/ClosedChannelException.java b/libjava/java/nio/channels/ClosedChannelException.java
deleted file mode 100644
index 0f8df9b..0000000
--- a/libjava/java/nio/channels/ClosedChannelException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* ClosedChannelException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class ClosedChannelException extends IOException
-{
- /**
- * Creates the exception
- */
- public ClosedChannelException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/ClosedSelectorException.java b/libjava/java/nio/channels/ClosedSelectorException.java
deleted file mode 100644
index e1b7a8c..0000000
--- a/libjava/java/nio/channels/ClosedSelectorException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ClosedSelectorException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class ClosedSelectorException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public ClosedSelectorException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/ConnectionPendingException.java b/libjava/java/nio/channels/ConnectionPendingException.java
deleted file mode 100644
index b0b7129..0000000
--- a/libjava/java/nio/channels/ConnectionPendingException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* ConnectionPendingException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class ConnectionPendingException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public ConnectionPendingException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/DatagramChannel.java b/libjava/java/nio/channels/DatagramChannel.java
deleted file mode 100644
index d257ff3..0000000
--- a/libjava/java/nio/channels/DatagramChannel.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/* DatagramChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.net.DatagramSocket;
-import java.net.SocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-
-/**
- * @since 1.4
- */
-public abstract class DatagramChannel extends AbstractSelectableChannel
- implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
-{
- /**
- * Initializes the channel.
- */
- protected DatagramChannel(SelectorProvider provider)
- {
- super(provider);
- }
-
- /**
- * Opens a datagram channel.
- *
- * @exception IOException If an error occurs
- */
- public static DatagramChannel open() throws IOException
- {
- return SelectorProvider.provider().openDatagramChannel();
- }
-
- /**
- * Reads data from this channel.
- */
- public final long read(ByteBuffer[] dsts) throws IOException
- {
- long b = 0;
-
- for (int i = 0; i < dsts.length; i++)
- b += read(dsts[i]);
-
- return b;
- }
-
- /**
- * Writes data to this channel.
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException The channel's socket is not connected.
- */
- public final long write(ByteBuffer[] srcs) throws IOException
- {
- long b = 0;
-
- for (int i = 0; i < srcs.length; i++)
- b += write(srcs[i]);
-
- return b;
- }
-
- /**
- * Connects this channel's socket.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the connect operation is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the read operation is in progress, thereby closing the
- * channel and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an error occurs.
- * @exception SecurityException If a security manager has been installed and
- * it does not permit datagrams to be sent to the given address.
- */
- public abstract DatagramChannel connect(SocketAddress remote)
- throws IOException;
-
- /**
- * Disonnects this channel's socket.
- *
- * @exception IOException If an error occurs
- */
- public abstract DatagramChannel disconnect() throws IOException;
-
- /**
- * Tells whether or not this channel's socket is connected.
- *
- * @exception IOException If an error occurs.
- * @exception NotYetConnectedException The channel's socket is not connected.
- */
- public abstract boolean isConnected();
-
- /**
- * Reads data from this channel.
- */
- public abstract int read(ByteBuffer dst) throws IOException;
-
- /**
- * Reads data from this channel.
- *
- * @exception IOException If an error occurs.
- * @exception NotYetConnectedException The channel's socket is not connected.
- */
- public abstract long read(ByteBuffer[] dsts, int offset, int length)
- throws IOException;
-
- /**
- * Receives a datagram via this channel.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the connect operation is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the read operation is in progress, thereby closing the
- * channel and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager has been installed and
- * it does not permit datagrams to be sent to the given address.
- */
- public abstract SocketAddress receive(ByteBuffer dst)
- throws IOException;
-
- /**
- * Sends a datagram via this channel.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the connect operation is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the read operation is in progress, thereby closing the
- * channel and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager has been installed and
- * it does not permit datagrams to be sent to the given address.
- */
- public abstract int send(ByteBuffer src, SocketAddress target)
- throws IOException;
-
- /**
- * Retrieves the channel's socket.
- */
- public abstract DatagramSocket socket();
-
- /**
- * Writes data to this channel.
- *
- * @exception IOException If an error occurs.
- * @exception NotYetConnectedException The channel's socket is not connected.
- */
- public abstract int write(ByteBuffer src) throws IOException;
-
- /**
- * Writes data to this channel.
- *
- * @exception IOException If an error occurs.
- * @exception NotYetConnectedException The channel's socket is not connected.
- */
- public abstract long write(ByteBuffer[] srcs, int offset, int length)
- throws IOException;
-
- /**
- * Retrieves the valid operations for this channel.
- *
- * @exception IOException If an error occurs.
- * @exception NotYetConnectedException The channel's socket is not connected.
- */
- public final int validOps()
- {
- return SelectionKey.OP_READ | SelectionKey.OP_WRITE;
- }
-}
diff --git a/libjava/java/nio/channels/FileChannel.java b/libjava/java/nio/channels/FileChannel.java
deleted file mode 100644
index 944ec0b..0000000
--- a/libjava/java/nio/channels/FileChannel.java
+++ /dev/null
@@ -1,367 +0,0 @@
-/* FileChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-import java.nio.MappedByteBuffer;
-import java.nio.channels.spi.AbstractInterruptibleChannel;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class FileChannel extends AbstractInterruptibleChannel
- implements ByteChannel, GatheringByteChannel, ScatteringByteChannel
-{
- public static class MapMode
- {
- int m;
- public static final MapMode READ_ONLY = new MapMode(0);
- public static final MapMode READ_WRITE = new MapMode(1);
- public static final MapMode PRIVATE = new MapMode(2);
-
- /**
- * Initializes the MapMode.
- */
- MapMode(int a)
- {
- m = a;
- }
-
- /**
- * Returns a string representation of the <code>MapMode</code> object.
- */
- public String toString()
- {
- if (this == READ_ONLY)
- return "READ_ONLY";
- else if (this == READ_WRITE)
- return "READ_WRITE";
-
- return "PRIVATE";
- }
- }
-
- /**
- * Initializes the channel.
- */
- protected FileChannel()
- {
- }
-
- /**
- * Maps the file into the memory.
- *
- * @exception IllegalArgumentException If the preconditions on the parameters
- * do not hold.
- * @exception IOException If an I/O error occurs.
- * @exception NonReadableChannelException If mode is READ_ONLY but this channel was
- * not opened for reading.
- * @exception NonWritableChannelException If mode is READ_WRITE or PRIVATE but this
- * channel was not opened for writing.
- */
- public abstract MappedByteBuffer map(MapMode mode, long position, long size)
- throws IOException;
-
- /**
- * Return the size of the file thus far
- *
- * @exception ClosedChannelException If this channel is closed.
- */
- public abstract long size() throws IOException;
-
- /**
- * Writes data to the channel.
- *
- * @exception IOException If an I/O error occurs.
- */
- public final long write(ByteBuffer[] srcs) throws IOException
- {
- long result = 0;
-
- for (int i = 0; i < srcs.length; i++)
- result += write(srcs[i]);
-
- return result;
- }
-
- /**
- * Writes data to the channel.
- *
- * @exception IOException If an I/O error occurs.
- */
- public abstract int write(ByteBuffer src) throws IOException;
-
- /**
- * Writes data to the channel.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the transfer is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the transfer is in progress, thereby closing both
- * channels and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If position is negative.
- * @exception IOException If an I/O error occurs.
- * @exception NonWritableChannelException If this channel was not opened for
- * writing.
- */
- public abstract int write(ByteBuffer srcs, long position)
- throws IOException;
-
- /**
- * Writes data to the channel.
- *
- * @exception IOException If an I/O error occurs.
- */
- public abstract long write(ByteBuffer[] srcs, int offset, int length)
- throws IOException;
-
- /**
- * Reads data from the channel.
- *
- * @exception IOException If an I/O error occurs.
- */
- public abstract long read(ByteBuffer[] dsts, int offset, int length)
- throws IOException;
-
- /**
- * Reads data from the channel.
- *
- * @exception IOException If an I/O error occurs.
- */
- public final long read(ByteBuffer[] dsts) throws IOException
- {
- long result = 0;
-
- for (int i = 0; i < dsts.length; i++)
- read(dsts[i]);
-
- return result;
- }
-
- /**
- * Reads data from the channel.
- *
- * @exception IOException If an I/O error occurs.
- */
- public abstract int read(ByteBuffer dst) throws IOException;
-
- /**
- * Reads data from the channel.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the transfer is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the transfer is in progress, thereby closing both
- * channels and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If position is negative.
- * @exception IOException If an I/O error occurs.
- * @exception NonReadableChannelException If this channel was not opened for
- * reading.
- */
- public abstract int read(ByteBuffer dst, long position)
- throws IOException;
-
- /**
- * Closes the channel.
- *
- * This is called from @see close.
- *
- * @exception IOException If an I/O error occurs.
- */
- protected abstract void implCloseChannel() throws IOException;
-
- /**
- * msync with the disk
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an I/O error occurs.
- */
- public abstract void force(boolean metaData) throws IOException;
-
- /**
- * Creates a file lock for the whole assoziated file.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the transfer is in progress.
- * @exception ClosedChannelException If this channel is closed.
- * @exception FileLockInterruptionException If the invoking thread is
- * interrupted while blocked in this method.
- * @exception IOException If an I/O error occurs.
- * @exception NonReadableChannelException If shared is true and this channel
- * was not opened for reading.
- * @exception NonWritableChannelException If shared is false and this channel
- * was not opened for writing.
- * @exception OverlappingFileLockException If a lock that overlaps the
- * requested region is already held by this Java virtual machine, or if
- * another thread is already blocked in this method and is attempting to lock
- * an overlapping region.
- */
- public final FileLock lock() throws IOException
- {
- return lock(0, Long.MAX_VALUE, false);
- }
-
- /**
- * Creates a file lock for a region of the assoziated file.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the transfer is in progress.
- * @exception ClosedChannelException If this channel is closed.
- * @exception FileLockInterruptionException If the invoking thread is
- * interrupted while blocked in this method.
- * @exception IllegalArgumentException If the preconditions on the parameters
- * do not hold.
- * @exception IOException If an I/O error occurs.
- * @exception OverlappingFileLockException If a lock that overlaps the
- * requested region is already held by this Java virtual machine, or if
- * another thread is already blocked in this method and is attempting to lock
- * an overlapping region.
- * @exception NonReadableChannelException If shared is true and this channel
- * was not opened for reading.
- * @exception NonWritableChannelException If shared is false and this channel
- * was not opened for writing.
- */
- public abstract FileLock lock(long position, long size, boolean shared)
- throws IOException;
-
- /**
- * Tries to aqquire alock on the whole assoziated file.
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an I/O error occurs.
- * @exception OverlappingFileLockException If a lock that overlaps the
- * requested region is already held by this Java virtual machine, or if
- * another thread is already blocked in this method and is attempting to lock
- * an overlapping region.
- */
- public final FileLock tryLock() throws IOException
- {
- return tryLock(0, Long.MAX_VALUE, false);
- }
-
- /**
- * Tries to aqquire a lock on a region of the assoziated file.
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If the preconditions on the parameters
- * do not hold.
- * @exception IOException If an I/O error occurs.
- * @exception OverlappingFileLockException If a lock that overlaps the
- * requested region is already held by this Java virtual machine, or if
- * another thread is already blocked in this method and is attempting to lock
- * an overlapping region.
- */
- public abstract FileLock tryLock(long position, long size, boolean shared)
- throws IOException;
-
- /**
- * Returns the current position on the file.
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an I/O error occurs.
- */
- public abstract long position() throws IOException;
-
- /**
- * Sets the position of the channel on the assoziated file.
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If newPosition is negative.
- * @exception IOException If an I/O error occurs.
- */
- public abstract FileChannel position(long newPosition)
- throws IOException;
-
- /**
- * Transfers bytes from this channel's file to the given writable byte
- * channel.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the transfer is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the transfer is in progress, thereby closing both
- * channels and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If the preconditions on the parameters
- * do not hold.
- * @exception IOException If an I/O error occurs.
- * @exception NonReadableChannelException If this channel was not opened for
- * reading.
- * @exception NonWritableChannelException If the target channel was not
- * opened for writing.
- */
- public abstract long transferTo(long position, long count,
- WritableByteChannel target)
- throws IOException;
-
- /**
- * Transfers bytes from the given readable channel into this channel.
- *
- * @exception AsynchronousCloseException If another thread closes this channel
- * while the transfer is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the transfer is in progress, thereby closing both
- * channels and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If the preconditions on the parameters
- * do not hold.
- * @exception IOException If an I/O error occurs.
- * @exception NonReadableChannelException If the source channel was not
- * opened for reading.
- * @exception NonWritableChannelException If this channel was not opened for
- * writing.
- */
- public abstract long transferFrom(ReadableByteChannel src, long position,
- long count) throws IOException;
-
- /**
- * Truncates the channel's file at <code>size</code>.
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If size is negative.
- * @exception IOException If an I/O error occurs.
- * @exception NonWritableChannelException If this channel was not opened for
- * writing.
- */
- public abstract FileChannel truncate(long size) throws IOException;
-}
diff --git a/libjava/java/nio/channels/FileLock.java b/libjava/java/nio/channels/FileLock.java
deleted file mode 100644
index 151c23f..0000000
--- a/libjava/java/nio/channels/FileLock.java
+++ /dev/null
@@ -1,150 +0,0 @@
-/* FileLock.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-
-
-/**
- * @since 1.4
- */
-public abstract class FileLock
-{
- FileChannel channel;
- long position;
- long size;
- boolean shared;
-
- /**
- * Initializes the file lock.
- *
- * @exception IllegalArgumentException If the preconditions on the parameters do not hold
- */
- protected FileLock(FileChannel channel, long position, long size,
- boolean shared)
- {
- if (position < 0 || size < 0)
- throw new IllegalArgumentException();
-
- this.channel = channel;
- this.position = position;
- this.size = size;
- this.shared = shared;
- }
-
- /**
- * Tells whether or not this lock is valid.
- */
- public abstract boolean isValid();
-
- /**
- * Releases this lock.
- *
- * @exception IOException If an error occurs
- * @exception ClosedChannelException If the locked channel is no longer open.
- */
- public abstract void release() throws IOException;
-
- /**
- * Returns the file channel upon whose file this lock is held.
- */
- public final FileChannel channel()
- {
- return channel;
- }
-
- /**
- * Tells whether this lock is shared.
- */
- public final boolean isShared()
- {
- return shared;
- }
-
- /**
- * Tells whether or not this lock overlaps the given lock range.
- */
- public final boolean overlaps(long position, long size)
- {
- if (position > this.position + this.size)
- return false;
-
- if (position + size < this.position)
- return false;
-
- return true;
- }
-
- /**
- * Returns the position within the file of the first byte of the
- * locked region.
- */
- public final long position()
- {
- return position;
- }
-
- /**
- * Returns the size of the locked region in bytes.
- */
- public final long size()
- {
- return size;
- }
-
- /**
- * Returns a string describing the range, type, and validity of this lock.
- */
- public final String toString()
- {
- StringBuffer buf = new StringBuffer(getClass().getName());
- buf.append("[");
- buf.append(position);
- buf.append(":");
- buf.append(size);
- if (shared)
- buf.append(" shared");
- else
- buf.append(" exclusive");
- if (isValid())
- buf.append(" valid]");
- else
- buf.append(" invalid]");
- return buf.toString();
- }
-}
diff --git a/libjava/java/nio/channels/FileLockInterruptionException.java b/libjava/java/nio/channels/FileLockInterruptionException.java
deleted file mode 100644
index 7d9e620..0000000
--- a/libjava/java/nio/channels/FileLockInterruptionException.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/* FileLockInterruptionException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class FileLockInterruptionException extends IOException
-{
- /**
- * Creates the exception
- */
- public FileLockInterruptionException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/GatheringByteChannel.java b/libjava/java/nio/channels/GatheringByteChannel.java
deleted file mode 100644
index 822ea23..0000000
--- a/libjava/java/nio/channels/GatheringByteChannel.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* GatheringByteChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-
-public interface GatheringByteChannel extends WritableByteChannel
-{
- /**
- * Writes a sequence of bytes to this channel from a subsequence of
- * the given buffers
- *
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the write operation is in progress
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the write operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status
- * @exception ClosedChannelException If this channel is closed
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception IOException If an error occurs
- * @exception NonWritableChannelException If this channel was not opened for
- * writing
- */
- long write(ByteBuffer[] srcs, int offset, int length)
- throws IOException;
-
- /**
- * Writes a sequence of bytes to this channel from the given buffers
- *
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the write operation is in progress
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the write operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status
- * @exception ClosedChannelException If this channel is closed
- * @exception IOException If an error occurs
- * @exception NonWritableChannelException If this channel was not opened for
- * writing
- */
- long write(ByteBuffer[] srcs) throws IOException;
-}
diff --git a/libjava/java/nio/channels/IllegalBlockingModeException.java b/libjava/java/nio/channels/IllegalBlockingModeException.java
deleted file mode 100644
index 7352b54..0000000
--- a/libjava/java/nio/channels/IllegalBlockingModeException.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/* IllegalBlockingModeException.java --
- Copyright (C) 2002, 2005 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.4
- *
- * Written using JDK 1.4.1 Online API from Sun
- * Status: JDK 1.4 complete
- */
-public class IllegalBlockingModeException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public IllegalBlockingModeException()
- {
- super();
- }
-}
diff --git a/libjava/java/nio/channels/IllegalSelectorException.java b/libjava/java/nio/channels/IllegalSelectorException.java
deleted file mode 100644
index 049a8d5..0000000
--- a/libjava/java/nio/channels/IllegalSelectorException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* IllegalSelectorException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class IllegalSelectorException extends IllegalArgumentException
-{
- /**
- * Creates the exception
- */
- public IllegalSelectorException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/InterruptibleChannel.java b/libjava/java/nio/channels/InterruptibleChannel.java
deleted file mode 100644
index 54122ce..0000000
--- a/libjava/java/nio/channels/InterruptibleChannel.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/* InterruptibleChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-
-
-public interface InterruptibleChannel extends Channel
-{
- /**
- * Closes this channel
- *
- * @exception IOException If an error occurs
- */
- void close() throws IOException;
-}
diff --git a/libjava/java/nio/channels/NoConnectionPendingException.java b/libjava/java/nio/channels/NoConnectionPendingException.java
deleted file mode 100644
index afefebf..0000000
--- a/libjava/java/nio/channels/NoConnectionPendingException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* NoConnectionPendingException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class NoConnectionPendingException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public NoConnectionPendingException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/NonReadableChannelException.java b/libjava/java/nio/channels/NonReadableChannelException.java
deleted file mode 100644
index e6852a7..0000000
--- a/libjava/java/nio/channels/NonReadableChannelException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* NonReadableChannelException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class NonReadableChannelException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public NonReadableChannelException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/NonWritableChannelException.java b/libjava/java/nio/channels/NonWritableChannelException.java
deleted file mode 100644
index 61d40bb..0000000
--- a/libjava/java/nio/channels/NonWritableChannelException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* NonWritableChannelException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class NonWritableChannelException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public NonWritableChannelException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/NotYetBoundException.java b/libjava/java/nio/channels/NotYetBoundException.java
deleted file mode 100644
index 7d0c663..0000000
--- a/libjava/java/nio/channels/NotYetBoundException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* NotYetBoundException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class NotYetBoundException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public NotYetBoundException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/NotYetConnectedException.java b/libjava/java/nio/channels/NotYetConnectedException.java
deleted file mode 100644
index 463e059..0000000
--- a/libjava/java/nio/channels/NotYetConnectedException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* NotYetConnectedException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class NotYetConnectedException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public NotYetConnectedException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/OverlappingFileLockException.java b/libjava/java/nio/channels/OverlappingFileLockException.java
deleted file mode 100644
index ce0900c..0000000
--- a/libjava/java/nio/channels/OverlappingFileLockException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* OverlappingFileLockException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class OverlappingFileLockException extends IllegalStateException
-{
- /**
- * Creates the exception
- */
- public OverlappingFileLockException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/Pipe.java b/libjava/java/nio/channels/Pipe.java
deleted file mode 100644
index c7b04c8..0000000
--- a/libjava/java/nio/channels/Pipe.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Pipe.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class Pipe
-{
- public abstract static class SinkChannel extends AbstractSelectableChannel
- implements WritableByteChannel, GatheringByteChannel
- {
- /**
- * Initializes the channel.
- */
- protected SinkChannel(SelectorProvider provider)
- {
- super(provider);
- }
-
- /**
- * Returns an operation set that is valid on this channel.
- *
- * The only valid operation on this channel is @see SelectionKey.OP_WRITE.
- */
- public final int validOps()
- {
- return SelectionKey.OP_WRITE;
- }
- }
-
- public abstract static class SourceChannel extends AbstractSelectableChannel
- implements ReadableByteChannel, ScatteringByteChannel
- {
- /**
- * Initializes the channel.
- */
- protected SourceChannel(SelectorProvider provider)
- {
- super(provider);
- }
-
- /**
- * Returns an operation set that is valid on this channel.
- *
- * The only valid operation on this channel is @see SelectionKey.OP_READ.
- */
- public final int validOps()
- {
- return SelectionKey.OP_READ;
- }
- }
-
- /**
- * Initializes the pipe.
- */
- protected Pipe()
- {
- }
-
- /**
- * Opens a pipe.
- *
- * @exception IOException If an error occurs
- */
- public static Pipe open() throws IOException
- {
- return SelectorProvider.provider().openPipe();
- }
-
- /**
- * Returns a pipe's sink channel.
- */
- public abstract Pipe.SinkChannel sink();
-
- /**
- * Returns a pipe's source channel
- */
- public abstract Pipe.SourceChannel source();
-}
diff --git a/libjava/java/nio/channels/ReadableByteChannel.java b/libjava/java/nio/channels/ReadableByteChannel.java
deleted file mode 100644
index 889662d..0000000
--- a/libjava/java/nio/channels/ReadableByteChannel.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/* ReadableByteChannel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-
-public interface ReadableByteChannel extends Channel
-{
- /**
- * Reads a sequence of bytes from this channel into the given buffer
- *
- * @param dst the buffer to put the read data into
- *
- * @return the numer of bytes read
- *
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the read operation is in progress
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the read operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status
- * @exception ClosedChannelException If this channel is closed
- * @exception IOException If an error occurs
- * @exception NonReadableChannelException If this channel was not opened for
- * reading
- */
- int read(ByteBuffer dst) throws IOException;
-}
diff --git a/libjava/java/nio/channels/ScatteringByteChannel.java b/libjava/java/nio/channels/ScatteringByteChannel.java
deleted file mode 100644
index 5437ea1..0000000
--- a/libjava/java/nio/channels/ScatteringByteChannel.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/* ScatteringByteChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-
-public interface ScatteringByteChannel extends ReadableByteChannel
-{
- /**
- * Reads a sequence of bytes from this channel into a subsequence of the
- * given buffers
- *
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the write operation is in progress
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the write operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status
- * @exception ClosedChannelException If this channel is closed
- * @exception IndexOutOfBoundsException If the preconditions on the offset
- * and length parameters do not hold
- * @exception IOException If an error occurs
- * @exception NonReadableChannelException If this channel was not opened for
- * reading
- */
- long read(ByteBuffer[] srcs, int offset, int length)
- throws IOException;
-
- /**
- * Reads a sequence of bytes from this channel into the given buffers
- *
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the write operation is in progress
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the write operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status
- * @exception ClosedChannelException If this channel is closed
- * @exception IOException If an error occurs
- * @exception NonReadableChannelException If this channel was not opened for
- * reading
- */
- long read(ByteBuffer[] srcs) throws IOException;
-}
diff --git a/libjava/java/nio/channels/SelectableChannel.java b/libjava/java/nio/channels/SelectableChannel.java
deleted file mode 100644
index 70fa785..0000000
--- a/libjava/java/nio/channels/SelectableChannel.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/* SelectableChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.channels.spi.AbstractInterruptibleChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class SelectableChannel extends AbstractInterruptibleChannel
-{
- /**
- * Initializes the channel.
- */
- protected SelectableChannel()
- {
- }
-
- /**
- * Returns the lock of this channel.
- */
- public abstract Object blockingLock();
-
- /**
- * Adjusts this channel's blocking mode.
- *
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalBlockingModeException If block is true and this channel
- * is registered with one or more selectors.
- * @exception IOException If an error occurs.
- */
- public abstract SelectableChannel configureBlocking(boolean block)
- throws IOException;
-
- /**
- * Tells whether this channel is blocking or not.
- */
- public abstract boolean isBlocking();
-
- /**
- * Tells whether or not this channel is currently registered with
- * any selectors.
- */
- public abstract boolean isRegistered();
-
- /**
- * Retrieves the key representing the channel's registration with
- * the given selector.
- */
- public abstract SelectionKey keyFor(Selector sel);
-
- /**
- * Returns the provider that created this channel.
- */
- public abstract SelectorProvider provider();
-
- /**
- * Registers this channel with the given selector,
- * returning a selection key.
- *
- * @exception CancelledKeyException If this channel is currently registered
- * with the given selector but the corresponding key has already been cancelled
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If a bit in ops does not correspond
- * to an operation that is supported by this channel, that is, if
- * set &amp; ~validOps() != 0.
- * @exception IllegalBlockingModeException If block is true and this channel
- * is registered with one or more selectors.
- * @exception IllegalSelectorException If this channel was not created by
- * the same provider as the given selector.
- */
- public final SelectionKey register(Selector sel, int ops)
- throws ClosedChannelException
- {
- return register(sel, ops, null);
- }
-
- /**
- * Registers this channel with the given selector,
- * returning a selection key.
- *
- * @exception CancelledKeyException If this channel is currently registered
- * with the given selector but the corresponding key has already been
- * cancelled.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IllegalArgumentException If a bit in ops does not correspond
- * to an operation that is supported by this channel, that is, if
- * set &amp; ~validOps() != 0.
- * @exception IllegalBlockingModeException If block is true and this channel
- * is registered with one or more selectors.
- * @exception IllegalSelectorException If this channel was not created by
- * the same provider as the given selector.
- */
- public abstract SelectionKey register(Selector sel, int ops, Object att)
- throws ClosedChannelException;
-
- /**
- * Returns a set of valid operations on this channel.
- */
- public abstract int validOps();
-}
diff --git a/libjava/java/nio/channels/SelectionKey.java b/libjava/java/nio/channels/SelectionKey.java
deleted file mode 100644
index 5219b6b..0000000
--- a/libjava/java/nio/channels/SelectionKey.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/* SelectionKey.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class SelectionKey
-{
- public static final int OP_ACCEPT = 16;
- public static final int OP_CONNECT = 8;
- public static final int OP_READ = 1;
- public static final int OP_WRITE = 4;
- Object attached;
-
- /**
- * Initializes the selection key.
- */
- protected SelectionKey()
- {
- }
-
- /**
- * Attaches obj to the key and returns the old attached object.
- */
- public final Object attach(Object obj)
- {
- Object old = attached;
- attached = obj;
- return old;
- }
-
- /**
- * Returns the object attached to the key.
- */
- public final Object attachment()
- {
- return attached;
- }
-
- /**
- * Tests if the channel attached to this key is ready to accept
- * a new socket connection.
- *
- * @exception CancelledKeyException If this key has been cancelled
- */
- public final boolean isAcceptable()
- {
- return (readyOps() & OP_ACCEPT) != 0;
- }
-
- /**
- * Tests whether this key's channel has either finished,
- * or failed to finish, its socket-connection operation.
- *
- * @exception CancelledKeyException If this key has been cancelled
- */
- public final boolean isConnectable()
- {
- return (readyOps() & OP_CONNECT) != 0;
- }
-
- /**
- * Tests if the channel attached to the key is readable.
- *
- * @exception CancelledKeyException If this key has been cancelled
- */
- public final boolean isReadable()
- {
- return (readyOps() & OP_READ) != 0;
- }
-
- /**
- * Tests if the channel attached to the key is writable.
- *
- * @exception CancelledKeyException If this key has been cancelled
- */
- public final boolean isWritable()
- {
- return (readyOps() & OP_WRITE) != 0;
- }
-
- /**
- * Requests that the registration of this key's channel with
- * its selector be cancelled.
- */
- public abstract void cancel();
-
- /**
- * return the channel attached to the key.
- */
- public abstract SelectableChannel channel();
-
- /**
- * Returns the key's interest set.
- *
- * @exception CancelledKeyException If this key has been cancelled
- */
- public abstract int interestOps();
-
- /**
- * Sets this key's interest set to the given value.
- *
- * @exception CancelledKeyException If this key has been cancelled
- * @exception IllegalArgumentException If a bit in the set does not
- * correspond to an operation that is supported by this key's channel,
- * that is, if set &amp; ~(channel().validOps()) != 0
- */
- public abstract SelectionKey interestOps(int ops);
-
- /**
- * Tells whether or not this key is valid.
- */
- public abstract boolean isValid();
-
- /**
- * Retrieves this key's ready-operation set.
- *
- * @exception CancelledKeyException If this key has been cancelled
- */
- public abstract int readyOps();
-
- /**
- * Returns the selector for which this key was created.
- */
- public abstract Selector selector();
-}
diff --git a/libjava/java/nio/channels/Selector.java b/libjava/java/nio/channels/Selector.java
deleted file mode 100644
index 2c883ef..0000000
--- a/libjava/java/nio/channels/Selector.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Selector.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.channels.spi.SelectorProvider;
-import java.util.Set;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class Selector
-{
- /**
- * Initializes the selector.
- */
- protected Selector()
- {
- }
-
- /**
- * Opens a selector.
- *
- * @exception IOException If an error occurs
- */
- public static Selector open() throws IOException
- {
- return SelectorProvider.provider().openSelector();
- }
-
- /**
- * Closes the selector.
- *
- * @exception IOException If an error occurs
- */
- public abstract void close() throws IOException;
-
- /**
- * Tells whether the selector is open or not.
- */
- public abstract boolean isOpen();
-
- /**
- * Returns this selector's key set.
- *
- * @exception ClosedSelectorException If this selector is closed.
- */
- public abstract Set keys();
-
- /**
- * Returns the SelectorProvider that created the selector.
- */
- public abstract SelectorProvider provider();
-
- /**
- * Selects a set of keys whose corresponding channels are ready
- * for I/O operations.
- *
- * @exception ClosedSelectorException If this selector is closed.
- * @exception IOException If an error occurs
- */
- public abstract int select() throws IOException;
-
- /**
- * Selects a set of keys whose corresponding channels are ready
- * for I/O operations.
- *
- * @param timeout The timeout to use.
- *
- * @exception ClosedSelectorException If this selector is closed.
- * @exception IllegalArgumentException If the timeout value is negative.
- * @exception IOException If an error occurs
- */
- public abstract int select(long timeout) throws IOException;
-
- /**
- * Returns this selector's selected-key set.
- *
- * @exception ClosedSelectorException If this selector is closed.
- */
- public abstract Set selectedKeys();
-
- /**
- * Selects a set of keys whose corresponding channels are ready
- * for I/O operations.
- *
- * @exception ClosedSelectorException If this selector is closed.
- * @exception IOException If an error occurs
- */
- public abstract int selectNow() throws IOException;
-
- /**
- * Causes the first selection operation that has not yet returned to
- * return immediately.
- */
- public abstract Selector wakeup();
-}
diff --git a/libjava/java/nio/channels/ServerSocketChannel.java b/libjava/java/nio/channels/ServerSocketChannel.java
deleted file mode 100644
index 105d17f..0000000
--- a/libjava/java/nio/channels/ServerSocketChannel.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/* ServerSocketChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.net.ServerSocket;
-import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class ServerSocketChannel extends AbstractSelectableChannel
-{
- /**
- * Initializes this channel.
- */
- protected ServerSocketChannel(SelectorProvider provider)
- {
- super(provider);
- }
-
- /**
- * Accepts a connection made to this channel's socket.
- *
- * @exception IOException If an error occurs
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the accept operation is in progress.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the accept operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status.
- * @exception ClosedChannelException If the channel is closed.
- * @exception NotYetBoundException If the channel's socket is not yet bound.
- * @exception SecurityException If a security manager has been installed and
- * it does not permit access to the remote endpoint of the new connection.
- */
- public abstract SocketChannel accept() throws IOException;
-
- /**
- * Retrieves the channels socket.
- */
- public abstract ServerSocket socket();
-
- /**
- * Opens a server socket channel.
- *
- * @exception IOException If an error occurs
- */
- public static ServerSocketChannel open() throws IOException
- {
- return SelectorProvider.provider().openServerSocketChannel();
- }
-
- /**
- * Retrieves the valid operations for this channel.
- */
- public final int validOps()
- {
- return SelectionKey.OP_ACCEPT;
- }
-}
diff --git a/libjava/java/nio/channels/SocketChannel.java b/libjava/java/nio/channels/SocketChannel.java
deleted file mode 100644
index 50f2136..0000000
--- a/libjava/java/nio/channels/SocketChannel.java
+++ /dev/null
@@ -1,248 +0,0 @@
-/* SocketChannel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.net.Socket;
-import java.net.SocketAddress;
-import java.nio.ByteBuffer;
-import java.nio.channels.spi.AbstractSelectableChannel;
-import java.nio.channels.spi.SelectorProvider;
-
-/**
- * @author Michael Koch (konqueror@gmx.de)
- * @since 1.4
- */
-public abstract class SocketChannel extends AbstractSelectableChannel
- implements ByteChannel, ScatteringByteChannel, GatheringByteChannel
-{
- /**
- * Initializes this socket channel.
- */
- protected SocketChannel(SelectorProvider provider)
- {
- super(provider);
- }
-
- /**
- * Opens a socket channel.
- *
- * @return the new <code>SocketChannel</code> object
- *
- * @exception IOException If an error occurs
- */
- public static SocketChannel open() throws IOException
- {
- return SelectorProvider.provider().openSocketChannel();
- }
-
- /**
- * Opens a channel and connects it to a remote address.
- *
- * @return the new <code>SocketChannel</code> object
- *
- * @exception AsynchronousCloseException If this channel is already connected.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the connect operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status.
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager has been installed and
- * it does not permit access to the given remote endpoint.
- * @exception UnresolvedAddressException If the given remote address is not
- * fully resolved.
- * @exception UnsupportedAddressTypeException If the type of the given remote
- * address is not supported.
- */
- public static SocketChannel open(SocketAddress remote)
- throws IOException
- {
- SocketChannel ch = open();
- ch.connect(remote);
- return ch;
- }
-
- /**
- * Reads data from the channel.
- *
- * @return the number of bytes read, zero is valid too, -1 if end of stream
- * is reached
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException If this channel is not yet connected.
- */
- public final long read(ByteBuffer[] dsts) throws IOException
- {
- long b = 0;
-
- for (int i = 0; i < dsts.length; i++)
- b += read(dsts[i]);
-
- return b;
- }
-
- /**
- * Writes data to the channel.
- *
- * @return the number of bytes written, zero is valid too
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException If this channel is not yet connected.
- */
- public final long write(ByteBuffer[] dsts) throws IOException
- {
- long b = 0;
-
- for (int i = 0; i < dsts.length; i++)
- b += write(dsts[i]);
-
- return b;
- }
-
- /**
- * Retrieves the valid operations for this channel.
- *
- * @return the valid operations
- */
- public final int validOps()
- {
- return SelectionKey.OP_CONNECT | SelectionKey.OP_READ
- | SelectionKey.OP_WRITE;
- }
-
- /**
- * Reads data from the channel.
- *
- * @return the number of bytes read, zero is valid too, -1 if end of stream
- * is reached
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException If this channel is not yet connected.
- */
- public abstract int read(ByteBuffer dst) throws IOException;
-
- /**
- * Connects the channel's socket to the remote address.
- *
- * @return <code>true</code> if the channel got successfully connected,
- * <code>false</code> if the channel is in non-blocking mode and connection
- * operation is still in progress.
- *
- * @exception AlreadyConnectedException If this channel is already connected.
- * @exception AsynchronousCloseException If this channel is already connected.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the connect operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception ConnectionPendingException If a non-blocking connection
- * operation is already in progress on this channel.
- * @exception IOException If an error occurs
- * @exception SecurityException If a security manager has been installed and
- * it does not permit access to the given remote endpoint.
- * @exception UnresolvedAddressException If the given remote address is not
- * fully resolved.
- * @exception UnsupportedAddressTypeException If the type of the given remote
- * address is not supported.
- */
- public abstract boolean connect(SocketAddress remote)
- throws IOException;
-
- /**
- * Finishes the process of connecting a socket channel.
- *
- * @exception AsynchronousCloseException If this channel is already connected.
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the connect operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status.
- * @exception ClosedChannelException If this channel is closed.
- * @exception IOException If an error occurs
- * @exception NoConnectionPendingException If this channel is not connected
- * and a connection operation has not been initiated.
- */
- public abstract boolean finishConnect() throws IOException;
-
- /**
- * Tells whether or not the channel's socket is connected.
- */
- public abstract boolean isConnected();
-
- /**
- * Tells whether or not a connection operation is in progress on this channel.
- */
- public abstract boolean isConnectionPending();
-
- /**
- * Reads data from the channel.
- *
- * @return the number of bytes read, zero is valid too, -1 if end of stream
- * is reached
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException If this channel is not yet connected.
- */
- public abstract long read(ByteBuffer[] dsts, int offset, int length)
- throws IOException;
-
- /**
- * Retrieves the channel's socket.
- *
- * @return the socket
- */
- public abstract Socket socket();
-
- /**
- * Writes data to the channel.
- *
- * @return the number of bytes written, zero is valid too
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException If this channel is not yet connected.
- */
- public abstract int write(ByteBuffer src) throws IOException;
-
- /**
- * Writes data to the channel.
- *
- * @return the number of bytes written, zero is valid too
- *
- * @exception IOException If an error occurs
- * @exception NotYetConnectedException If this channel is not yet connected.
- */
- public abstract long write(ByteBuffer[] srcs, int offset, int length)
- throws IOException;
-}
diff --git a/libjava/java/nio/channels/UnresolvedAddressException.java b/libjava/java/nio/channels/UnresolvedAddressException.java
deleted file mode 100644
index 4db95a7..0000000
--- a/libjava/java/nio/channels/UnresolvedAddressException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* UnresolvedAddressException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class UnresolvedAddressException extends IllegalArgumentException
-{
- /**
- * Creates the exception
- */
- public UnresolvedAddressException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/UnsupportedAddressTypeException.java b/libjava/java/nio/channels/UnsupportedAddressTypeException.java
deleted file mode 100644
index 7c16c81..0000000
--- a/libjava/java/nio/channels/UnsupportedAddressTypeException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* UnsupportedAddressTypeException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class UnsupportedAddressTypeException extends IllegalArgumentException
-{
- /**
- * Creates the exception
- */
- public UnsupportedAddressTypeException()
- {
- }
-}
diff --git a/libjava/java/nio/channels/WritableByteChannel.java b/libjava/java/nio/channels/WritableByteChannel.java
deleted file mode 100644
index 3845723..0000000
--- a/libjava/java/nio/channels/WritableByteChannel.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/* WritableByteChannel.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels;
-
-import java.io.IOException;
-import java.nio.ByteBuffer;
-
-
-public interface WritableByteChannel extends Channel
-{
- /**
- * Writes a sequence of bytes to this channel from the given buffer
- *
- * @exception AsynchronousCloseException If another thread closes this
- * channel while the write operation is in progress
- * @exception ClosedByInterruptException If another thread interrupts the
- * current thread while the write operation is in progress, thereby closing
- * the channel and setting the current thread's interrupt status
- * @exception ClosedChannelException If this channel is closed
- * @exception IOException If an error occurs
- * @exception NonWritableChannelException If this channel was not opened for
- * writing
- */
- int write(ByteBuffer src) throws IOException;
-}
diff --git a/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
deleted file mode 100644
index 25e8785..0000000
--- a/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/* AbstractInterruptibleChannel.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels.spi;
-
-import java.io.IOException;
-import java.nio.channels.AsynchronousCloseException;
-import java.nio.channels.Channel;
-import java.nio.channels.InterruptibleChannel;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class AbstractInterruptibleChannel
- implements Channel, InterruptibleChannel
-{
- private boolean closed;
-
- /**
- * Initializes the channel.
- */
- protected AbstractInterruptibleChannel()
- {
- }
-
- /**
- * Marks the beginning of an I/O operation that might block indefinitely.
- */
- protected final void begin()
- {
- }
-
- /**
- * Closes the channel.
- *
- * @exception IOException If an error occurs
- */
- public final void close() throws IOException
- {
- if (! closed)
- {
- closed = true;
- implCloseChannel();
- }
- }
-
- /**
- * Marks the end of an I/O operation that might block indefinitely.
- *
- * @param completed true if the task completed successfully,
- * false otherwise
- *
- * @exception IOException if an error occurs
- * @exception AsynchronousCloseException If the channel was asynchronously
- * closed.
- * @exception ClosedByInterruptException If the thread blocked in the
- * I/O operation was interrupted.
- */
- protected final void end(boolean completed)
- throws AsynchronousCloseException
- {
- // FIXME: check more here.
-
- if (closed) throw new AsynchronousCloseException();
- }
-
- /**
- * Closes the channel.
- *
- * @exception IOException If an error occurs
- */
- protected abstract void implCloseChannel() throws IOException;
-
- /**
- * Tells whether or not this channel is open.
- *
- * @return true if the channel is open, false otherwise
- */
- public final boolean isOpen()
- {
- return ! closed;
- }
-}
diff --git a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java b/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
deleted file mode 100644
index 42ceab7..0000000
--- a/libjava/java/nio/channels/spi/AbstractSelectableChannel.java
+++ /dev/null
@@ -1,256 +0,0 @@
-/* AbstractSelectableChannel.java
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-
-package java.nio.channels.spi;
-
-import java.io.IOException;
-import java.nio.channels.ClosedChannelException;
-import java.nio.channels.SelectableChannel;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.Selector;
-import java.util.LinkedList;
-import java.util.ListIterator;
-
-public abstract class AbstractSelectableChannel extends SelectableChannel
-{
- private boolean blocking = true;
- private Object LOCK = new Object();
- private SelectorProvider provider;
- private LinkedList keys = new LinkedList();
-
- /**
- * Initializes the channel
- *
- * @param provider the provider that created this channel
- */
- protected AbstractSelectableChannel(SelectorProvider provider)
- {
- this.provider = provider;
- }
-
- /**
- * Retrieves the object upon which the configureBlocking and register
- * methods synchronize.
- *
- * @return the blocking lock
- */
- public final Object blockingLock()
- {
- return LOCK;
- }
-
- /**
- * Adjusts this channel's blocking mode.
- *
- * @param blocking true if blocking should be enabled, false otherwise
- *
- * @return this channel
- *
- * @exception IOException If an error occurs
- */
- public final SelectableChannel configureBlocking(boolean blocking)
- throws IOException
- {
- synchronized (blockingLock())
- {
- if (this.blocking != blocking)
- {
- implConfigureBlocking(blocking);
- this.blocking = blocking;
- }
- }
-
- return this;
- }
-
- /**
- * Closes this channel.
- *
- * @exception IOException If an error occurs
- */
- protected final void implCloseChannel() throws IOException
- {
- implCloseSelectableChannel();
- }
-
- /**
- * Closes this selectable channel.
- *
- * @exception IOException If an error occurs
- */
- protected abstract void implCloseSelectableChannel()
- throws IOException;
-
- /**
- * Adjusts this channel's blocking mode.
- *
- * @param blocking true if blocking should be enabled, false otherwise
- *
- * @exception IOException If an error occurs
- */
- protected abstract void implConfigureBlocking(boolean blocking)
- throws IOException;
-
- /**
- * Tells whether or not every I/O operation on this channel will block
- * until it completes.
- *
- * @return true of this channel is blocking, false otherwise
- */
- public final boolean isBlocking()
- {
- return blocking;
- }
-
- /**
- * Tells whether or not this channel is currently registered with
- * any selectors.
- *
- * @return true if this channel is registered, false otherwise
- */
- public final boolean isRegistered()
- {
- return ! keys.isEmpty();
- }
-
- /**
- * Retrieves the key representing the channel's registration with the
- * given selector.
- *
- * @param selector the selector to get a selection key for
- *
- * @return the selection key this channel is registered with
- */
- public final SelectionKey keyFor(Selector selector)
- {
- if (! isOpen())
- return null;
-
- try
- {
- synchronized (blockingLock())
- {
- return locate(selector);
- }
- }
- catch (Exception e)
- {
- return null;
- }
- }
-
- /**
- * Returns the provider that created this channel.
- *
- * @return the selector provider that created this channel
- */
- public final SelectorProvider provider()
- {
- return provider;
- }
-
- private SelectionKey locate(Selector selector)
- {
- ListIterator it = keys.listIterator();
-
- while (it.hasNext())
- {
- SelectionKey key = (SelectionKey) it.next();
-
- if (key.selector() == selector)
- return key;
- }
-
- return null;
- }
-
- /**
- * Registers this channel with the given selector, returning a selection key.
- *
- * @param selin the seletor to use
- * @param ops the interested operations
- * @param att an attachment for the returned selection key
- *
- * @return the registered selection key
- *
- * @exception ClosedChannelException If the channel is already closed.
- */
- public final SelectionKey register(Selector selin, int ops, Object att)
- throws ClosedChannelException
- {
- if (! isOpen())
- throw new ClosedChannelException();
-
- if ((ops & ~validOps()) != 0)
- throw new IllegalArgumentException();
-
- SelectionKey key = null;
- AbstractSelector selector = (AbstractSelector) selin;
-
- synchronized (blockingLock())
- {
- key = locate(selector);
-
- if (key != null && key.isValid())
- {
- if (att != null)
- key.attach(att);
- }
- else
- {
- key = selector.register(this, ops, att);
-
- if (key != null)
- addSelectionKey(key);
- }
- }
-
- return key;
- }
-
- void addSelectionKey(SelectionKey key)
- {
- keys.add(key);
- }
-
- // This method gets called by AbstractSelector.deregister().
- void removeSelectionKey(SelectionKey key)
- {
- keys.remove(key);
- }
-}
diff --git a/libjava/java/nio/channels/spi/AbstractSelectionKey.java b/libjava/java/nio/channels/spi/AbstractSelectionKey.java
deleted file mode 100644
index 5ab8468..0000000
--- a/libjava/java/nio/channels/spi/AbstractSelectionKey.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/* AbstractSelectionKey.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels.spi;
-
-import java.nio.channels.SelectionKey;
-
-
-/**
- * @since 1.4
- */
-public abstract class AbstractSelectionKey extends SelectionKey
-{
- private boolean cancelled;
-
- /**
- * Initializes the key.
- */
- protected AbstractSelectionKey()
- {
- }
-
- /**
- * Cancels this key.
- */
- public final void cancel()
- {
- if (isValid())
- {
- ((AbstractSelector) selector()).cancelKey(this);
- cancelled = true;
- }
- }
-
- /**
- * Tells whether this key is valid or not.
- *
- * @return true if this key is valid, false otherwise
- */
- public final boolean isValid()
- {
- return ! cancelled;
- }
-}
diff --git a/libjava/java/nio/channels/spi/AbstractSelector.java b/libjava/java/nio/channels/spi/AbstractSelector.java
deleted file mode 100644
index 7838073..0000000
--- a/libjava/java/nio/channels/spi/AbstractSelector.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/* AbstractSelector.java --
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels.spi;
-
-import java.io.IOException;
-import java.nio.channels.ClosedSelectorException;
-import java.nio.channels.SelectionKey;
-import java.nio.channels.Selector;
-import java.util.HashSet;
-import java.util.Set;
-
-
-public abstract class AbstractSelector extends Selector
-{
- private boolean closed;
- private SelectorProvider provider;
- private HashSet cancelledKeys;
-
- /**
- * Initializes the slector.
- *
- * @param provider the provider that created this selector
- */
- protected AbstractSelector(SelectorProvider provider)
- {
- this.provider = provider;
- this.cancelledKeys = new HashSet();
- }
-
- /**
- * Closes the channel.
- *
- * @exception IOException If an error occurs
- */
- public final synchronized void close() throws IOException
- {
- if (closed)
- return;
-
- implCloseSelector();
- closed = true;
- }
-
- /**
- * Tells whether this channel is open or not.
- *
- * @return true if channel is open, false otherwise.
- */
- public final boolean isOpen()
- {
- return ! closed;
- }
-
- /**
- * Marks the beginning of an I/O operation that might block indefinitely.
- */
- protected final void begin()
- {
- }
-
- /**
- * Marks the end of an I/O operation that might block indefinitely.
- */
- protected final void end()
- {
- }
-
- /**
- * Returns the provider for this selector object.
- *
- * @return the SelectorProvider object that created this seletor
- */
- public final SelectorProvider provider()
- {
- return provider;
- }
-
- /**
- * Returns the cancelled keys set.
- *
- * @return the cancelled keys set
- */
- protected final Set cancelledKeys()
- {
- if (! isOpen())
- throw new ClosedSelectorException();
-
- return cancelledKeys;
- }
-
- /**
- * Cancels a selection key.
- */
-
- // This method is only called by AbstractSelectionKey.cancel().
- final void cancelKey(AbstractSelectionKey key)
- {
- synchronized (cancelledKeys)
- {
- cancelledKeys.add(key);
- }
- }
-
- /**
- * Closes the channel.
- *
- * @exception IOException if an error occurs
- */
- protected abstract void implCloseSelector() throws IOException;
-
- /**
- * Registers a channel for the selection process.
- *
- * @param ch the channel register
- * @param ops the interested operations
- * @param att an attachement to the selection key
- *
- * @return the registered selection key
- */
- protected abstract SelectionKey register(AbstractSelectableChannel ch,
- int ops, Object att);
-
- /**
- * Deregisters the given selection key.
- *
- * @param key the key to deregister
- */
- protected final void deregister(AbstractSelectionKey key)
- {
- ((AbstractSelectableChannel) key.channel()).removeSelectionKey(key);
- }
-}
diff --git a/libjava/java/nio/channels/spi/SelectorProvider.java b/libjava/java/nio/channels/spi/SelectorProvider.java
deleted file mode 100644
index db4e65f..0000000
--- a/libjava/java/nio/channels/spi/SelectorProvider.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/* SelectorProvider.java
- Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.channels.spi;
-
-import gnu.java.nio.SelectorProviderImpl;
-
-import java.io.IOException;
-import java.nio.channels.DatagramChannel;
-import java.nio.channels.Pipe;
-import java.nio.channels.ServerSocketChannel;
-import java.nio.channels.SocketChannel;
-
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public abstract class SelectorProvider
-{
- private static SelectorProvider systemDefaultProvider;
-
- /**
- * Initializes the selector provider.
- *
- * @exception SecurityException If a security manager has been installed and
- * it denies @see RuntimePermission ("selectorProvider").
- */
- protected SelectorProvider()
- {
- SecurityManager sm = System.getSecurityManager();
- if (sm != null)
- sm.checkPermission(new RuntimePermission("selectorProvider"));
- }
-
- /**
- * Opens a datagram channel.
- *
- * @return a new datagram channel object
- *
- * @exception IOException if an error occurs
- */
- public abstract DatagramChannel openDatagramChannel()
- throws IOException;
-
- /**
- * Opens a pipe.
- *
- * @return a new pipe object
- *
- * @exception IOException if an error occurs
- */
- public abstract Pipe openPipe() throws IOException;
-
- /**
- * Opens a selector.
- *
- * @return a new selector object
- *
- * @exception IOException if an error occurs
- */
- public abstract AbstractSelector openSelector() throws IOException;
-
- /**
- * Opens a server socket channel.
- *
- * @return a new server socket channel object
- *
- * @exception IOException if an error occurs
- */
- public abstract ServerSocketChannel openServerSocketChannel()
- throws IOException;
-
- /**
- * Opens a socket channel.
- *
- * @return a new socket channel object
- *
- * @exception IOException if an error occurs
- */
- public abstract SocketChannel openSocketChannel() throws IOException;
-
- /**
- * Returns the system-wide default selector provider for this invocation
- * of the Java virtual machine.
- *
- * @return the default seletor provider
- */
- public static synchronized SelectorProvider provider()
- {
- if (systemDefaultProvider == null)
- {
- String propertyValue =
- System.getProperty("java.nio.channels.spi.SelectorProvider");
-
- if (propertyValue == null || propertyValue.equals(""))
- systemDefaultProvider = new SelectorProviderImpl();
- else
- {
- try
- {
- systemDefaultProvider =
- (SelectorProvider) Class.forName(propertyValue)
- .newInstance();
- }
- catch (Exception e)
- {
- System.err.println("Could not instantiate class: "
- + propertyValue);
- systemDefaultProvider = new SelectorProviderImpl();
- }
- }
- }
-
- return systemDefaultProvider;
- }
-}
diff --git a/libjava/java/nio/charset/CharacterCodingException.java b/libjava/java/nio/charset/CharacterCodingException.java
deleted file mode 100644
index 6812ebb..0000000
--- a/libjava/java/nio/charset/CharacterCodingException.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/* CharacterCodingException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-import java.io.IOException;
-
-/**
- * @since 1.4
- */
-public class CharacterCodingException extends IOException
-{
- /**
- * Creates the exception
- */
- public CharacterCodingException()
- {
- }
-}
diff --git a/libjava/java/nio/charset/CharsetDecoder.java b/libjava/java/nio/charset/CharsetDecoder.java
deleted file mode 100644
index 0203c88..0000000
--- a/libjava/java/nio/charset/CharsetDecoder.java
+++ /dev/null
@@ -1,313 +0,0 @@
-/* CharsetDecoder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-
-/**
- * @author Jesse Rosenstock
- * @since 1.4
- */
-public abstract class CharsetDecoder
-{
- private static final int STATE_RESET = 0;
- private static final int STATE_CODING = 1;
- private static final int STATE_END = 2;
- private static final int STATE_FLUSHED = 3;
-
- private static final String DEFAULT_REPLACEMENT = "\uFFFD";
-
- private final Charset charset;
- private final float averageCharsPerByte;
- private final float maxCharsPerByte;
- private String replacement;
-
- private int state = STATE_RESET;
-
- private CodingErrorAction malformedInputAction
- = CodingErrorAction.REPORT;
- private CodingErrorAction unmappableCharacterAction
- = CodingErrorAction.REPORT;
-
- private CharsetDecoder (Charset cs, float averageCharsPerByte,
- float maxCharsPerByte, String replacement)
- {
- if (averageCharsPerByte <= 0.0f)
- throw new IllegalArgumentException ("Non-positive averageCharsPerByte");
- if (maxCharsPerByte <= 0.0f)
- throw new IllegalArgumentException ("Non-positive maxCharsPerByte");
-
- this.charset = cs;
- this.averageCharsPerByte
- = averageCharsPerByte;
- this.maxCharsPerByte
- = maxCharsPerByte;
- this.replacement = replacement;
- implReplaceWith (replacement);
- }
-
- protected CharsetDecoder (Charset cs, float averageCharsPerByte,
- float maxCharsPerByte)
- {
- this (cs, averageCharsPerByte, maxCharsPerByte, DEFAULT_REPLACEMENT);
- }
-
- public final float averageCharsPerByte ()
- {
- return averageCharsPerByte;
- }
-
- public final Charset charset ()
- {
- return charset;
- }
-
- public final CharBuffer decode (ByteBuffer in)
- throws CharacterCodingException
- {
- // XXX: Sun's Javadoc seems to contradict itself saying an
- // IllegalStateException is thrown "if a decoding operation is already
- // in progress" and also that "it resets this Decoder".
- // Should we check to see that the state is reset, or should we
- // call reset()?
- if (state != STATE_RESET)
- throw new IllegalStateException ();
-
- // REVIEW: Using max instead of average may allocate a very large
- // buffer. Maybe we should do something more efficient?
- int remaining = in.remaining ();
- int n = (int) (remaining * maxCharsPerByte ());
- CharBuffer out = CharBuffer.allocate (n);
-
- if (remaining == 0)
- {
- state = STATE_FLUSHED;
- return out;
- }
-
- CoderResult cr = decode (in, out, true);
- if (cr.isError ())
- cr.throwException ();
-
- cr = flush (out);
- if (cr.isError ())
- cr.throwException ();
-
- reset();
- out.flip ();
- return out;
- }
-
- public final CoderResult decode (ByteBuffer in, CharBuffer out,
- boolean endOfInput)
- {
- int newState = endOfInput ? STATE_END : STATE_CODING;
- // XXX: Need to check for "previous step was an invocation [not] of
- // this method with a value of true for the endOfInput parameter but
- // a return value indicating an incomplete decoding operation"
- // XXX: We will not check the previous return value, just
- // that the previous call passed true for endOfInput
- if (state != STATE_RESET && state != STATE_CODING
- && !(endOfInput && state == STATE_END))
- throw new IllegalStateException ();
- state = newState;
-
- for (;;)
- {
- CoderResult cr;
- try
- {
- cr = decodeLoop (in, out);
- }
- catch (RuntimeException e)
- {
- throw new CoderMalfunctionError (e);
- }
-
- if (cr.isOverflow ())
- return cr;
-
- if (cr.isUnderflow ())
- {
- if (endOfInput && in.hasRemaining ())
- cr = CoderResult.malformedForLength (in.remaining ());
- else
- return cr;
- }
-
- CodingErrorAction action = cr.isMalformed ()
- ? malformedInputAction
- : unmappableCharacterAction;
-
- if (action == CodingErrorAction.REPORT)
- return cr;
-
- if (action == CodingErrorAction.REPLACE)
- {
- if (out.remaining () < replacement.length ())
- return CoderResult.OVERFLOW;
- out.put (replacement);
- }
-
- in.position (in.position () + cr.length ());
- }
- }
-
- protected abstract CoderResult decodeLoop (ByteBuffer in, CharBuffer out);
-
- public Charset detectedCharset ()
- {
- throw new UnsupportedOperationException ();
- }
-
- public final CoderResult flush (CharBuffer out)
- {
- // It seems weird that you can flush after reset, but Sun's javadoc
- // says an IllegalStateException is thrown "If the previous step of the
- // current decoding operation was an invocation neither of the reset
- // method nor ... of the three-argument decode method with a value of
- // true for the endOfInput parameter."
- // Further note that flush() only requires that there not be
- // an IllegalStateException if the previous step was a call to
- // decode with true as the last argument. It does not require
- // that the call succeeded. decode() does require that it succeeded.
- // XXX: test this to see if reality matches javadoc
- if (state != STATE_RESET && state != STATE_END)
- throw new IllegalStateException ();
-
- state = STATE_FLUSHED;
- return implFlush (out);
- }
-
- protected CoderResult implFlush (CharBuffer out)
- {
- return CoderResult.UNDERFLOW;
- }
-
- public final CharsetDecoder onMalformedInput (CodingErrorAction newAction)
- {
- if (newAction == null)
- throw new IllegalArgumentException ("Null action");
-
- malformedInputAction = newAction;
- implOnMalformedInput (newAction);
- return this;
- }
-
- protected void implOnMalformedInput (CodingErrorAction newAction)
- {
- // default implementation does nothing
- }
-
- protected void implOnUnmappableCharacter (CodingErrorAction newAction)
- {
- // default implementation does nothing
- }
-
- protected void implReplaceWith (String newReplacement)
- {
- // default implementation does nothing
- }
-
- protected void implReset ()
- {
- // default implementation does nothing
- }
-
- public boolean isAutoDetecting ()
- {
- return false;
- }
-
- public boolean isCharsetDetected ()
- {
- throw new UnsupportedOperationException ();
- }
-
- public CodingErrorAction malformedInputAction ()
- {
- return malformedInputAction;
- }
-
- public final float maxCharsPerByte ()
- {
- return maxCharsPerByte;
- }
-
- public final CharsetDecoder onUnmappableCharacter
- (CodingErrorAction newAction)
- {
- if (newAction == null)
- throw new IllegalArgumentException ("Null action");
-
- unmappableCharacterAction = newAction;
- implOnUnmappableCharacter (newAction);
- return this;
- }
-
- public final String replacement ()
- {
- return replacement;
- }
-
- public final CharsetDecoder replaceWith (String newReplacement)
- {
- if (newReplacement == null)
- throw new IllegalArgumentException ("Null replacement");
- if (newReplacement.length () == 0)
- throw new IllegalArgumentException ("Empty replacement");
- // XXX: what about maxCharsPerByte?
-
- this.replacement = newReplacement;
- implReplaceWith (newReplacement);
- return this;
- }
-
- public final CharsetDecoder reset ()
- {
- state = STATE_RESET;
- implReset ();
- return this;
- }
-
- public CodingErrorAction unmappableCharacterAction ()
- {
- return unmappableCharacterAction;
- }
-}
diff --git a/libjava/java/nio/charset/CharsetEncoder.java b/libjava/java/nio/charset/CharsetEncoder.java
deleted file mode 100644
index 0c6184f..0000000
--- a/libjava/java/nio/charset/CharsetEncoder.java
+++ /dev/null
@@ -1,365 +0,0 @@
-/* CharsetEncoder.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-import java.nio.ByteBuffer;
-import java.nio.CharBuffer;
-
-/**
- * @author Jesse Rosenstock
- * @since 1.4
- */
-public abstract class CharsetEncoder
-{
- private static final int STATE_RESET = 0;
- private static final int STATE_CODING = 1;
- private static final int STATE_END = 2;
- private static final int STATE_FLUSHED = 3;
-
- private static final byte[] DEFAULT_REPLACEMENT = {(byte)'?'};
-
- private final Charset charset;
- private final float averageBytesPerChar;
- private final float maxBytesPerChar;
- private byte[] replacement;
-
- private int state = STATE_RESET;
-
- private CodingErrorAction malformedInputAction
- = CodingErrorAction.REPORT;
- private CodingErrorAction unmappableCharacterAction
- = CodingErrorAction.REPORT;
-
- protected CharsetEncoder (Charset cs, float averageBytesPerChar,
- float maxBytesPerChar)
- {
- this (cs, averageBytesPerChar, maxBytesPerChar, DEFAULT_REPLACEMENT);
- }
-
- protected CharsetEncoder (Charset cs, float averageBytesPerChar,
- float maxBytesPerChar, byte[] replacement)
- {
- if (averageBytesPerChar <= 0.0f)
- throw new IllegalArgumentException ("Non-positive averageBytesPerChar");
- if (maxBytesPerChar <= 0.0f)
- throw new IllegalArgumentException ("Non-positive maxBytesPerChar");
-
- this.charset = cs;
- this.averageBytesPerChar
- = averageBytesPerChar;
- this.maxBytesPerChar
- = maxBytesPerChar;
- this.replacement = replacement;
- implReplaceWith (replacement);
- }
-
- public final float averageBytesPerChar ()
- {
- return averageBytesPerChar;
- }
-
- public boolean canEncode (char c)
- {
- CharBuffer cb = CharBuffer.allocate (1).put (c);
- cb.flip ();
- return canEncode (cb);
- }
-
- public boolean canEncode (CharSequence cs)
- {
- CharBuffer cb;
- if (cs instanceof CharBuffer)
- cb = ((CharBuffer) cs).duplicate ();
- else
- cb = CharBuffer.wrap (cs);
- return canEncode (cb);
- }
-
- private boolean canEncode (CharBuffer cb)
- {
- // It is an error if a coding operation is "in progress"
- // I take that to mean the state is not reset or flushed.
- // XXX: check "in progress" everywhere
- if (state == STATE_FLUSHED)
- reset ();
- else if (state != STATE_RESET)
- throw new IllegalStateException ();
-
- CodingErrorAction oldMalformedInputAction = malformedInputAction;
- CodingErrorAction oldUnmappableCharacterAction
- = unmappableCharacterAction;
-
- try
- {
- if (oldMalformedInputAction != CodingErrorAction.REPORT)
- onMalformedInput (CodingErrorAction.REPORT);
- if (oldUnmappableCharacterAction != CodingErrorAction.REPORT)
- onUnmappableCharacter (CodingErrorAction.REPORT);
- }
- catch (Exception e)
- {
- return false;
- }
- finally
- {
- if (oldMalformedInputAction != CodingErrorAction.REPORT)
- onMalformedInput (oldMalformedInputAction);
- if (oldUnmappableCharacterAction != CodingErrorAction.REPORT)
- onUnmappableCharacter (oldUnmappableCharacterAction);
- }
-
- return true;
- }
-
- public final Charset charset ()
- {
- return charset;
- }
-
- public final ByteBuffer encode (CharBuffer in)
- throws CharacterCodingException
- {
- // XXX: Sun's Javadoc seems to contradict itself saying an
- // IllegalStateException is thrown "if a decoding operation is already
- // in progress" and also that "it resets this Encoder".
- // Should we check to see that the state is reset, or should we
- // call reset()?
- if (state != STATE_RESET)
- throw new IllegalStateException ();
-
- // REVIEW: Using max instead of average may allocate a very large
- // buffer. Maybe we should do something more efficient?
- int remaining = in.remaining ();
- int n = (int) (remaining * maxBytesPerChar ());
- ByteBuffer out = ByteBuffer.allocate (n);
-
- if (remaining == 0)
- {
- state = STATE_FLUSHED;
- return out;
- }
-
- CoderResult cr = encode (in, out, true);
- if (cr.isError ())
- cr.throwException ();
-
- cr = flush (out);
- if (cr.isError ())
- cr.throwException ();
-
- out.flip ();
- return out;
- }
-
- public final CoderResult encode (CharBuffer in, ByteBuffer out,
- boolean endOfInput)
- {
- int newState = endOfInput ? STATE_END : STATE_CODING;
- // XXX: Need to check for "previous step was an invocation [not] of
- // this method with a value of true for the endOfInput parameter but
- // a return value indicating an incomplete decoding operation"
- // XXX: We will not check the previous return value, just
- // that the previous call passed true for endOfInput
- if (state != STATE_RESET && state != STATE_CODING
- && !(endOfInput && state == STATE_END))
- throw new IllegalStateException ();
- state = newState;
-
- for (;;)
- {
- CoderResult cr;
- try
- {
- cr = encodeLoop (in, out);
- }
- catch (RuntimeException e)
- {
- throw new CoderMalfunctionError (e);
- }
-
- if (cr.isOverflow ())
- return cr;
-
- if (cr.isUnderflow ())
- {
- if (endOfInput && in.hasRemaining ())
- cr = CoderResult.malformedForLength (in.remaining ());
- else
- return cr;
- }
-
- CodingErrorAction action = cr.isMalformed ()
- ? malformedInputAction
- : unmappableCharacterAction;
-
- if (action == CodingErrorAction.REPORT)
- return cr;
-
- if (action == CodingErrorAction.REPLACE)
- {
- if (out.remaining () < replacement.length)
- return CoderResult.OVERFLOW;
- out.put (replacement);
- }
-
- in.position (in.position () + cr.length ());
- }
- }
-
- protected abstract CoderResult encodeLoop (CharBuffer in, ByteBuffer out);
-
- public final CoderResult flush (ByteBuffer out)
- {
- // It seems weird that you can flush after reset, but Sun's javadoc
- // says an IllegalStateException is thrown "If the previous step of the
- // current decoding operation was an invocation neither of the reset
- // method nor ... of the three-argument encode method with a value of
- // true for the endOfInput parameter."
- // Further note that flush() only requires that there not be
- // an IllegalStateException if the previous step was a call to
- // encode with true as the last argument. It does not require
- // that the call succeeded. encode() does require that it succeeded.
- // XXX: test this to see if reality matches javadoc
- if (state != STATE_RESET && state != STATE_END)
- throw new IllegalStateException ();
-
- state = STATE_FLUSHED;
- return implFlush (out);
- }
-
- protected CoderResult implFlush (ByteBuffer out)
- {
- return CoderResult.UNDERFLOW;
- }
-
- protected void implOnMalformedInput (CodingErrorAction newAction)
- {
- // default implementation does nothing
- }
-
- protected void implOnUnmappableCharacter (CodingErrorAction newAction)
- {
- // default implementation does nothing
- }
-
- protected void implReplaceWith (byte[] newReplacement)
- {
- // default implementation does nothing
- }
-
- protected void implReset ()
- {
- // default implementation does nothing
- }
-
- public boolean isLegalReplacement (byte[] replacement)
- {
- // TODO: cache the decoder
- // error actions will be REPORT after construction
- CharsetDecoder decoder = charset.newDecoder ();
- ByteBuffer bb = ByteBuffer.wrap (replacement);
- CharBuffer cb
- = CharBuffer.allocate ((int) (replacement.length
- * decoder.maxCharsPerByte ()));
- return !decoder.decode (bb, cb, true).isError ();
- }
-
- public CodingErrorAction malformedInputAction ()
- {
- return malformedInputAction;
- }
-
- public final float maxBytesPerChar ()
- {
- return maxBytesPerChar;
- }
-
- public final CharsetEncoder onMalformedInput (CodingErrorAction newAction)
- {
- if (newAction == null)
- throw new IllegalArgumentException ("Null action");
-
- malformedInputAction = newAction;
- implOnMalformedInput (newAction);
- return this;
- }
-
- public CodingErrorAction unmappableCharacterAction ()
- {
- return unmappableCharacterAction;
- }
-
- public final CharsetEncoder onUnmappableCharacter
- (CodingErrorAction newAction)
- {
- if (newAction == null)
- throw new IllegalArgumentException ("Null action");
-
- unmappableCharacterAction = newAction;
- implOnUnmappableCharacter (newAction);
- return this;
- }
-
- public final byte[] replacement ()
- {
- return replacement;
- }
-
- public final CharsetEncoder replaceWith (byte[] newReplacement)
- {
- if (newReplacement == null)
- throw new IllegalArgumentException ("Null replacement");
- if (newReplacement.length == 0)
- throw new IllegalArgumentException ("Empty replacement");
- // XXX: what about maxBytesPerChar?
-
- if (!isLegalReplacement (newReplacement))
- throw new IllegalArgumentException ("Illegal replacement");
-
- this.replacement = newReplacement;
- implReplaceWith (newReplacement);
- return this;
- }
-
- public final CharsetEncoder reset ()
- {
- state = STATE_RESET;
- implReset ();
- return this;
- }
-}
diff --git a/libjava/java/nio/charset/CoderMalfunctionError.java b/libjava/java/nio/charset/CoderMalfunctionError.java
deleted file mode 100644
index 08294ca..0000000
--- a/libjava/java/nio/charset/CoderMalfunctionError.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/* CoderMalfunctionError.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-/**
- * @since 1.4
- */
-public class CoderMalfunctionError extends Error
-{
- /**
- * Creates the error
- */
- public CoderMalfunctionError(Exception cause)
- {
- super (cause);
- }
-}
diff --git a/libjava/java/nio/charset/CoderResult.java b/libjava/java/nio/charset/CoderResult.java
deleted file mode 100644
index 664215d..0000000
--- a/libjava/java/nio/charset/CoderResult.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/* CoderResult.java --
- Copyright (C) 2002, 2004 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-import java.lang.ref.WeakReference;
-import java.nio.BufferOverflowException;
-import java.nio.BufferUnderflowException;
-import java.util.HashMap;
-
-/**
- * @author Jesse Rosenstock
- * @since 1.4
- */
-public class CoderResult
-{
- private static final int TYPE_MALFORMED = 0;
- private static final int TYPE_OVERFLOW = 1;
- private static final int TYPE_UNDERFLOW = 2;
- private static final int TYPE_UNMAPPABLE = 3;
-
- public static final CoderResult OVERFLOW
- = new CoderResult (TYPE_OVERFLOW, 0);
- public static final CoderResult UNDERFLOW
- = new CoderResult (TYPE_UNDERFLOW, 0);
-
- private static final String[] names
- = { "MALFORMED", "OVERFLOW", "UNDERFLOW", "UNMAPPABLE" };
-
- private static final Cache malformedCache
- = new Cache ()
- {
- protected CoderResult make (int length)
- {
- return new CoderResult (TYPE_MALFORMED, length);
- }
- };
-
- private static final Cache unmappableCache
- = new Cache ()
- {
- protected CoderResult make (int length)
- {
- return new CoderResult (TYPE_UNMAPPABLE, length);
- }
- };
-
- private final int type;
- private final int length;
-
- // Package-private to avoid a trampoline constructor.
- CoderResult (int type, int length)
- {
- this.type = type;
- this.length = length;
- }
-
- public boolean isError ()
- {
- return length > 0;
- }
-
- public boolean isMalformed ()
- {
- return type == TYPE_MALFORMED;
- }
-
- public boolean isOverflow ()
- {
- return type == TYPE_OVERFLOW;
- }
-
- public boolean isUnderflow ()
- {
- return type == TYPE_UNDERFLOW;
- }
-
- public boolean isUnmappable ()
- {
- return type == TYPE_UNMAPPABLE;
- }
-
- public int length ()
- {
- if (length <= 0)
- throw new UnsupportedOperationException ();
- else
- return length;
- }
-
- public static CoderResult malformedForLength (int length)
- {
- return malformedCache.get (length);
- }
-
- public void throwException ()
- throws CharacterCodingException
- {
- switch (type)
- {
- case TYPE_MALFORMED:
- throw new MalformedInputException (length);
- case TYPE_OVERFLOW:
- throw new BufferOverflowException ();
- case TYPE_UNDERFLOW:
- throw new BufferUnderflowException ();
- case TYPE_UNMAPPABLE:
- throw new UnmappableCharacterException (length);
- }
- }
-
- public String toString ()
- {
- String name = names[type];
- return (length > 0) ? name + '[' + length + ']' : name;
- }
-
- public static CoderResult unmappableForLength (int length)
- {
- return unmappableCache.get (length);
- }
-
- private abstract static class Cache
- {
- private final HashMap cache;
-
- // Package-private to avoid a trampoline constructor.
- Cache ()
- {
- cache = new HashMap ();
- }
-
- // Package-private to avoid a trampoline.
- synchronized CoderResult get (int length)
- {
- if (length <= 0)
- throw new IllegalArgumentException ("Non-positive length");
-
- Integer len = new Integer (length);
- CoderResult cr = null;
- Object o;
- if ((o = cache.get (len)) != null)
- cr = (CoderResult) ((WeakReference) o).get ();
- if (cr == null)
- {
- cr = make (length);
- cache.put (len, new WeakReference (cr));
- }
-
- return cr;
- }
-
- protected abstract CoderResult make (int length);
- }
-}
diff --git a/libjava/java/nio/charset/CodingErrorAction.java b/libjava/java/nio/charset/CodingErrorAction.java
deleted file mode 100644
index 592c159..0000000
--- a/libjava/java/nio/charset/CodingErrorAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/* CodingErrorAction.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-public class CodingErrorAction
-{
- public static final CodingErrorAction IGNORE
- = new CodingErrorAction("ignore");
- public static final CodingErrorAction REPLACE
- = new CodingErrorAction("replace");
- public static final CodingErrorAction REPORT
- = new CodingErrorAction("report");
-
- private final String name;
-
- /**
- * Private constructor only used to create the constant CodingErrorActions.
- */
- private CodingErrorAction(String name)
- {
- this.name = name;
- }
-
- /**
- * Returns the name of the CodingErrorAction.
- */
- public String toString ()
- {
- return name;
- }
-}
diff --git a/libjava/java/nio/charset/IllegalCharsetNameException.java b/libjava/java/nio/charset/IllegalCharsetNameException.java
deleted file mode 100644
index 7baeac3..0000000
--- a/libjava/java/nio/charset/IllegalCharsetNameException.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/* IllegalCharsetNameException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class IllegalCharsetNameException extends IllegalArgumentException
-{
- /**
- * Compatible with JDK 1.4+
- */
- private static final long serialVersionUID = 1457525358470002989L;
-
- private String charsetName;
-
- /**
- * Creates the exception
- *
- * @param charsetName name of the illegal charset
- */
- public IllegalCharsetNameException (String charsetName)
- {
- super ();
- this.charsetName = charsetName;
- }
-
- /**
- * Retrieves the illegal charset name
- *
- * @return the illegal charset name
- */
- public String getCharsetName ()
- {
- return charsetName;
- }
-}
diff --git a/libjava/java/nio/charset/MalformedInputException.java b/libjava/java/nio/charset/MalformedInputException.java
deleted file mode 100644
index 0beceb4..0000000
--- a/libjava/java/nio/charset/MalformedInputException.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/* MalformedInputException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-/**
- * @since 1.4
- */
-public class MalformedInputException extends CharacterCodingException
-{
- private int inputLength;
-
- /**
- * Creates the exception
- *
- * @param inputLength the position of malformed input in the input stream
- */
- public MalformedInputException (int inputLength)
- {
- super ();
- this.inputLength = inputLength;
- }
-
- /**
- * Retrieves the position of the malformed input in the input stream.
- *
- * @return the position
- */
- public int getInputLength ()
- {
- return inputLength;
- }
-
- /**
- * Returns the detail message string of this throwable
- *
- * @return the message
- */
- public String getMessage ()
- {
- return "Input length = " + inputLength;
- }
-}
diff --git a/libjava/java/nio/charset/UnmappableCharacterException.java b/libjava/java/nio/charset/UnmappableCharacterException.java
deleted file mode 100644
index 7190651..0000000
--- a/libjava/java/nio/charset/UnmappableCharacterException.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/* UnmappableCharacterException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-/**
- * @since 1.4
- */
-public class UnmappableCharacterException extends CharacterCodingException
-{
- private int inputLength;
-
- /**
- * Creates the exception
- */
- public UnmappableCharacterException (int inputLength)
- {
- super ();
- this.inputLength = inputLength;
- }
-
- /**
- * Retrieves the illegal charset name
- */
- public int getInputLength ()
- {
- return inputLength;
- }
-
- /**
- * Returns the detail message string of this throwable
- */
- public String getMessage ()
- {
- return "Input length = " + inputLength;
- }
-}
diff --git a/libjava/java/nio/charset/UnsupportedCharsetException.java b/libjava/java/nio/charset/UnsupportedCharsetException.java
deleted file mode 100644
index 39536ba..0000000
--- a/libjava/java/nio/charset/UnsupportedCharsetException.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/* UnsupportedCharsetException.java --
- Copyright (C) 2002 Free Software Foundation, Inc.
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset;
-
-/**
- * @author Michael Koch
- * @since 1.4
- */
-public class UnsupportedCharsetException extends IllegalArgumentException
-{
- /**
- * Compatible with JDK 1.4+
- */
- private static final long serialVersionUID = 1490765524727386367L;
-
- String charsetName;
-
- /**
- * Creates the exception
- */
- public UnsupportedCharsetException (String charsetName)
- {
- super ();
- this.charsetName = charsetName;
- }
-
- /**
- * Retrieves the illegal charset name
- */
- public String getCharsetName ()
- {
- return charsetName;
- }
-}
diff --git a/libjava/java/nio/charset/spi/CharsetProvider.java b/libjava/java/nio/charset/spi/CharsetProvider.java
deleted file mode 100644
index f0d40ab..0000000
--- a/libjava/java/nio/charset/spi/CharsetProvider.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/* CharsetProvider.java -- charset service provider interface
- Copyright (C) 2002 Free Software Foundation
-
-This file is part of GNU Classpath.
-
-GNU Classpath is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU Classpath is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU Classpath; see the file COPYING. If not, write to the
-Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-02110-1301 USA.
-
-Linking this library statically or dynamically with other modules is
-making a combined work based on this library. Thus, the terms and
-conditions of the GNU General Public License cover the whole
-combination.
-
-As a special exception, the copyright holders of this library give you
-permission to link this library with independent modules to produce an
-executable, regardless of the license terms of these independent
-modules, and to copy and distribute the resulting executable under
-terms of your choice, provided that you also meet, for each linked
-independent module, the terms and conditions of the license of that
-module. An independent module is a module which is not derived from
-or based on this library. If you modify this library, you may extend
-this exception to your version of the library, but you are not
-obligated to do so. If you do not wish to do so, delete this
-exception statement from your version. */
-
-package java.nio.charset.spi;
-
-import java.nio.charset.Charset;
-import java.util.Iterator;
-
-
-/**
- * This class allows an implementor to provide additional character sets. The
- * subclass must have a nullary constructor, and be attached to charset
- * implementation classes. These extensions are loaded via the context class
- * loader. To provide the charset extension, all files named
- * <code>META-INF/services/java.nio.charset.spi.CharsetProvider</code> are
- * read from the classpath. Each one should be a UTF-8 encoded list of
- * fully-qualified names of concrete subclasses of this class; whitespace is
- * ignored, and '#' starts comments. Duplicates are ignored. The
- * implementations must be accessible to the classloader that requests them.
- *
- * @author Eric Blake (ebb9@email.byu.edu)
- * @see Charset
- * @since 1.4
- * @status updated to 1.4
- */
-public abstract class CharsetProvider
-{
- /**
- * Initialize a new charset provider. This performs a security check on
- * RuntimePermission("charsetProvider").
- *
- * @throws SecurityException if building a new set is not allowed
- */
- protected CharsetProvider()
- {
- SecurityManager s = System.getSecurityManager();
- if (s != null)
- s.checkPermission(new RuntimePermission("charsetProvider"));
- }
-
- /**
- * Returns an iterator over the charsets defined by this provider.
- *
- * @return the iterator
- * @see Charset#availableCharsets()
- */
- public abstract Iterator charsets();
-
- /**
- * Returns the named charset, by canonical name or alias.
- *
- * @param name the name of the character
- *
- * @return the charset, or null if not supported
- */
- public abstract Charset charsetForName(String name);
-} // class CharsetProvider