diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 8eae4790dd9..3a5b20bf542 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,25 @@ +2002-10-07 Michael Koch + + * java/nio/channels/AlreadyConnectedException.java, + java/nio/channels/ClosedChannelException.java, + java/nio/channels/ReadableByteChannel.java, + java/nio/channels/InterruptibleChannel.java, + java/nio/channels/Channel.java, + java/nio/channels/ByteChannel.java, + java/nio/channels/GatheringByteChannel.java, + java/nio/channels/ScatteringByteChannel.java, + java/nio/channels/WritableByteChannel.java, + java/nio/charset/CharacterCodingException.java, + java/nio/charset/IllegalCharsetNameException.java, + java/nio/charset/MalformedInputException.java, + java/nio/charset/UnmappableCharacterException.java, + java/nio/charset/UnsupportedCharsetException.java, + java/nio/charset/spi/CharsetProvider.java: New file. + These files are exceptions or interfaces, + no real or abstract classes. + * Makefile.am (java_native_source_files): Added new files. + * Makefile.in: Regenerated. + 2002-10-05 Michael Koch * java/net/InetAddress.java diff --git a/libjava/Makefile.am b/libjava/Makefile.am index f56d5d5af68..286270658ea 100644 --- a/libjava/Makefile.am +++ b/libjava/Makefile.am @@ -1956,11 +1956,26 @@ java/net/URLStreamHandler.java \ java/net/URLStreamHandlerFactory.java \ java/net/UnknownHostException.java \ java/net/UnknownServiceException.java \ +java/nio/channels/AlreadyConnectedException.java \ +java/nio/channels/ByteChannel.java \ +java/nio/channels/Channel.java \ +java/nio/channels/ClosedChannelException.java \ java/nio/channels/DatagramChannel.java \ +java/nio/channels/GatheringByteChannel.java \ java/nio/channels/IllegalBlockingModeException.java \ +java/nio/channels/InterruptibleChannel.java \ +java/nio/channels/ReadableByteChannel.java \ +java/nio/channels/ScatteringByteChannel.java \ java/nio/channels/ServerSocketChannel.java \ java/nio/channels/SocketChannel.java \ +java/nio/channels/WritableByteChannel.java \ java/nio/channels/spi/AbstractSelectableChannel.java \ +java/nio/charset/CharacterCodingException.java \ +java/nio/charset/IllegalCharsetNameException.java \ +java/nio/charset/MalformedInputException.java \ +java/nio/charset/UnmappableCharacterException.java \ +java/nio/charset/UnsupportedCharsetException.java \ +java/nio/charset/spi/CharsetProvider.java \ java/security/AccessControlContext.java \ java/security/AccessControlException.java \ java/security/AccessController.java \ diff --git a/libjava/Makefile.in b/libjava/Makefile.in index e7ff2242a30..291f93222cd 100644 --- a/libjava/Makefile.in +++ b/libjava/Makefile.in @@ -1706,11 +1706,26 @@ java/net/URLStreamHandler.java \ java/net/URLStreamHandlerFactory.java \ java/net/UnknownHostException.java \ java/net/UnknownServiceException.java \ +java/nio/channels/AlreadyConnectedException.java \ +java/nio/channels/ByteChannel.java \ +java/nio/channels/Channel.java \ +java/nio/channels/ClosedChannelException.java \ java/nio/channels/DatagramChannel.java \ +java/nio/channels/GatheringByteChannel.java \ java/nio/channels/IllegalBlockingModeException.java \ +java/nio/channels/InterruptibleChannel.java \ +java/nio/channels/ReadableByteChannel.java \ +java/nio/channels/ScatteringByteChannel.java \ java/nio/channels/ServerSocketChannel.java \ java/nio/channels/SocketChannel.java \ +java/nio/channels/WritableByteChannel.java \ java/nio/channels/spi/AbstractSelectableChannel.java \ +java/nio/charset/CharacterCodingException.java \ +java/nio/charset/IllegalCharsetNameException.java \ +java/nio/charset/MalformedInputException.java \ +java/nio/charset/UnmappableCharacterException.java \ +java/nio/charset/UnsupportedCharsetException.java \ +java/nio/charset/spi/CharsetProvider.java \ java/security/AccessControlContext.java \ java/security/AccessControlException.java \ java/security/AccessController.java \ @@ -2941,11 +2956,25 @@ DEP_FILES = .deps/$(srcdir)/$(CONVERT_DIR)/gen-from-JIS.P \ .deps/java/net/natInetAddress.P .deps/java/net/natNetworkInterface.P \ .deps/java/net/natPlainDatagramSocketImpl.P \ .deps/java/net/natPlainSocketImpl.P \ +.deps/java/nio/channels/AlreadyConnectedException.P \ +.deps/java/nio/channels/ByteChannel.P .deps/java/nio/channels/Channel.P \ +.deps/java/nio/channels/ClosedChannelException.P \ .deps/java/nio/channels/DatagramChannel.P \ +.deps/java/nio/channels/GatheringByteChannel.P \ .deps/java/nio/channels/IllegalBlockingModeException.P \ +.deps/java/nio/channels/InterruptibleChannel.P \ +.deps/java/nio/channels/ReadableByteChannel.P \ +.deps/java/nio/channels/ScatteringByteChannel.P \ .deps/java/nio/channels/ServerSocketChannel.P \ .deps/java/nio/channels/SocketChannel.P \ +.deps/java/nio/channels/WritableByteChannel.P \ .deps/java/nio/channels/spi/AbstractSelectableChannel.P \ +.deps/java/nio/charset/CharacterCodingException.P \ +.deps/java/nio/charset/IllegalCharsetNameException.P \ +.deps/java/nio/charset/MalformedInputException.P \ +.deps/java/nio/charset/UnmappableCharacterException.P \ +.deps/java/nio/charset/UnsupportedCharsetException.P \ +.deps/java/nio/charset/spi/CharsetProvider.P \ .deps/java/rmi/AccessException.P .deps/java/rmi/AlreadyBoundException.P \ .deps/java/rmi/ConnectException.P .deps/java/rmi/ConnectIOException.P \ .deps/java/rmi/MarshalException.P .deps/java/rmi/MarshalledObject.P \ diff --git a/libjava/java/nio/channels/AlreadyConnectedException.java b/libjava/java/nio/channels/AlreadyConnectedException.java new file mode 100644 index 00000000000..29e3cda0efa --- /dev/null +++ b/libjava/java/nio/channels/AlreadyConnectedException.java @@ -0,0 +1,50 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 class AlreadyConnectedException extends IOException +{ + /** + * Creates the exception + */ + public AlreadyConnectedException() + { + } +} diff --git a/libjava/java/nio/channels/ByteChannel.java b/libjava/java/nio/channels/ByteChannel.java new file mode 100644 index 00000000000..f4958be2bf7 --- /dev/null +++ b/libjava/java/nio/channels/ByteChannel.java @@ -0,0 +1,43 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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/Channel.java b/libjava/java/nio/channels/Channel.java new file mode 100644 index 00000000000..b5272c36776 --- /dev/null +++ b/libjava/java/nio/channels/Channel.java @@ -0,0 +1,55 @@ +/* Channel.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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 + */ + public boolean isOpen(); + + /** + * Closes this channel + * + * @exception IOException If an error occurs + */ + public void close() throws IOException; +} diff --git a/libjava/java/nio/channels/ClosedChannelException.java b/libjava/java/nio/channels/ClosedChannelException.java new file mode 100644 index 00000000000..2576d34c3c8 --- /dev/null +++ b/libjava/java/nio/channels/ClosedChannelException.java @@ -0,0 +1,50 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 class ClosedChannelException extends IOException +{ + /** + * Creates the exception + */ + public ClosedChannelException() + { + } +} diff --git a/libjava/java/nio/channels/GatheringByteChannel.java b/libjava/java/nio/channels/GatheringByteChannel.java new file mode 100644 index 00000000000..3ef12b7b6dc --- /dev/null +++ b/libjava/java/nio/channels/GatheringByteChannel.java @@ -0,0 +1,79 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.nio.ByteBuffer; +import java.io.IOException; + +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 + */ + public 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 + */ + public long write(ByteBuffer[] srcs) throws IOException; +} diff --git a/libjava/java/nio/channels/InterruptibleChannel.java b/libjava/java/nio/channels/InterruptibleChannel.java new file mode 100644 index 00000000000..0b55e7619a5 --- /dev/null +++ b/libjava/java/nio/channels/InterruptibleChannel.java @@ -0,0 +1,50 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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/ReadableByteChannel.java b/libjava/java/nio/channels/ReadableByteChannel.java new file mode 100644 index 00000000000..d1653cc8d3e --- /dev/null +++ b/libjava/java/nio/channels/ReadableByteChannel.java @@ -0,0 +1,59 @@ +/* ReadableByteChannel.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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 + * + * @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 + */ + public int read (ByteBuffer dst) throws IOException; +} diff --git a/libjava/java/nio/channels/ScatteringByteChannel.java b/libjava/java/nio/channels/ScatteringByteChannel.java new file mode 100644 index 00000000000..a9efdbef448 --- /dev/null +++ b/libjava/java/nio/channels/ScatteringByteChannel.java @@ -0,0 +1,79 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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.nio.ByteBuffer; +import java.io.IOException; + +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 + */ + public 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 + */ + public long read(ByteBuffer[] srcs) throws IOException; +} diff --git a/libjava/java/nio/channels/WritableByteChannel.java b/libjava/java/nio/channels/WritableByteChannel.java new file mode 100644 index 00000000000..003437e5f3c --- /dev/null +++ b/libjava/java/nio/channels/WritableByteChannel.java @@ -0,0 +1,60 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 + */ + public int write(ByteBuffer src) throws IOException; +} diff --git a/libjava/java/nio/charset/CharacterCodingException.java b/libjava/java/nio/charset/CharacterCodingException.java new file mode 100644 index 00000000000..2fba33e9509 --- /dev/null +++ b/libjava/java/nio/charset/CharacterCodingException.java @@ -0,0 +1,50 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +class CharacterCodingException extends IOException +{ + /** + * Creates the exception + */ + public CharacterCodingException() + { + } +} diff --git a/libjava/java/nio/charset/IllegalCharsetNameException.java b/libjava/java/nio/charset/IllegalCharsetNameException.java new file mode 100644 index 00000000000..a3e0593327b --- /dev/null +++ b/libjava/java/nio/charset/IllegalCharsetNameException.java @@ -0,0 +1,60 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +class IllegalCharsetNameException extends IllegalArgumentException +{ + private String charsetName; + + /** + * Creates the exception + */ + public IllegalCharsetNameException (String charsetName) + { + super (); + this.charsetName = charsetName; + } + + /** + * Retrieves 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 new file mode 100644 index 00000000000..2111b797865 --- /dev/null +++ b/libjava/java/nio/charset/MalformedInputException.java @@ -0,0 +1,69 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +class MalformedInputException extends CharacterCodingException +{ + private int inputLength; + + /** + * Creates the exception + */ + public MalformedInputException (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 () + { + // FIXME: I think this is not correct + return ""; + } +} diff --git a/libjava/java/nio/charset/UnmappableCharacterException.java b/libjava/java/nio/charset/UnmappableCharacterException.java new file mode 100644 index 00000000000..f1714b8ec41 --- /dev/null +++ b/libjava/java/nio/charset/UnmappableCharacterException.java @@ -0,0 +1,69 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +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 () + { + // FIXME: I think this is not correct + return ""; + } +} diff --git a/libjava/java/nio/charset/UnsupportedCharsetException.java b/libjava/java/nio/charset/UnsupportedCharsetException.java new file mode 100644 index 00000000000..943164a6837 --- /dev/null +++ b/libjava/java/nio/charset/UnsupportedCharsetException.java @@ -0,0 +1,60 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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; + +class UnsupportedCharsetException extends IllegalArgumentException +{ + private 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 new file mode 100644 index 00000000000..32346a0457c --- /dev/null +++ b/libjava/java/nio/charset/spi/CharsetProvider.java @@ -0,0 +1,88 @@ +/* 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., 59 Temple Place, Suite 330, Boston, MA +02111-1307 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 + * META-INF/services/java.nio.charset.spi.CharsetProvider 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 + * @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. + * + * @return the charset, or null if not supported + */ + public abstract Charset charsetForName(String name); +} // class CharsetProvider