diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /libjava/gnu/java/nio | |
download | cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2 cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'libjava/gnu/java/nio')
134 files changed, 9141 insertions, 0 deletions
diff --git a/libjava/gnu/java/nio/ChannelInputStream.h b/libjava/gnu/java/nio/ChannelInputStream.h new file mode 100644 index 000000000..04b624440 --- /dev/null +++ b/libjava/gnu/java/nio/ChannelInputStream.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_ChannelInputStream__ +#define __gnu_java_nio_ChannelInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class ChannelInputStream; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class ReadableByteChannel; + } + } + } +} + +class gnu::java::nio::ChannelInputStream : public ::java::io::InputStream +{ + +public: + ChannelInputStream(::java::nio::channels::ReadableByteChannel *); + jint read(JArray< jbyte > *, jint, jint); + jint read(); +private: + ::java::nio::channels::ReadableByteChannel * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) ch; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_ChannelInputStream__ diff --git a/libjava/gnu/java/nio/ChannelOutputStream.h b/libjava/gnu/java/nio/ChannelOutputStream.h new file mode 100644 index 000000000..7ff1b8d80 --- /dev/null +++ b/libjava/gnu/java/nio/ChannelOutputStream.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_ChannelOutputStream__ +#define __gnu_java_nio_ChannelOutputStream__ + +#pragma interface + +#include <java/io/OutputStream.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class ChannelOutputStream; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class WritableByteChannel; + } + } + } +} + +class gnu::java::nio::ChannelOutputStream : public ::java::io::OutputStream +{ + +public: + ChannelOutputStream(::java::nio::channels::WritableByteChannel *); + void write(jint); +private: + ::java::nio::channels::WritableByteChannel * __attribute__((aligned(__alignof__( ::java::io::OutputStream)))) ch; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_ChannelOutputStream__ diff --git a/libjava/gnu/java/nio/ChannelReader.h b/libjava/gnu/java/nio/ChannelReader.h new file mode 100644 index 000000000..337473f4f --- /dev/null +++ b/libjava/gnu/java/nio/ChannelReader.h @@ -0,0 +1,59 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_ChannelReader__ +#define __gnu_java_nio_ChannelReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class ChannelReader; + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace channels + { + class ReadableByteChannel; + } + namespace charset + { + class CharsetDecoder; + } + } + } +} + +class gnu::java::nio::ChannelReader : public ::java::io::Reader +{ + +public: + ChannelReader(::java::nio::channels::ReadableByteChannel *, ::java::nio::charset::CharsetDecoder *, jint); + virtual jint read(JArray< jchar > *, jint, jint); + virtual void close(); +private: + static const jint DEFAULT_BUFFER_CAP = 8192; + ::java::nio::channels::ReadableByteChannel * __attribute__((aligned(__alignof__( ::java::io::Reader)))) channel; + ::java::nio::charset::CharsetDecoder * decoder; + ::java::nio::ByteBuffer * byteBuffer; + ::java::nio::CharBuffer * charBuffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_ChannelReader__ diff --git a/libjava/gnu/java/nio/ChannelWriter.h b/libjava/gnu/java/nio/ChannelWriter.h new file mode 100644 index 000000000..f78d294bd --- /dev/null +++ b/libjava/gnu/java/nio/ChannelWriter.h @@ -0,0 +1,61 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_ChannelWriter__ +#define __gnu_java_nio_ChannelWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class ChannelWriter; + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace channels + { + class WritableByteChannel; + } + namespace charset + { + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::ChannelWriter : public ::java::io::Writer +{ + + void writeBuffer(); +public: + ChannelWriter(::java::nio::channels::WritableByteChannel *, ::java::nio::charset::CharsetEncoder *, jint); + virtual void flush(); + virtual void close(); + virtual void write(JArray< jchar > *, jint, jint); +private: + static const jint DEFAULT_BUFFER_CAP = 8192; + ::java::nio::channels::WritableByteChannel * __attribute__((aligned(__alignof__( ::java::io::Writer)))) byteChannel; + ::java::nio::charset::CharsetEncoder * enc; + ::java::nio::ByteBuffer * byteBuffer; + ::java::nio::CharBuffer * charBuffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_ChannelWriter__ diff --git a/libjava/gnu/java/nio/DatagramChannelImpl.h b/libjava/gnu/java/nio/DatagramChannelImpl.h new file mode 100644 index 000000000..26595caa5 --- /dev/null +++ b/libjava/gnu/java/nio/DatagramChannelImpl.h @@ -0,0 +1,78 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_DatagramChannelImpl__ +#define __gnu_java_nio_DatagramChannelImpl__ + +#pragma interface + +#include <java/nio/channels/DatagramChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class DatagramChannelImpl; + class NIODatagramSocket; + } + } + } + namespace java + { + namespace net + { + class DatagramSocket; + class SocketAddress; + } + namespace nio + { + class ByteBuffer; + namespace channels + { + class DatagramChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::DatagramChannelImpl : public ::java::nio::channels::DatagramChannel +{ + +public: + jboolean isInChannelOperation(); + void setInChannelOperation(jboolean); +public: // actually protected + DatagramChannelImpl(::java::nio::channels::spi::SelectorProvider *); +public: + jint getNativeFD(); + ::java::net::DatagramSocket * socket(); +public: // actually protected + void implCloseSelectableChannel(); + void implConfigureBlocking(jboolean); +public: + ::java::nio::channels::DatagramChannel * connect(::java::net::SocketAddress *); + ::java::nio::channels::DatagramChannel * disconnect(); + jboolean isConnected(); + jint write(::java::nio::ByteBuffer *); + jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + jint read(::java::nio::ByteBuffer *); + jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + ::java::net::SocketAddress * receive(::java::nio::ByteBuffer *); + jint send(::java::nio::ByteBuffer *, ::java::net::SocketAddress *); +private: + ::gnu::java::nio::NIODatagramSocket * __attribute__((aligned(__alignof__( ::java::nio::channels::DatagramChannel)))) socket__; + jboolean inChannelOperation; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_DatagramChannelImpl__ diff --git a/libjava/gnu/java/nio/DatagramChannelImpl.java b/libjava/gnu/java/nio/DatagramChannelImpl.java new file mode 100644 index 000000000..de1d2e6a3 --- /dev/null +++ b/libjava/gnu/java/nio/DatagramChannelImpl.java @@ -0,0 +1,302 @@ +/* DatagramChannelImpl.java -- + Copyright (C) 2002, 2003, 2004, 2006 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 gnu.java.nio; + +import gnu.java.net.PlainDatagramSocketImpl; +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.SocketTimeoutException; +import java.nio.ByteBuffer; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.DatagramChannel; +import java.nio.channels.NotYetConnectedException; +import java.nio.channels.spi.SelectorProvider; + +/** + * @author Michael Koch + */ +public final class DatagramChannelImpl extends DatagramChannel +{ + private NIODatagramSocket socket; + + /** + * Indicates whether this channel initiated whatever operation + * is being invoked on our datagram socket. + */ + private boolean inChannelOperation; + + /** + * Indicates whether our datagram socket should ignore whether + * we are set to non-blocking mode. Certain operations on our + * socket throw an <code>IllegalBlockingModeException</code> if + * we are in non-blocking mode, <i>except</i> if the operation + * is initiated by us. + */ + public final boolean isInChannelOperation() + { + return inChannelOperation; + } + + /** + * Sets our indicator of whether we are initiating an I/O operation + * on our socket. + */ + public final void setInChannelOperation(boolean b) + { + inChannelOperation = b; + } + + protected DatagramChannelImpl (SelectorProvider provider) + throws IOException + { + super (provider); + socket = new NIODatagramSocket (new PlainDatagramSocketImpl(), this); + configureBlocking(true); + } + + public int getNativeFD() + { + return socket.getPlainDatagramSocketImpl().getNativeFD(); + } + + public DatagramSocket socket () + { + return socket; + } + + protected void implCloseSelectableChannel () + throws IOException + { + socket.close (); + } + + protected void implConfigureBlocking (boolean blocking) + throws IOException + { + socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); + } + + public DatagramChannel connect (SocketAddress remote) + throws IOException + { + if (!isOpen()) + throw new ClosedChannelException(); + + socket.connect (remote); + return this; + } + + public DatagramChannel disconnect () + throws IOException + { + socket.disconnect (); + return this; + } + + public boolean isConnected () + { + return socket.isConnected (); + } + + public int write (ByteBuffer src) + throws IOException + { + if (!isConnected ()) + throw new NotYetConnectedException (); + + return send (src, socket.getRemoteSocketAddress()); + } + + public long write (ByteBuffer[] srcs, int offset, int length) + throws IOException + { + if (!isConnected()) + throw new NotYetConnectedException(); + + if ((offset < 0) + || (offset > srcs.length) + || (length < 0) + || (length > (srcs.length - offset))) + throw new IndexOutOfBoundsException(); + + long result = 0; + + for (int index = offset; index < offset + length; index++) + result += write (srcs [index]); + + return result; + } + + public int read (ByteBuffer dst) + throws IOException + { + if (!isConnected ()) + throw new NotYetConnectedException (); + + int remaining = dst.remaining(); + receive (dst); + return remaining - dst.remaining(); + } + + public long read (ByteBuffer[] dsts, int offset, int length) + throws IOException + { + if (!isConnected()) + throw new NotYetConnectedException(); + + if ((offset < 0) + || (offset > dsts.length) + || (length < 0) + || (length > (dsts.length - offset))) + throw new IndexOutOfBoundsException(); + + long result = 0; + + for (int index = offset; index < offset + length; index++) + result += read (dsts [index]); + + return result; + } + + public SocketAddress receive (ByteBuffer dst) + throws IOException + { + if (!isOpen()) + throw new ClosedChannelException(); + + try + { + DatagramPacket packet; + int len = dst.remaining(); + + if (dst.hasArray()) + { + packet = new DatagramPacket (dst.array(), + dst.arrayOffset() + dst.position(), + len); + } + else + { + packet = new DatagramPacket (new byte [len], len); + } + + boolean completed = false; + + try + { + begin(); + setInChannelOperation(true); + socket.receive (packet); + completed = true; + } + finally + { + end (completed); + setInChannelOperation(false); + } + + if (!dst.hasArray()) + { + dst.put (packet.getData(), packet.getOffset(), packet.getLength()); + } + else + { + dst.position (dst.position() + packet.getLength()); + } + + return packet.getSocketAddress(); + } + catch (SocketTimeoutException e) + { + return null; + } + } + + public int send (ByteBuffer src, SocketAddress target) + throws IOException + { + if (!isOpen()) + throw new ClosedChannelException(); + + if (target instanceof InetSocketAddress + && ((InetSocketAddress) target).isUnresolved()) + throw new IOException("Target address not resolved"); + + byte[] buffer; + int offset = 0; + int len = src.remaining(); + + if (src.hasArray()) + { + buffer = src.array(); + offset = src.arrayOffset() + src.position(); + } + else + { + buffer = new byte [len]; + src.get (buffer); + } + + DatagramPacket packet = new DatagramPacket (buffer, offset, len, target); + + boolean completed = false; + try + { + begin(); + setInChannelOperation(true); + socket.send(packet); + completed = true; + } + finally + { + end (completed); + setInChannelOperation(false); + } + + if (src.hasArray()) + { + src.position (src.position() + len); + } + + return len; + } +} diff --git a/libjava/gnu/java/nio/DatagramChannelSelectionKey.h b/libjava/gnu/java/nio/DatagramChannelSelectionKey.h new file mode 100644 index 000000000..629eed378 --- /dev/null +++ b/libjava/gnu/java/nio/DatagramChannelSelectionKey.h @@ -0,0 +1,47 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_DatagramChannelSelectionKey__ +#define __gnu_java_nio_DatagramChannelSelectionKey__ + +#pragma interface + +#include <gnu/java/nio/SelectionKeyImpl.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class DatagramChannelSelectionKey; + class SelectorImpl; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + namespace spi + { + class AbstractSelectableChannel; + } + } + } + } +} + +class gnu::java::nio::DatagramChannelSelectionKey : public ::gnu::java::nio::SelectionKeyImpl +{ + +public: + DatagramChannelSelectionKey(::java::nio::channels::spi::AbstractSelectableChannel *, ::gnu::java::nio::SelectorImpl *); + jint getNativeFD(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_DatagramChannelSelectionKey__ diff --git a/libjava/gnu/java/nio/DatagramChannelSelectionKey.java b/libjava/gnu/java/nio/DatagramChannelSelectionKey.java new file mode 100644 index 000000000..81b87e548 --- /dev/null +++ b/libjava/gnu/java/nio/DatagramChannelSelectionKey.java @@ -0,0 +1,59 @@ +/* DatagramChannelSelectionKey.java -- + Copyright (C) 2003 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 gnu.java.nio; + +import java.nio.channels.spi.AbstractSelectableChannel; + +/** + * @author Michael Koch + */ +public final class DatagramChannelSelectionKey + extends SelectionKeyImpl +{ + public DatagramChannelSelectionKey (AbstractSelectableChannel channel, + SelectorImpl selector) + { + super (channel, selector); + } + + public int getNativeFD() + { + return ((DatagramChannelImpl) ch).getNativeFD(); + } +} diff --git a/libjava/gnu/java/nio/FileLockImpl.h b/libjava/gnu/java/nio/FileLockImpl.h new file mode 100644 index 000000000..ba1668be3 --- /dev/null +++ b/libjava/gnu/java/nio/FileLockImpl.h @@ -0,0 +1,44 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_FileLockImpl__ +#define __gnu_java_nio_FileLockImpl__ + +#pragma interface + +#include <java/nio/channels/FileLock.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class FileLockImpl; + namespace channels + { + class FileChannelImpl; + } + } + } + } +} + +class gnu::java::nio::FileLockImpl : public ::java::nio::channels::FileLock +{ + +public: + FileLockImpl(::gnu::java::nio::channels::FileChannelImpl *, jlong, jlong, jboolean); +public: // actually protected + void finalize(); +public: + jboolean isValid(); + void release(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::channels::FileLock)))) valid; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_FileLockImpl__ diff --git a/libjava/gnu/java/nio/FileLockImpl.java b/libjava/gnu/java/nio/FileLockImpl.java new file mode 100644 index 000000000..673ca2522 --- /dev/null +++ b/libjava/gnu/java/nio/FileLockImpl.java @@ -0,0 +1,104 @@ +/* FileLockImpl.java -- FileLock associated with a FileChannelImpl. + 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 gnu.java.nio; + +import gnu.java.nio.channels.FileChannelImpl; + +import java.io.IOException; +import java.nio.channels.FileLock; + +/** + * A FileLock associated with a FileChannelImpl. + * + * @author Michael Koch + * @since 1.4 + */ +public final class FileLockImpl extends FileLock +{ + /** + * Whether or not this lock is valid, false when channel is closed or + * release has been explicitly called. + */ + private boolean valid; + + public FileLockImpl (FileChannelImpl channel, long position, + long size, boolean shared) + { + super (channel, position, size, shared); + valid = true; + } + + /** + * Releases this lock. + */ + protected void finalize() + { + try + { + release(); + } + catch (IOException e) + { + // Ignore this. + } + } + + /** + * Whether or not this lock is valid, false when channel is closed or + * release has been explicitly called. + */ + public boolean isValid() + { + if (valid) + valid = channel().isOpen(); + return valid; + } + + /** + * Releases the lock if it is still valid. Marks this lock as invalid. + */ + public void release() throws IOException + { + if (isValid()) + { + valid = false; + ((FileChannelImpl) channel()).unlock(position(), size()); + } + } +} diff --git a/libjava/gnu/java/nio/InputStreamChannel.h b/libjava/gnu/java/nio/InputStreamChannel.h new file mode 100644 index 000000000..b6631695d --- /dev/null +++ b/libjava/gnu/java/nio/InputStreamChannel.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_InputStreamChannel__ +#define __gnu_java_nio_InputStreamChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class InputStreamChannel; + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + } + } +} + +class gnu::java::nio::InputStreamChannel : public ::java::lang::Object +{ + +public: + InputStreamChannel(::java::io::InputStream *); + void close(); + jboolean isOpen(); + jint read(::java::nio::ByteBuffer *); +private: + jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) closed; + ::java::io::InputStream * in; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_InputStreamChannel__ diff --git a/libjava/gnu/java/nio/NIOConstants.h b/libjava/gnu/java/nio/NIOConstants.h new file mode 100644 index 000000000..a27e4286d --- /dev/null +++ b/libjava/gnu/java/nio/NIOConstants.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_NIOConstants__ +#define __gnu_java_nio_NIOConstants__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class NIOConstants; + } + } + } +} + +class gnu::java::nio::NIOConstants : public ::java::lang::Object +{ + +public: + NIOConstants(); + static const jint DEFAULT_TIMEOUT = 50; + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_NIOConstants__ diff --git a/libjava/gnu/java/nio/NIODatagramSocket.h b/libjava/gnu/java/nio/NIODatagramSocket.h new file mode 100644 index 000000000..3e76ec9c4 --- /dev/null +++ b/libjava/gnu/java/nio/NIODatagramSocket.h @@ -0,0 +1,53 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_NIODatagramSocket__ +#define __gnu_java_nio_NIODatagramSocket__ + +#pragma interface + +#include <java/net/DatagramSocket.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace net + { + class PlainDatagramSocketImpl; + } + namespace nio + { + class DatagramChannelImpl; + class NIODatagramSocket; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class DatagramChannel; + } + } + } +} + +class gnu::java::nio::NIODatagramSocket : public ::java::net::DatagramSocket +{ + +public: + NIODatagramSocket(::gnu::java::net::PlainDatagramSocketImpl *, ::gnu::java::nio::DatagramChannelImpl *); + ::gnu::java::net::PlainDatagramSocketImpl * getPlainDatagramSocketImpl(); + ::java::nio::channels::DatagramChannel * getChannel(); +private: + ::gnu::java::net::PlainDatagramSocketImpl * __attribute__((aligned(__alignof__( ::java::net::DatagramSocket)))) impl; + ::gnu::java::nio::DatagramChannelImpl * channel; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_NIODatagramSocket__ diff --git a/libjava/gnu/java/nio/NIOServerSocket.h b/libjava/gnu/java/nio/NIOServerSocket.h new file mode 100644 index 000000000..908a664af --- /dev/null +++ b/libjava/gnu/java/nio/NIOServerSocket.h @@ -0,0 +1,58 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_NIOServerSocket__ +#define __gnu_java_nio_NIOServerSocket__ + +#pragma interface + +#include <java/net/ServerSocket.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace net + { + class PlainSocketImpl; + } + namespace nio + { + class NIOServerSocket; + class ServerSocketChannelImpl; + } + } + } + namespace java + { + namespace net + { + class Socket; + } + namespace nio + { + namespace channels + { + class ServerSocketChannel; + } + } + } +} + +class gnu::java::nio::NIOServerSocket : public ::java::net::ServerSocket +{ + +public: // actually protected + NIOServerSocket(::gnu::java::nio::ServerSocketChannelImpl *); +public: + ::gnu::java::net::PlainSocketImpl * getPlainSocketImpl(); + ::java::nio::channels::ServerSocketChannel * getChannel(); + ::java::net::Socket * accept(); +private: + ::gnu::java::nio::ServerSocketChannelImpl * __attribute__((aligned(__alignof__( ::java::net::ServerSocket)))) channel; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_NIOServerSocket__ diff --git a/libjava/gnu/java/nio/NIOServerSocket.java b/libjava/gnu/java/nio/NIOServerSocket.java new file mode 100644 index 000000000..0383e1a1a --- /dev/null +++ b/libjava/gnu/java/nio/NIOServerSocket.java @@ -0,0 +1,80 @@ +/* NIOServerSocket.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 gnu.java.nio; + +import gnu.java.net.PlainSocketImpl; + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.Socket; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; + +/** + * @author Michael Koch (konqueror@gmx.de) + */ +public final class NIOServerSocket extends ServerSocket +{ + private ServerSocketChannelImpl channel; + + protected NIOServerSocket (ServerSocketChannelImpl channel) + throws IOException + { + super(); + this.channel = channel; + } + + public native PlainSocketImpl getPlainSocketImpl(); + + public ServerSocketChannel getChannel() + { + return channel; + } + + public Socket accept() throws IOException + { + SecurityManager sm = System.getSecurityManager(); + if (sm != null) + sm.checkListen (getLocalPort()); + + SocketChannel socketChannel = channel.provider().openSocketChannel(); + implAccept (socketChannel.socket()); + return socketChannel.socket(); + } +} diff --git a/libjava/gnu/java/nio/NIOSocket.h b/libjava/gnu/java/nio/NIOSocket.h new file mode 100644 index 000000000..b987a6c9e --- /dev/null +++ b/libjava/gnu/java/nio/NIOSocket.h @@ -0,0 +1,57 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_NIOSocket__ +#define __gnu_java_nio_NIOSocket__ + +#pragma interface + +#include <java/net/Socket.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace net + { + class PlainSocketImpl; + } + namespace nio + { + class NIOSocket; + class SocketChannelImpl; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class SocketChannel; + } + } + } +} + +class gnu::java::nio::NIOSocket : public ::java::net::Socket +{ + +public: // actually protected + NIOSocket(::gnu::java::net::PlainSocketImpl *, ::gnu::java::nio::SocketChannelImpl *); +public: + ::gnu::java::net::PlainSocketImpl * getPlainSocketImpl(); +public: // actually package-private + void setChannel(::gnu::java::nio::SocketChannelImpl *); +public: + ::java::nio::channels::SocketChannel * getChannel(); +private: + ::gnu::java::net::PlainSocketImpl * __attribute__((aligned(__alignof__( ::java::net::Socket)))) impl; + ::gnu::java::nio::SocketChannelImpl * channel; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_NIOSocket__ diff --git a/libjava/gnu/java/nio/NIOSocket.java b/libjava/gnu/java/nio/NIOSocket.java new file mode 100644 index 000000000..4d812bf44 --- /dev/null +++ b/libjava/gnu/java/nio/NIOSocket.java @@ -0,0 +1,77 @@ +/* NIOSocket.java -- + Copyright (C) 2003 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 gnu.java.nio; + +import gnu.java.net.PlainSocketImpl; +import java.io.IOException; +import java.net.Socket; +import java.nio.channels.SocketChannel; + +/** + * @author Michael Koch + */ +public final class NIOSocket extends Socket +{ + private PlainSocketImpl impl; + private SocketChannelImpl channel; + + protected NIOSocket (PlainSocketImpl impl, SocketChannelImpl channel) + throws IOException + { + super (impl); + this.impl = impl; + this.channel = channel; + } + + public final PlainSocketImpl getPlainSocketImpl() + { + return impl; + } + + final void setChannel (SocketChannelImpl channel) + { + this.impl = channel.getPlainSocketImpl(); + this.channel = channel; + } + + public final SocketChannel getChannel() + { + return channel; + } +} diff --git a/libjava/gnu/java/nio/OutputStreamChannel.h b/libjava/gnu/java/nio/OutputStreamChannel.h new file mode 100644 index 000000000..3a47ab97b --- /dev/null +++ b/libjava/gnu/java/nio/OutputStreamChannel.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_OutputStreamChannel__ +#define __gnu_java_nio_OutputStreamChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class OutputStreamChannel; + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + } + } +} + +class gnu::java::nio::OutputStreamChannel : public ::java::lang::Object +{ + +public: + OutputStreamChannel(::java::io::OutputStream *); + void close(); + jboolean isOpen(); + jint write(::java::nio::ByteBuffer *); +private: + jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) closed; + ::java::io::OutputStream * out; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_OutputStreamChannel__ diff --git a/libjava/gnu/java/nio/PipeImpl$SinkChannelImpl.h b/libjava/gnu/java/nio/PipeImpl$SinkChannelImpl.h new file mode 100644 index 000000000..648de594b --- /dev/null +++ b/libjava/gnu/java/nio/PipeImpl$SinkChannelImpl.h @@ -0,0 +1,61 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_PipeImpl$SinkChannelImpl__ +#define __gnu_java_nio_PipeImpl$SinkChannelImpl__ + +#pragma interface + +#include <java/nio/channels/Pipe$SinkChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class PipeImpl$SinkChannelImpl; + class VMChannel; + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::PipeImpl$SinkChannelImpl : public ::java::nio::channels::Pipe$SinkChannel +{ + +public: + PipeImpl$SinkChannelImpl(::java::nio::channels::spi::SelectorProvider *, jint); +public: // actually protected + void implCloseSelectableChannel(); + void implConfigureBlocking(jboolean); +public: + jint write(::java::nio::ByteBuffer *); + jlong write(JArray< ::java::nio::ByteBuffer * > *); + jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + jint getNativeFD(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::channels::Pipe$SinkChannel)))) native_fd; + ::gnu::java::nio::VMChannel * vmch; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_PipeImpl$SinkChannelImpl__ diff --git a/libjava/gnu/java/nio/PipeImpl$SourceChannelImpl.h b/libjava/gnu/java/nio/PipeImpl$SourceChannelImpl.h new file mode 100644 index 000000000..fdc744bbf --- /dev/null +++ b/libjava/gnu/java/nio/PipeImpl$SourceChannelImpl.h @@ -0,0 +1,61 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_PipeImpl$SourceChannelImpl__ +#define __gnu_java_nio_PipeImpl$SourceChannelImpl__ + +#pragma interface + +#include <java/nio/channels/Pipe$SourceChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class PipeImpl$SourceChannelImpl; + class VMChannel; + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::PipeImpl$SourceChannelImpl : public ::java::nio::channels::Pipe$SourceChannel +{ + +public: + PipeImpl$SourceChannelImpl(::java::nio::channels::spi::SelectorProvider *, jint); +public: // actually protected + void implCloseSelectableChannel(); + void implConfigureBlocking(jboolean); +public: + jint read(::java::nio::ByteBuffer *); + jlong read(JArray< ::java::nio::ByteBuffer * > *); + jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + jint getNativeFD(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::channels::Pipe$SourceChannel)))) native_fd; + ::gnu::java::nio::VMChannel * vmch; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_PipeImpl$SourceChannelImpl__ diff --git a/libjava/gnu/java/nio/PipeImpl.h b/libjava/gnu/java/nio/PipeImpl.h new file mode 100644 index 000000000..63bfafb56 --- /dev/null +++ b/libjava/gnu/java/nio/PipeImpl.h @@ -0,0 +1,55 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_PipeImpl__ +#define __gnu_java_nio_PipeImpl__ + +#pragma interface + +#include <java/nio/channels/Pipe.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class PipeImpl; + class PipeImpl$SinkChannelImpl; + class PipeImpl$SourceChannelImpl; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class Pipe$SinkChannel; + class Pipe$SourceChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::PipeImpl : public ::java::nio::channels::Pipe +{ + +public: + PipeImpl(::java::nio::channels::spi::SelectorProvider *); + virtual ::java::nio::channels::Pipe$SinkChannel * sink(); + virtual ::java::nio::channels::Pipe$SourceChannel * source(); +private: + ::gnu::java::nio::PipeImpl$SinkChannelImpl * __attribute__((aligned(__alignof__( ::java::nio::channels::Pipe)))) sink__; + ::gnu::java::nio::PipeImpl$SourceChannelImpl * source__; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_PipeImpl__ diff --git a/libjava/gnu/java/nio/PipeImpl.java b/libjava/gnu/java/nio/PipeImpl.java new file mode 100644 index 000000000..cccaa3988 --- /dev/null +++ b/libjava/gnu/java/nio/PipeImpl.java @@ -0,0 +1,178 @@ +/* PipeImpl.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 gnu.java.nio; + + +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.channels.Pipe; +import java.nio.channels.spi.SelectorProvider; + +class PipeImpl extends Pipe +{ + public static final class SourceChannelImpl extends Pipe.SourceChannel + { + private int native_fd; + private VMChannel vmch; + + public SourceChannelImpl (SelectorProvider selectorProvider, + int native_fd) + { + super (selectorProvider); + this.native_fd = native_fd; + vmch = VMChannel.getVMChannel(this); + } + + protected final void implCloseSelectableChannel() + throws IOException + { + throw new Error ("Not implemented"); + } + + protected void implConfigureBlocking (boolean blocking) + throws IOException + { + vmch.setBlocking(blocking); + } + + public final int read (ByteBuffer src) + throws IOException + { + return vmch.read(src); + } + + public final long read (ByteBuffer[] srcs) + throws IOException + { + return vmch.readScattering(srcs, 0, srcs.length); + } + + public final synchronized long read (ByteBuffer[] srcs, int offset, + int len) + throws IOException + { + if (offset < 0 + || offset > srcs.length + || len < 0 + || len > srcs.length - offset) + throw new IndexOutOfBoundsException(); + + return vmch.readScattering(srcs, offset, len); + } + + public final int getNativeFD() + { + return native_fd; + } + } + + public static final class SinkChannelImpl extends Pipe.SinkChannel + { + private int native_fd; + private VMChannel vmch; + + public SinkChannelImpl (SelectorProvider selectorProvider, + int native_fd) + { + super (selectorProvider); + this.native_fd = native_fd; + vmch = VMChannel.getVMChannel(this); + } + + protected final void implCloseSelectableChannel() + throws IOException + { + throw new Error ("Not implemented"); + } + + protected final void implConfigureBlocking (boolean blocking) + throws IOException + { + vmch.setBlocking(blocking); + } + + public final int write (ByteBuffer dst) + throws IOException + { + return vmch.write(dst); + } + + public final long write (ByteBuffer[] srcs) + throws IOException + { + return vmch.writeGathering(srcs, 0, srcs.length); + } + + public final synchronized long write (ByteBuffer[] srcs, int offset, int len) + throws IOException + { + if (offset < 0 + || offset > srcs.length + || len < 0 + || len > srcs.length - offset) + throw new IndexOutOfBoundsException(); + + return vmch.writeGathering(srcs, offset, len); + } + + public final int getNativeFD() + { + return native_fd; + } + } + + private SinkChannelImpl sink; + private SourceChannelImpl source; + + public PipeImpl (SelectorProvider provider) + throws IOException + { + super(); + VMPipe.init (this, provider); + } + + public Pipe.SinkChannel sink() + { + return sink; + } + + public Pipe.SourceChannel source() + { + return source; + } +} diff --git a/libjava/gnu/java/nio/SelectionKeyImpl.h b/libjava/gnu/java/nio/SelectionKeyImpl.h new file mode 100644 index 000000000..29e0dca2c --- /dev/null +++ b/libjava/gnu/java/nio/SelectionKeyImpl.h @@ -0,0 +1,59 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_SelectionKeyImpl__ +#define __gnu_java_nio_SelectionKeyImpl__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelectionKey.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class SelectionKeyImpl; + class SelectorImpl; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class SelectableChannel; + class SelectionKey; + class Selector; + } + } + } +} + +class gnu::java::nio::SelectionKeyImpl : public ::java::nio::channels::spi::AbstractSelectionKey +{ + +public: + SelectionKeyImpl(::java::nio::channels::SelectableChannel *, ::gnu::java::nio::SelectorImpl *); + virtual ::java::nio::channels::SelectableChannel * channel(); + virtual jint readyOps(); + virtual ::java::nio::channels::SelectionKey * readyOps(jint); + virtual jint interestOps(); + virtual ::java::nio::channels::SelectionKey * interestOps(jint); + virtual ::java::nio::channels::Selector * selector(); + virtual jint getNativeFD() = 0; +private: + jint __attribute__((aligned(__alignof__( ::java::nio::channels::spi::AbstractSelectionKey)))) readyOps__; + jint interestOps__; + ::gnu::java::nio::SelectorImpl * impl; +public: // actually package-private + ::java::nio::channels::SelectableChannel * ch; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_SelectionKeyImpl__ diff --git a/libjava/gnu/java/nio/SelectorImpl.h b/libjava/gnu/java/nio/SelectorImpl.h new file mode 100644 index 000000000..5db33c8aa --- /dev/null +++ b/libjava/gnu/java/nio/SelectorImpl.h @@ -0,0 +1,76 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_SelectorImpl__ +#define __gnu_java_nio_SelectorImpl__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelector.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class SelectorImpl; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class SelectableChannel; + class SelectionKey; + class Selector; + namespace spi + { + class AbstractSelectableChannel; + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::SelectorImpl : public ::java::nio::channels::spi::AbstractSelector +{ + +public: + SelectorImpl(::java::nio::channels::spi::SelectorProvider *); +public: // actually protected + virtual void finalize(); + virtual void implCloseSelector(); +public: + virtual ::java::util::Set * keys(); + virtual jint selectNow(); + virtual jint select(); +private: + JArray< jint > * getFDsAsArray(jint); +public: + virtual jint select(jlong); + virtual ::java::util::Set * selectedKeys(); + virtual ::java::nio::channels::Selector * wakeup(); +private: + void deregisterCancelledKeys(); +public: // actually protected + virtual ::java::nio::channels::SelectionKey * register$(::java::nio::channels::SelectableChannel *, jint, ::java::lang::Object *); + virtual ::java::nio::channels::SelectionKey * register$(::java::nio::channels::spi::AbstractSelectableChannel *, jint, ::java::lang::Object *); +private: + ::java::util::Set * __attribute__((aligned(__alignof__( ::java::nio::channels::spi::AbstractSelector)))) keys__; + ::java::util::Set * selected; + ::java::lang::Object * selectThreadMutex; + ::java::lang::Thread * selectThread; + jboolean unhandledWakeup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_SelectorImpl__ diff --git a/libjava/gnu/java/nio/SelectorProviderImpl.h b/libjava/gnu/java/nio/SelectorProviderImpl.h new file mode 100644 index 000000000..e2ad8e41d --- /dev/null +++ b/libjava/gnu/java/nio/SelectorProviderImpl.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_SelectorProviderImpl__ +#define __gnu_java_nio_SelectorProviderImpl__ + +#pragma interface + +#include <java/nio/channels/spi/SelectorProvider.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class SelectorProviderImpl; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class DatagramChannel; + class Pipe; + class ServerSocketChannel; + class SocketChannel; + namespace spi + { + class AbstractSelector; + } + } + } + } +} + +class gnu::java::nio::SelectorProviderImpl : public ::java::nio::channels::spi::SelectorProvider +{ + +public: + SelectorProviderImpl(); + virtual ::java::nio::channels::DatagramChannel * openDatagramChannel(); + virtual ::java::nio::channels::Pipe * openPipe(); + virtual ::java::nio::channels::spi::AbstractSelector * openSelector(); + virtual ::java::nio::channels::ServerSocketChannel * openServerSocketChannel(); + virtual ::java::nio::channels::SocketChannel * openSocketChannel(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_SelectorProviderImpl__ diff --git a/libjava/gnu/java/nio/SelectorProviderImpl.java b/libjava/gnu/java/nio/SelectorProviderImpl.java new file mode 100644 index 000000000..03da80e69 --- /dev/null +++ b/libjava/gnu/java/nio/SelectorProviderImpl.java @@ -0,0 +1,84 @@ +/* SelectorProviderImpl.java -- + Copyright (C) 2002, 2003 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 gnu.java.nio; + +import java.io.IOException; +import java.nio.channels.DatagramChannel; +import java.nio.channels.Pipe; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.nio.channels.spi.AbstractSelector; +import java.nio.channels.spi.SelectorProvider; + +public class SelectorProviderImpl extends SelectorProvider +{ + public SelectorProviderImpl () + { + } + + public DatagramChannel openDatagramChannel () + throws IOException + { + return new DatagramChannelImpl (this); + } + + public Pipe openPipe () + throws IOException + { + return new PipeImpl (this); + } + + public AbstractSelector openSelector () + throws IOException + { + return new SelectorImpl (this); + } + + public ServerSocketChannel openServerSocketChannel () + throws IOException + { + return new ServerSocketChannelImpl (this); + } + + public SocketChannel openSocketChannel () + throws IOException + { + return new SocketChannelImpl (this); + } + +} diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.h b/libjava/gnu/java/nio/ServerSocketChannelImpl.h new file mode 100644 index 000000000..28f6d9811 --- /dev/null +++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.h @@ -0,0 +1,64 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_ServerSocketChannelImpl__ +#define __gnu_java_nio_ServerSocketChannelImpl__ + +#pragma interface + +#include <java/nio/channels/ServerSocketChannel.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class NIOServerSocket; + class ServerSocketChannelImpl; + } + } + } + namespace java + { + namespace net + { + class ServerSocket; + } + namespace nio + { + namespace channels + { + class SocketChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::ServerSocketChannelImpl : public ::java::nio::channels::ServerSocketChannel +{ + +public: // actually protected + ServerSocketChannelImpl(::java::nio::channels::spi::SelectorProvider *); +public: + jint getNativeFD(); + void finalizer(); +public: // actually protected + void implCloseSelectableChannel(); + void implConfigureBlocking(jboolean); +public: + ::java::nio::channels::SocketChannel * accept(); + ::java::net::ServerSocket * socket(); +private: + ::gnu::java::nio::NIOServerSocket * __attribute__((aligned(__alignof__( ::java::nio::channels::ServerSocketChannel)))) serverSocket; + jboolean connected; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_ServerSocketChannelImpl__ diff --git a/libjava/gnu/java/nio/ServerSocketChannelImpl.java b/libjava/gnu/java/nio/ServerSocketChannelImpl.java new file mode 100644 index 000000000..8b9499c89 --- /dev/null +++ b/libjava/gnu/java/nio/ServerSocketChannelImpl.java @@ -0,0 +1,129 @@ +/* ServerSocketChannelImpl.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 gnu.java.nio; + +import java.io.IOException; +import java.net.ServerSocket; +import java.net.SocketTimeoutException; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.NotYetBoundException; +import java.nio.channels.ServerSocketChannel; +import java.nio.channels.SocketChannel; +import java.nio.channels.spi.SelectorProvider; + +public final class ServerSocketChannelImpl extends ServerSocketChannel +{ + private NIOServerSocket serverSocket; + private boolean connected; + + protected ServerSocketChannelImpl (SelectorProvider provider) + throws IOException + { + super (provider); + serverSocket = new NIOServerSocket (this); + configureBlocking(true); + } + + public int getNativeFD() + { + return serverSocket.getPlainSocketImpl().getNativeFD(); + } + + public void finalizer() + { + if (connected) + { + try + { + close (); + } + catch (Exception e) + { + } + } + } + + protected void implCloseSelectableChannel () throws IOException + { + connected = false; + serverSocket.close(); + } + + protected void implConfigureBlocking (boolean blocking) throws IOException + { + serverSocket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); + } + + public SocketChannel accept () throws IOException + { + if (!isOpen()) + throw new ClosedChannelException(); + + if (!serverSocket.isBound()) + throw new NotYetBoundException(); + + boolean completed = false; + + try + { + begin(); + serverSocket.getPlainSocketImpl().setInChannelOperation(true); + // indicate that a channel is initiating the accept operation + // so that the socket ignores the fact that we might be in + // non-blocking mode. + NIOSocket socket = (NIOSocket) serverSocket.accept(); + completed = true; + return socket.getChannel(); + } + catch (SocketTimeoutException e) + { + return null; + } + finally + { + serverSocket.getPlainSocketImpl().setInChannelOperation(false); + end (completed); + } + } + + public ServerSocket socket () + { + return serverSocket; + } +} diff --git a/libjava/gnu/java/nio/ServerSocketChannelSelectionKey.h b/libjava/gnu/java/nio/ServerSocketChannelSelectionKey.h new file mode 100644 index 000000000..43e35932c --- /dev/null +++ b/libjava/gnu/java/nio/ServerSocketChannelSelectionKey.h @@ -0,0 +1,47 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_ServerSocketChannelSelectionKey__ +#define __gnu_java_nio_ServerSocketChannelSelectionKey__ + +#pragma interface + +#include <gnu/java/nio/SelectionKeyImpl.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class SelectorImpl; + class ServerSocketChannelSelectionKey; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + namespace spi + { + class AbstractSelectableChannel; + } + } + } + } +} + +class gnu::java::nio::ServerSocketChannelSelectionKey : public ::gnu::java::nio::SelectionKeyImpl +{ + +public: + ServerSocketChannelSelectionKey(::java::nio::channels::spi::AbstractSelectableChannel *, ::gnu::java::nio::SelectorImpl *); + jint getNativeFD(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_ServerSocketChannelSelectionKey__ diff --git a/libjava/gnu/java/nio/ServerSocketChannelSelectionKey.java b/libjava/gnu/java/nio/ServerSocketChannelSelectionKey.java new file mode 100644 index 000000000..aa329000d --- /dev/null +++ b/libjava/gnu/java/nio/ServerSocketChannelSelectionKey.java @@ -0,0 +1,56 @@ +/* ServerSocketChannelSelectionKey.java -- + Copyright (C) 2003 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 gnu.java.nio; + +import java.nio.channels.spi.AbstractSelectableChannel; + +public final class ServerSocketChannelSelectionKey + extends SelectionKeyImpl +{ + public ServerSocketChannelSelectionKey (AbstractSelectableChannel channel, + SelectorImpl selector) + { + super (channel, selector); + } + + public int getNativeFD() + { + return ((ServerSocketChannelImpl) ch).getNativeFD(); + } +} diff --git a/libjava/gnu/java/nio/SocketChannelImpl.h b/libjava/gnu/java/nio/SocketChannelImpl.h new file mode 100644 index 000000000..b180918d6 --- /dev/null +++ b/libjava/gnu/java/nio/SocketChannelImpl.h @@ -0,0 +1,82 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_SocketChannelImpl__ +#define __gnu_java_nio_SocketChannelImpl__ + +#pragma interface + +#include <java/nio/channels/SocketChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace net + { + class PlainSocketImpl; + } + namespace nio + { + class NIOSocket; + class SocketChannelImpl; + } + } + } + namespace java + { + namespace net + { + class Socket; + class SocketAddress; + } + namespace nio + { + class ByteBuffer; + namespace channels + { + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::SocketChannelImpl : public ::java::nio::channels::SocketChannel +{ + +public: // actually package-private + SocketChannelImpl(::java::nio::channels::spi::SelectorProvider *); + SocketChannelImpl(::java::nio::channels::spi::SelectorProvider *, ::gnu::java::nio::NIOSocket *); +public: + void finalizer(); +public: // actually package-private + ::gnu::java::net::PlainSocketImpl * getPlainSocketImpl(); + jint getNativeFD(); +public: // actually protected + void implCloseSelectableChannel(); + void implConfigureBlocking(jboolean); +public: + jboolean connect(::java::net::SocketAddress *); + jboolean finishConnect(); + jboolean isConnected(); + jboolean isConnectionPending(); + ::java::net::Socket * socket(); + jint read(::java::nio::ByteBuffer *); + jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + jint write(::java::nio::ByteBuffer *); + jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint); +private: + ::gnu::java::net::PlainSocketImpl * __attribute__((aligned(__alignof__( ::java::nio::channels::SocketChannel)))) impl; + ::gnu::java::nio::NIOSocket * socket__; + jboolean connectionPending; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_SocketChannelImpl__ diff --git a/libjava/gnu/java/nio/SocketChannelImpl.java b/libjava/gnu/java/nio/SocketChannelImpl.java new file mode 100644 index 000000000..5925712be --- /dev/null +++ b/libjava/gnu/java/nio/SocketChannelImpl.java @@ -0,0 +1,357 @@ +/* SocketChannelImpl.java -- + Copyright (C) 2002, 2003, 2004, 2006, 2007 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 gnu.java.nio; + +import gnu.java.net.PlainSocketImpl; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.InetSocketAddress; +import java.net.Socket; +import java.net.SocketAddress; +import java.net.SocketTimeoutException; +import java.nio.ByteBuffer; +import java.nio.channels.AlreadyConnectedException; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.ConnectionPendingException; +import java.nio.channels.NoConnectionPendingException; +import java.nio.channels.NotYetConnectedException; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.SocketChannel; +import java.nio.channels.UnresolvedAddressException; +import java.nio.channels.UnsupportedAddressTypeException; +import java.nio.channels.spi.SelectorProvider; + +public final class SocketChannelImpl extends SocketChannel +{ + private PlainSocketImpl impl; + private NIOSocket socket; + private boolean connectionPending; + + SocketChannelImpl (SelectorProvider provider) + throws IOException + { + super (provider); + impl = new PlainSocketImpl(); + impl.create(true); + socket = new NIOSocket (impl, this); + configureBlocking(true); + } + + SocketChannelImpl (SelectorProvider provider, + NIOSocket socket) + throws IOException + { + super (provider); + this.impl = socket.getPlainSocketImpl(); + this.socket = socket; + } + + public void finalizer() + { + if (isConnected()) + { + try + { + close (); + } + catch (Exception e) + { + } + } + } + + PlainSocketImpl getPlainSocketImpl() + { + return impl; + } + + int getNativeFD() + { + return socket.getPlainSocketImpl().getNativeFD(); + } + + protected void implCloseSelectableChannel () throws IOException + { + socket.close(); + } + + protected void implConfigureBlocking (boolean blocking) throws IOException + { + socket.setSoTimeout (blocking ? 0 : NIOConstants.DEFAULT_TIMEOUT); + } + + public boolean connect (SocketAddress remote) throws IOException + { + if (!isOpen()) + throw new ClosedChannelException(); + + if (isConnected()) + throw new AlreadyConnectedException(); + + if (connectionPending) + throw new ConnectionPendingException(); + + if (!(remote instanceof InetSocketAddress)) + throw new UnsupportedAddressTypeException(); + + if (((InetSocketAddress) remote).isUnresolved()) + throw new UnresolvedAddressException(); + + try + { + socket.getPlainSocketImpl().setInChannelOperation(true); + // indicate that a channel is initiating the accept operation + // so that the socket ignores the fact that we might be in + // non-blocking mode. + + if (isBlocking()) + { + // Do blocking connect. + socket.connect (remote); + return true; + } + + // Do non-blocking connect. + try + { + socket.connect (remote, NIOConstants.DEFAULT_TIMEOUT); + return true; + } + catch (SocketTimeoutException e) + { + connectionPending = true; + return false; + } + } + finally + { + socket.getPlainSocketImpl().setInChannelOperation(false); + } + } + + public boolean finishConnect () + throws IOException + { + if (!isOpen()) + throw new ClosedChannelException(); + + if (!isConnected() && !connectionPending) + throw new NoConnectionPendingException(); + + if (isConnected()) + return true; + + // FIXME: Handle blocking/non-blocking mode. + + Selector selector = provider().openSelector(); + register(selector, SelectionKey.OP_CONNECT); + + if (isBlocking()) + { + selector.select(); // blocking until channel is connected. + connectionPending = false; + return true; + } + + int ready = selector.selectNow(); // non-blocking + if (ready == 1) + { + connectionPending = false; + return true; + } + + return false; + } + + public boolean isConnected () + { + return socket.isConnected(); + } + + public boolean isConnectionPending () + { + return connectionPending; + } + + public Socket socket () + { + return socket; + } + + public int read(ByteBuffer dst) throws IOException + { + if (!isConnected()) + throw new NotYetConnectedException(); + + byte[] data; + int offset = 0; + InputStream input = socket.getInputStream(); + int available = input.available(); + int len = dst.remaining(); + + if ((! isBlocking()) && available == 0) + return 0; + + if (dst.hasArray()) + { + offset = dst.arrayOffset() + dst.position(); + data = dst.array(); + } + else + { + data = new byte [len]; + } + + int readBytes = 0; + boolean completed = false; + + try + { + begin(); + socket.getPlainSocketImpl().setInChannelOperation(true); + readBytes = input.read (data, offset, len); + completed = true; + } + finally + { + end (completed); + socket.getPlainSocketImpl().setInChannelOperation(false); + } + + if (readBytes > 0) + if (dst.hasArray()) + { + dst.position (dst.position() + readBytes); + } + else + { + dst.put (data, offset, readBytes); + } + + return readBytes; + } + + public long read (ByteBuffer[] dsts, int offset, int length) + throws IOException + { + if (!isConnected()) + throw new NotYetConnectedException(); + + if ((offset < 0) + || (offset > dsts.length) + || (length < 0) + || (length > (dsts.length - offset))) + throw new IndexOutOfBoundsException(); + + long readBytes = 0; + + for (int index = offset; index < length; index++) + readBytes += read (dsts [index]); + + return readBytes; + } + + public int write (ByteBuffer src) + throws IOException + { + if (!isConnected()) + throw new NotYetConnectedException(); + + byte[] data; + int offset = 0; + int len = src.remaining(); + + if (!src.hasArray()) + { + data = new byte [len]; + src.get (data, 0, len); + } + else + { + offset = src.arrayOffset() + src.position(); + data = src.array(); + } + + OutputStream output = socket.getOutputStream(); + boolean completed = false; + + try + { + begin(); + socket.getPlainSocketImpl().setInChannelOperation(true); + output.write (data, offset, len); + completed = true; + } + finally + { + end (completed); + socket.getPlainSocketImpl().setInChannelOperation(false); + } + + if (src.hasArray()) + { + src.position (src.position() + len); + } + + return len; + } + + public long write (ByteBuffer[] srcs, int offset, int length) + throws IOException + { + if (!isConnected()) + throw new NotYetConnectedException(); + + if ((offset < 0) + || (offset > srcs.length) + || (length < 0) + || (length > (srcs.length - offset))) + throw new IndexOutOfBoundsException(); + + long writtenBytes = 0; + + for (int index = offset; index < length; index++) + writtenBytes += write (srcs [index]); + + return writtenBytes; + } +} diff --git a/libjava/gnu/java/nio/SocketChannelSelectionKey.h b/libjava/gnu/java/nio/SocketChannelSelectionKey.h new file mode 100644 index 000000000..f9d5f297f --- /dev/null +++ b/libjava/gnu/java/nio/SocketChannelSelectionKey.h @@ -0,0 +1,47 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_SocketChannelSelectionKey__ +#define __gnu_java_nio_SocketChannelSelectionKey__ + +#pragma interface + +#include <gnu/java/nio/SelectionKeyImpl.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class SelectorImpl; + class SocketChannelSelectionKey; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + namespace spi + { + class AbstractSelectableChannel; + } + } + } + } +} + +class gnu::java::nio::SocketChannelSelectionKey : public ::gnu::java::nio::SelectionKeyImpl +{ + +public: + SocketChannelSelectionKey(::java::nio::channels::spi::AbstractSelectableChannel *, ::gnu::java::nio::SelectorImpl *); + jint getNativeFD(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_SocketChannelSelectionKey__ diff --git a/libjava/gnu/java/nio/SocketChannelSelectionKey.java b/libjava/gnu/java/nio/SocketChannelSelectionKey.java new file mode 100644 index 000000000..75b4dfd87 --- /dev/null +++ b/libjava/gnu/java/nio/SocketChannelSelectionKey.java @@ -0,0 +1,58 @@ +/* SocketChannelSelectionKey.java -- + Copyright (C) 2003 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 gnu.java.nio; + +import java.nio.channels.spi.AbstractSelectableChannel; + +public final class SocketChannelSelectionKey + extends SelectionKeyImpl +{ + public SocketChannelSelectionKey (AbstractSelectableChannel channel, + SelectorImpl selector) + { + super (channel, selector); + } + + public int getNativeFD() + { + NIOSocket socket = + (NIOSocket) ((SocketChannelImpl) ch).socket(); + return socket.getPlainSocketImpl().getNativeFD(); + } +} diff --git a/libjava/gnu/java/nio/SocketChannelSelectionKeyImpl.h b/libjava/gnu/java/nio/SocketChannelSelectionKeyImpl.h new file mode 100644 index 000000000..b3ab4900f --- /dev/null +++ b/libjava/gnu/java/nio/SocketChannelSelectionKeyImpl.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_SocketChannelSelectionKeyImpl__ +#define __gnu_java_nio_SocketChannelSelectionKeyImpl__ + +#pragma interface + +#include <gnu/java/nio/SelectionKeyImpl.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class SelectorImpl; + class SocketChannelImpl; + class SocketChannelSelectionKeyImpl; + } + } + } +} + +class gnu::java::nio::SocketChannelSelectionKeyImpl : public ::gnu::java::nio::SelectionKeyImpl +{ + +public: + SocketChannelSelectionKeyImpl(::gnu::java::nio::SocketChannelImpl *, ::gnu::java::nio::SelectorImpl *); + virtual jint getNativeFD(); +public: // actually package-private + ::gnu::java::nio::SocketChannelImpl * __attribute__((aligned(__alignof__( ::gnu::java::nio::SelectionKeyImpl)))) ch; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_SocketChannelSelectionKeyImpl__ diff --git a/libjava/gnu/java/nio/SocketChannelSelectionKeyImpl.java b/libjava/gnu/java/nio/SocketChannelSelectionKeyImpl.java new file mode 100644 index 000000000..30fb2dfba --- /dev/null +++ b/libjava/gnu/java/nio/SocketChannelSelectionKeyImpl.java @@ -0,0 +1,69 @@ +/* SocketChannelSelectionKey.java -- Selection key for Socket Channel + Copyright (C) 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 gnu.java.nio; + + +/** + * @author Michael Barker <mike@middlesoft.co.uk> + * + */ +public class SocketChannelSelectionKeyImpl extends SelectionKeyImpl +{ + + SocketChannelImpl ch; + + /** + * @param ch + * @param impl + */ + public SocketChannelSelectionKeyImpl(SocketChannelImpl ch, SelectorImpl impl) + { + super(ch, impl); + this.ch = (SocketChannelImpl) ch; + } + + /** + * Returns the native file/socket descriptor as an int. + */ + public int getNativeFD() + { + return ch.getPlainSocketImpl().getNativeFD(); + } + +} diff --git a/libjava/gnu/java/nio/VMChannel.h b/libjava/gnu/java/nio/VMChannel.h new file mode 100644 index 000000000..288805137 --- /dev/null +++ b/libjava/gnu/java/nio/VMChannel.h @@ -0,0 +1,77 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_VMChannel__ +#define __gnu_java_nio_VMChannel__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace net + { + class PlainSocketImpl; + } + namespace nio + { + class PipeImpl$SinkChannelImpl; + class PipeImpl$SourceChannelImpl; + class VMChannel; + namespace channels + { + class FileChannelImpl; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + } + } +} + +class gnu::java::nio::VMChannel : public ::java::lang::Object +{ + + VMChannel(jint); +public: + static ::gnu::java::nio::VMChannel * getVMChannel(::gnu::java::net::PlainSocketImpl *); + static ::gnu::java::nio::VMChannel * getVMChannel(::gnu::java::nio::PipeImpl$SourceChannelImpl *); + static ::gnu::java::nio::VMChannel * getVMChannel(::gnu::java::nio::PipeImpl$SinkChannelImpl *); + static ::gnu::java::nio::VMChannel * getVMChannel(::gnu::java::nio::channels::FileChannelImpl *); + virtual void setBlocking(jint, jboolean); + virtual void setBlocking(jboolean); +public: // actually package-private + virtual jint read(jint, ::java::nio::ByteBuffer *); +public: + virtual jint read(::java::nio::ByteBuffer *); +public: // actually package-private + virtual jlong readScattering(jint, JArray< ::java::nio::ByteBuffer * > *, jint, jint); +public: + virtual jlong readScattering(JArray< ::java::nio::ByteBuffer * > *, jint, jint); +public: // actually package-private + virtual jint write(jint, ::java::nio::ByteBuffer *); +public: + virtual jint write(::java::nio::ByteBuffer *); +public: // actually package-private + virtual jlong writeGathering(jint, JArray< ::java::nio::ByteBuffer * > *, jint, jint); +public: + virtual jlong writeGathering(JArray< ::java::nio::ByteBuffer * > *, jint, jint); +private: + static void initIDs(); + jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) fd; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_VMChannel__ diff --git a/libjava/gnu/java/nio/VMChannel.java b/libjava/gnu/java/nio/VMChannel.java new file mode 100644 index 000000000..fdea8ff62 --- /dev/null +++ b/libjava/gnu/java/nio/VMChannel.java @@ -0,0 +1,197 @@ +/* VMChannel.java -- Native interface suppling channel operations. + Copyright (C) 2006 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 gnu.java.nio; + +import gnu.classpath.Configuration; +import gnu.java.net.PlainSocketImpl; +import gnu.java.nio.PipeImpl.SinkChannelImpl; +import gnu.java.nio.PipeImpl.SourceChannelImpl; +import gnu.java.nio.channels.FileChannelImpl; + +import java.io.IOException; +import java.nio.ByteBuffer; + +/** + * Native interface to support configuring of channel to run in a non-blocking + * manner and support scatter/gather io operations. + * + * @author Michael Barker <mike@middlesoft.co.uk> + * + */ +public class VMChannel +{ + private final int fd; + + private VMChannel(int fd) + { + this.fd = fd; + } + + public static VMChannel getVMChannel(PlainSocketImpl socket) + { + return new VMChannel(socket.getNativeFD()); + } + + public static VMChannel getVMChannel(SourceChannelImpl source) + { + return new VMChannel(source.getNativeFD()); + } + + public static VMChannel getVMChannel(SinkChannelImpl sink) + { + return new VMChannel(sink.getNativeFD()); + } + + public static VMChannel getVMChannel(FileChannelImpl file) + { + return new VMChannel(file.getNativeFD()); + } + + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + initIDs(); + } + + /** + * Set the file descriptor to have the required blocking + * setting. + * + * @param fd + * @param blocking + */ + public native void setBlocking(int fd, boolean blocking); + + public void setBlocking(boolean blocking) + { + setBlocking(fd, blocking); + } + + + /** + * Reads a byte buffer directly using the supplied file descriptor. + * Assumes that the buffer is a DirectBuffer. + * + * @param fd Native file descriptor to read from. + * @param dst Direct Byte Buffer to read to. + * @return Number of bytes read. + * @throws IOException If an error occurs or dst is not a direct buffers. + */ + native int read(int fd, ByteBuffer dst) + throws IOException; + + public int read(ByteBuffer dst) + throws IOException + { + return read(fd, dst); + } + + /** + * Reads into byte buffers directly using the supplied file descriptor. + * Assumes that the buffer list contains DirectBuffers. Will perform a + * scattering read. + * + * @param fd Native file descriptor to read from. + * @param dsts An array direct byte buffers. + * @param offset Index of the first buffer to read to. + * @param length The number of buffers to read to. + * @return Number of bytes read. + * @throws IOException If an error occurs or the dsts are not direct buffers. + */ + native long readScattering(int fd, ByteBuffer[] dsts, int offset, int length) + throws IOException; + + public long readScattering(ByteBuffer[] dsts, int offset, int length) + throws IOException + { + if (offset + length > dsts.length) + throw new IndexOutOfBoundsException("offset + length > dsts.length"); + + return readScattering(fd, dsts, offset, length); + } + + /** + * Writes from a direct byte bufer using the supplied file descriptor. + * Assumes the buffer is a DirectBuffer. + * + * @param fd + * @param src + * @return Number of bytes written. + * @throws IOException + */ + native int write(int fd, ByteBuffer src) + throws IOException; + + public int write(ByteBuffer src) + throws IOException + { + return write(fd, src); + } + + /** + * Writes from byte buffers directly using the supplied file descriptor. + * Assumes the that buffer list constains DirectBuffers. Will perform + * as gathering write. + * + * @param fd + * @param srcs + * @param offset + * @param length + * @return Number of bytes written. + * @throws IOException + */ + native long writeGathering(int fd, ByteBuffer[] srcs, int offset, int length) + throws IOException; + + public long writeGathering(ByteBuffer[] srcs, int offset, int length) + throws IOException + { + if (offset + length > srcs.length) + throw new IndexOutOfBoundsException("offset + length > srcs.length"); + + return writeGathering(fd, srcs, offset, length); + } + + private native static void initIDs(); + +} diff --git a/libjava/gnu/java/nio/VMChannelOwner.h b/libjava/gnu/java/nio/VMChannelOwner.h new file mode 100644 index 000000000..eca43b543 --- /dev/null +++ b/libjava/gnu/java/nio/VMChannelOwner.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_VMChannelOwner__ +#define __gnu_java_nio_VMChannelOwner__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class VMChannel; + class VMChannelOwner; + } + } + } +} + +class gnu::java::nio::VMChannelOwner : public ::java::lang::Object +{ + +public: + virtual ::gnu::java::nio::VMChannel * getVMChannel() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __gnu_java_nio_VMChannelOwner__ diff --git a/libjava/gnu/java/nio/VMPipe.h b/libjava/gnu/java/nio/VMPipe.h new file mode 100644 index 000000000..3a94c1e38 --- /dev/null +++ b/libjava/gnu/java/nio/VMPipe.h @@ -0,0 +1,48 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_VMPipe__ +#define __gnu_java_nio_VMPipe__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class PipeImpl; + class VMPipe; + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class gnu::java::nio::VMPipe : public ::java::lang::Object +{ + +public: // actually package-private + VMPipe(); + static void init(::gnu::java::nio::PipeImpl *, ::java::nio::channels::spi::SelectorProvider *); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_VMPipe__ diff --git a/libjava/gnu/java/nio/VMPipe.java b/libjava/gnu/java/nio/VMPipe.java new file mode 100644 index 000000000..11dd2aa7b --- /dev/null +++ b/libjava/gnu/java/nio/VMPipe.java @@ -0,0 +1,64 @@ +/* VMPipe.java -- Reference implementation for VM hooks used by PipeImpl + Copyright (C) 2004 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 gnu.java.nio; + +import java.io.IOException; +import java.nio.channels.spi.SelectorProvider; +import gnu.classpath.Configuration; + +/** + * This class contains the native methods for gnu.java.nio.PipeImpl + * As such, it needs help from the VM. + * + * @author Patrik Reali + */ +final class VMPipe +{ + + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + + static native void init(PipeImpl self, SelectorProvider provider) + throws IOException; +} diff --git a/libjava/gnu/java/nio/VMSelector.h b/libjava/gnu/java/nio/VMSelector.h new file mode 100644 index 000000000..cc177ff9e --- /dev/null +++ b/libjava/gnu/java/nio/VMSelector.h @@ -0,0 +1,37 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_VMSelector__ +#define __gnu_java_nio_VMSelector__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + class VMSelector; + } + } + } +} + +class gnu::java::nio::VMSelector : public ::java::lang::Object +{ + +public: + VMSelector(); +public: // actually package-private + static jint select(JArray< jint > *, JArray< jint > *, JArray< jint > *, jlong); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_VMSelector__ diff --git a/libjava/gnu/java/nio/VMSelector.java b/libjava/gnu/java/nio/VMSelector.java new file mode 100644 index 000000000..488132d24 --- /dev/null +++ b/libjava/gnu/java/nio/VMSelector.java @@ -0,0 +1,59 @@ +/* VMSelector.java -- + Copyright (C) 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 gnu.java.nio; + +import gnu.classpath.Configuration; +import java.io.IOException; + +public final class VMSelector +{ + static + { + // load the shared library needed for native methods. + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary ("javanio"); + } + } + + // A timeout value of 0 means block forever. + static native int select (int[] read, int[] write, + int[] except, long timeout) + throws IOException; + +} diff --git a/libjava/gnu/java/nio/channels/FileChannelImpl.h b/libjava/gnu/java/nio/channels/FileChannelImpl.h new file mode 100644 index 000000000..34099c52f --- /dev/null +++ b/libjava/gnu/java/nio/channels/FileChannelImpl.h @@ -0,0 +1,118 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_channels_FileChannelImpl__ +#define __gnu_java_nio_channels_FileChannelImpl__ + +#pragma interface + +#include <java/nio/channels/FileChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace channels + { + class FileChannelImpl; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class MappedByteBuffer; + namespace channels + { + class FileChannel; + class FileChannel$MapMode; + class FileLock; + class ReadableByteChannel; + class WritableByteChannel; + } + } + } +} + +class gnu::java::nio::channels::FileChannelImpl : public ::java::nio::channels::FileChannel +{ + + static void init(); +public: + FileChannelImpl(); + static ::gnu::java::nio::channels::FileChannelImpl * create(::java::io::File *, jint); +private: + FileChannelImpl(::java::io::File *, jint); +public: // actually package-private + FileChannelImpl(jint, jint); +private: + jint open(::java::lang::String *, jint); +public: + jint available(); +private: + jlong implPosition(); + void seek(jlong); + void implTruncate(jlong); +public: + void unlock(jlong, jlong); + jlong size(); +public: // actually protected + void implCloseChannel(); + void finalize(); +public: + jint read(::java::nio::ByteBuffer *); + jint read(::java::nio::ByteBuffer *, jlong); + jint read(); + jint read(JArray< jbyte > *, jint, jint); + jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + jint write(::java::nio::ByteBuffer *); + jint write(::java::nio::ByteBuffer *, jlong); + void write(JArray< jbyte > *, jint, jint); + void write(jint); + jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint); + ::java::nio::MappedByteBuffer * mapImpl(jchar, jlong, jint); + ::java::nio::MappedByteBuffer * map(::java::nio::channels::FileChannel$MapMode *, jlong, jlong); + void force(jboolean); +private: + jint smallTransferTo(jlong, jint, ::java::nio::channels::WritableByteChannel *); +public: + jlong transferTo(jlong, jlong, ::java::nio::channels::WritableByteChannel *); +private: + jint smallTransferFrom(::java::nio::channels::ReadableByteChannel *, jlong, jint); +public: + jlong transferFrom(::java::nio::channels::ReadableByteChannel *, jlong, jlong); + ::java::nio::channels::FileLock * tryLock(jlong, jlong, jboolean); +private: + jboolean lock(jlong, jlong, jboolean, jboolean); +public: + ::java::nio::channels::FileLock * lock(jlong, jlong, jboolean); + jlong position(); + ::java::nio::channels::FileChannel * position(jlong); + ::java::nio::channels::FileChannel * truncate(jlong); + jint getNativeFD(); + static const jint READ = 1; + static const jint WRITE = 2; + static const jint APPEND = 4; + static const jint EXCL = 8; + static const jint SYNC = 16; + static const jint DSYNC = 32; +private: + jint __attribute__((aligned(__alignof__( ::java::nio::channels::FileChannel)))) fd; + jlong pos; + jint mode; +public: + static ::gnu::java::nio::channels::FileChannelImpl * in; + static ::gnu::java::nio::channels::FileChannelImpl * out; + static ::gnu::java::nio::channels::FileChannelImpl * err; + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_channels_FileChannelImpl__ diff --git a/libjava/gnu/java/nio/channels/FileChannelImpl.java b/libjava/gnu/java/nio/channels/FileChannelImpl.java new file mode 100644 index 000000000..c1f79a436 --- /dev/null +++ b/libjava/gnu/java/nio/channels/FileChannelImpl.java @@ -0,0 +1,544 @@ +/* FileChannelImpl.java -- + Copyright (C) 2002, 2004, 2005, 2006 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 gnu.java.nio.channels; + +import gnu.classpath.Configuration; +import gnu.java.nio.FileLockImpl; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.nio.ByteBuffer; +import java.nio.MappedByteBuffer; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.FileChannel; +import java.nio.channels.FileLock; +import java.nio.channels.NonReadableChannelException; +import java.nio.channels.NonWritableChannelException; +import java.nio.channels.ReadableByteChannel; +import java.nio.channels.WritableByteChannel; + +/** + * This file is not user visible ! + * But alas, Java does not have a concept of friendly packages + * so this class is public. + * Instances of this class are created by invoking getChannel + * Upon a Input/Output/RandomAccessFile object. + */ +public final class FileChannelImpl extends FileChannel +{ + // These are mode values for open(). + public static final int READ = 1; + public static final int WRITE = 2; + public static final int APPEND = 4; + + // EXCL is used only when making a temp file. + public static final int EXCL = 8; + public static final int SYNC = 16; + public static final int DSYNC = 32; + + private static native void init(); + + static + { + if (Configuration.INIT_LOAD_LIBRARY) + { + System.loadLibrary("javanio"); + } + + init(); + } + + /** + * This is the actual native file descriptor value + */ + // System's notion of file descriptor. It might seem redundant to + // initialize this given that it is reassigned in the constructors. + // However, this is necessary because if open() throws an exception + // we want to make sure this has the value -1. This is the most + // efficient way to accomplish that. + private int fd = -1; + + private long pos; + private int mode; + + public FileChannelImpl () + { + } + + /* Open a file. MODE is a combination of the above mode flags. */ + /* This is a static factory method, so that VM implementors can decide + * substitute subclasses of FileChannelImpl. */ + public static FileChannelImpl create(File file, int mode) + throws FileNotFoundException + { + return new FileChannelImpl(file, mode); + } + + /* Open a file. MODE is a combination of the above mode flags. */ + private FileChannelImpl (File file, int mode) throws FileNotFoundException + { + final String path = file.getPath(); + fd = open (path, mode); + this.mode = mode; + + // First open the file and then check if it is a a directory + // to avoid race condition. + if (file.isDirectory()) + { + try + { + close(); + } + catch (IOException e) + { + /* ignore it */ + } + + throw new FileNotFoundException(path + " is a directory"); + } + } + + /* Used by init() (native code) */ + FileChannelImpl (int fd, int mode) + { + this.fd = fd; + this.mode = mode; + } + + public static FileChannelImpl in; + public static FileChannelImpl out; + public static FileChannelImpl err; + + private native int open (String path, int mode) throws FileNotFoundException; + + public native int available () throws IOException; + private native long implPosition () throws IOException; + private native void seek (long newPosition) throws IOException; + private native void implTruncate (long size) throws IOException; + + public native void unlock (long pos, long len) throws IOException; + + public native long size () throws IOException; + + protected native void implCloseChannel() throws IOException; + + /** + * Makes sure the Channel is properly closed. + */ + protected void finalize() throws IOException + { + this.close(); + } + + public int read (ByteBuffer dst) throws IOException + { + int result; + byte[] buffer = new byte [dst.remaining ()]; + + result = read (buffer, 0, buffer.length); + + if (result > 0) + dst.put (buffer, 0, result); + + return result; + } + + public int read (ByteBuffer dst, long position) + throws IOException + { + if (position < 0) + throw new IllegalArgumentException (); + long oldPosition = implPosition (); + position (position); + int result = read(dst); + position (oldPosition); + + return result; + } + + public native int read () + throws IOException; + + public native int read (byte[] buffer, int offset, int length) + throws IOException; + + public long read (ByteBuffer[] dsts, int offset, int length) + throws IOException + { + long result = 0; + + for (int i = offset; i < offset + length; i++) + { + result += read (dsts [i]); + } + + return result; + } + + public int write (ByteBuffer src) throws IOException + { + int len = src.remaining (); + if (src.hasArray()) + { + byte[] buffer = src.array(); + write(buffer, src.arrayOffset() + src.position(), len); + src.position(src.position() + len); + } + else + { + // Use a more efficient native method! FIXME! + byte[] buffer = new byte [len]; + src.get (buffer, 0, len); + write (buffer, 0, len); + } + return len; + } + + public int write (ByteBuffer src, long position) + throws IOException + { + if (position < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + if ((mode & WRITE) == 0) + throw new NonWritableChannelException (); + + int result; + long oldPosition; + + oldPosition = implPosition (); + seek (position); + result = write(src); + seek (oldPosition); + + return result; + } + + public native void write (byte[] buffer, int offset, int length) + throws IOException; + + public native void write (int b) throws IOException; + + public long write(ByteBuffer[] srcs, int offset, int length) + throws IOException + { + long result = 0; + + for (int i = offset;i < offset + length;i++) + { + result += write (srcs[i]); + } + + return result; + } + + public native MappedByteBuffer mapImpl (char mode, long position, int size) + throws IOException; + + public MappedByteBuffer map (FileChannel.MapMode mode, + long position, long size) + throws IOException + { + char nmode = 0; + if (mode == MapMode.READ_ONLY) + { + nmode = 'r'; + if ((this.mode & READ) == 0) + throw new NonReadableChannelException(); + } + else if (mode == MapMode.READ_WRITE || mode == MapMode.PRIVATE) + { + nmode = mode == MapMode.READ_WRITE ? '+' : 'c'; + if ((this.mode & (READ|WRITE)) != (READ|WRITE)) + throw new NonWritableChannelException(); + } + else + throw new IllegalArgumentException (); + + if (position < 0 || size < 0 || size > Integer.MAX_VALUE) + throw new IllegalArgumentException (); + return mapImpl(nmode, position, (int) size); + } + + /** + * msync with the disk + */ + public void force (boolean metaData) throws IOException + { + if (!isOpen ()) + throw new ClosedChannelException (); + } + + // like transferTo, but with a count of less than 2Gbytes + private int smallTransferTo (long position, int count, + WritableByteChannel target) + throws IOException + { + ByteBuffer buffer; + try + { + // Try to use a mapped buffer if we can. If this fails for + // any reason we'll fall back to using a ByteBuffer. + buffer = map (MapMode.READ_ONLY, position, count); + } + catch (IOException e) + { + buffer = ByteBuffer.allocate (count); + read (buffer, position); + buffer.flip(); + } + + return target.write (buffer); + } + + public long transferTo (long position, long count, + WritableByteChannel target) + throws IOException + { + if (position < 0 + || count < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + if ((mode & READ) == 0) + throw new NonReadableChannelException (); + + final int pageSize = 65536; + long total = 0; + + while (count > 0) + { + int transferred + = smallTransferTo (position, (int)Math.min (count, pageSize), + target); + if (transferred < 0) + break; + total += transferred; + position += transferred; + count -= transferred; + } + + return total; + } + + // like transferFrom, but with a count of less than 2Gbytes + private int smallTransferFrom (ReadableByteChannel src, long position, + int count) + throws IOException + { + ByteBuffer buffer = null; + + if (src instanceof FileChannel) + { + try + { + // Try to use a mapped buffer if we can. If this fails + // for any reason we'll fall back to using a ByteBuffer. + buffer = ((FileChannel)src).map (MapMode.READ_ONLY, position, + count); + } + catch (IOException e) + { + } + } + + if (buffer == null) + { + buffer = ByteBuffer.allocate ((int) count); + src.read (buffer); + buffer.flip(); + } + + return write (buffer, position); + } + + public long transferFrom (ReadableByteChannel src, long position, + long count) + throws IOException + { + if (position < 0 + || count < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + if ((mode & WRITE) == 0) + throw new NonWritableChannelException (); + + final int pageSize = 65536; + long total = 0; + + while (count > 0) + { + int transferred = smallTransferFrom (src, position, + (int)Math.min (count, pageSize)); + if (transferred < 0) + break; + total += transferred; + position += transferred; + count -= transferred; + } + + return total; + } + + public FileLock tryLock (long position, long size, boolean shared) + throws IOException + { + if (position < 0 + || size < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + if (shared && (mode & READ) == 0) + throw new NonReadableChannelException (); + + if (!shared && (mode & WRITE) == 0) + throw new NonWritableChannelException (); + + boolean completed = false; + + try + { + begin(); + boolean lockable = lock(position, size, shared, false); + completed = true; + return (lockable + ? new FileLockImpl(this, position, size, shared) + : null); + } + finally + { + end(completed); + } + } + + /** Try to acquire a lock at the given position and size. + * On success return true. + * If wait as specified, block until we can get it. + * Otherwise return false. + */ + private native boolean lock(long position, long size, + boolean shared, boolean wait) throws IOException; + + public FileLock lock (long position, long size, boolean shared) + throws IOException + { + if (position < 0 + || size < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + boolean completed = false; + + try + { + boolean lockable = lock(position, size, shared, true); + completed = true; + return (lockable + ? new FileLockImpl(this, position, size, shared) + : null); + } + finally + { + end(completed); + } + } + + public long position () + throws IOException + { + if (!isOpen ()) + throw new ClosedChannelException (); + + return implPosition (); + } + + public FileChannel position (long newPosition) + throws IOException + { + if (newPosition < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + // FIXME note semantics if seeking beyond eof. + // We should seek lazily - only on a write. + seek (newPosition); + return this; + } + + public FileChannel truncate (long size) + throws IOException + { + if (size < 0) + throw new IllegalArgumentException (); + + if (!isOpen ()) + throw new ClosedChannelException (); + + if ((mode & WRITE) == 0) + throw new NonWritableChannelException (); + + if (size < size ()) + implTruncate (size); + + return this; + } + + /** + * @return The native file descriptor. + */ + public int getNativeFD() + { + return fd; + } +} diff --git a/libjava/gnu/java/nio/channels/natFileChannelEcos.cc b/libjava/gnu/java/nio/channels/natFileChannelEcos.cc new file mode 100644 index 000000000..78575e7e6 --- /dev/null +++ b/libjava/gnu/java/nio/channels/natFileChannelEcos.cc @@ -0,0 +1,192 @@ +// natFileDescriptor.cc - Native part of FileDescriptor class. + +/* Copyright (C) 1998, 1999, 2001, 2002 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> + +#include <errno.h> +#include <string.h> +#include <sys/types.h> +#include <sys/stat.h> +#include <sys/param.h> + +#include <gcj/cni.h> +#include <jvm.h> +#include <java/io/FileDescriptor.h> +#include <java/io/SyncFailedException.h> +#include <java/io/IOException.h> +#include <java/io/EOFException.h> +#include <java/lang/ArrayIndexOutOfBoundsException.h> +#include <java/lang/NullPointerException.h> +#include <java/lang/String.h> +#include <java/io/FileNotFoundException.h> +#include <gnu/java/nio/MappedByteBufferImpl.h> +#include <java/nio/channels/FileChannel.h> +#include <java/nio/channels/FileLock.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> + +using gnu::gcj::RawData; +using java::io::IOException; +using gnu::java::nio::MappedByteBufferImpl; +using java::io::InterruptedIOException; +using java::io::FileNotFoundException; +using java::lang::ArrayIndexOutOfBoundsException; +using java::lang::NullPointerException; +using gnu::java::nio::channels::FileChannelImpl; + +extern "C" void diag_write_char (char c); + +static void +diag_write (char *data, int len) +{ + while (len > 0) + { + diag_write_char (*data++); + len--; + } +} + +#define NO_FSYNC_MESSAGE "sync unsupported" + +void +FileChannelImpl::init(void) +{ + in = new FileChannelImpl((jint) 0, FileChannelImpl::READ); + out = new FileChannelImpl((jint) 1, FileChannelImpl::WRITE); + err = new FileChannelImpl((jint) 2, FileChannelImpl::WRITE); +} + +#if 0 +jboolean +FileChannelImpl::valid (void) +{ + return true; +} + +void +FileChannelImpl::sync (void) +{ + // Some files don't support fsync. We don't bother reporting these + // as errors. +#ifdef HAVE_FSYNC +#else + throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)); +#endif +} +#endif + +jint +FileChannelImpl::open (jstring, jint) +{ + return fd; +} + +void +FileChannelImpl::write (jint) +{ + char d = (char) b; + ::diag_write (&d, 1); +} + +void +FileChannelImpl::write (jbyteArray b, jint offset, jint len) +{ + if (! b) + throw new NullPointerException; + if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b)) + throw new ArrayIndexOutOfBoundsException; + char *bytes = (char *)elements (b) + offset; + ::diag_write (bytes, len); +} + +void +FileChannelImpl::implCloseChannel (void) +{ +} + +void +FileChannelImpl::implTruncate (jlong) +{ +} + +void +FileChannelImpl::seek (jlong) +{ +} + +jlong +FileChannelImpl::size (void) +{ + return 0; +} + +jlong +FileChannelImpl::implPosition (void) +{ + return 0; +} + +jint +FileChannelImpl::read (void) +{ + return 0; +} + +jint +FileChannelImpl::read (jbyteArray buffer, jint offset, jint count) +{ + return 0; +} + +jint +FileChannelImpl::available (void) +{ + return 0; +} + +jboolean +FileChannelImpl::lock (jlong, jlong, jboolean, jboolean) +{ + throw new IOException (JvNewStringLatin1 + ("gnu.java.nio.FileChannelImpl.lock() not implemented")); +} + +void +FileChannelImpl::unlock (jlong, jlong) +{ + throw new IOException (JvNewStringLatin1 + ("gnu.java.nio.channels.FileChannelImpl.unlock() not implemented")); +} + +java::nio::MappedByteBuffer * +FileChannelImpl::mapImpl (jchar, jlong, jint) +{ + return NULL; +} + +void +MappedByteBufferImpl::unmapImpl () +{ +} + +void +MappedByteBufferImpl::loadImpl () +{ +} + +jboolean +MappedByteBufferImpl::isLoadedImpl () +{ + return true; +} + +void +MappedByteBufferImpl::forceImpl () +{ +} diff --git a/libjava/gnu/java/nio/channels/natFileChannelPosix.cc b/libjava/gnu/java/nio/channels/natFileChannelPosix.cc new file mode 100644 index 000000000..e05904c50 --- /dev/null +++ b/libjava/gnu/java/nio/channels/natFileChannelPosix.cc @@ -0,0 +1,557 @@ + +// natFileChannelImplPosix.cc - Native part of FileChannelImpl class. + +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <gcj/cni.h> +#include <gcj/javaprims.h> +#include <jvm.h> + +#include "posix.h" + +#include <errno.h> +#include <fcntl.h> +#include <stdio.h> +#include <string.h> +#include <sys/stat.h> +#include <sys/param.h> + +#include <gnu/gcj/RawData.h> +#include <gnu/java/nio/FileLockImpl.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> +#include <java/io/FileNotFoundException.h> +#include <java/io/IOException.h> +#include <java/io/SyncFailedException.h> +#include <java/io/InterruptedIOException.h> +#include <java/io/EOFException.h> +#include <java/lang/ArrayIndexOutOfBoundsException.h> +#include <java/lang/NullPointerException.h> +#include <java/lang/System.h> +#include <java/lang/String.h> +#include <java/lang/StringBuffer.h> +#include <java/lang/Thread.h> +#include <java/nio/ByteBuffer.h> +#include <java/nio/MappedByteBufferImpl.h> +#include <java/nio/channels/FileChannel.h> +#include <java/nio/channels/FileLock.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> + +#ifdef HAVE_SYS_IOCTL_H +#define BSD_COMP /* Get FIONREAD on Solaris2. */ +#include <sys/ioctl.h> +#endif + +// Pick up FIONREAD on Solaris 2.5. +#ifdef HAVE_SYS_FILIO_H +#include <sys/filio.h> +#endif + +#ifdef HAVE_MMAP +#include <sys/mman.h> + +// Use overload resolution to find out the argument types. +// E.g. Solaris 2.6 uses different argument types for munmap and msync. +// This is in case _POSIX_C_SOURCES is smaller than 3. + +template <typename T_implPtr, typename T_implLen> +static inline int +munmap_adaptor(int (*munmap)(T_implPtr caddr, T_implLen sizet), + void* caddr, size_t sizet) +{ + return munmap ((T_implPtr) caddr, (T_implLen) sizet); +} + +template <typename T_implPtr, typename T_implLen, typename T_msync> +static inline int +msync_adaptor(int (*msync)(T_implPtr caddr, T_implLen sizet, T_msync msynct), + void* caddr, size_t sizet, int msynct) +{ + return msync ((T_implPtr) caddr, (T_implLen) sizet, (T_msync) msynct); +} +#endif + +using gnu::gcj::RawData; +using java::io::IOException; +using java::nio::MappedByteBufferImpl; +using java::io::InterruptedIOException; +using java::io::FileNotFoundException; +using java::lang::ArrayIndexOutOfBoundsException; +using gnu::java::nio::channels::FileChannelImpl; + +#define NO_FSYNC_MESSAGE "sync unsupported" + +void +FileChannelImpl::init(void) +{ + in = new FileChannelImpl((jint) 0, FileChannelImpl::READ); + out = new FileChannelImpl((jint) 1, FileChannelImpl::WRITE); + err = new FileChannelImpl((jint) 2, FileChannelImpl::WRITE); +} + +#if 0 +jboolean +FileChannelImpl::valid (void) +{ + struct stat sb; + return fd >= 0 && ::fstat (fd, &sb) == 0; +} + +void +FileChannelImpl::sync (void) +{ + // Some files don't support fsync. We don't bother reporting these + // as errors. +#ifdef HAVE_FSYNC + if (::fsync (fd) && errno != EROFS && errno != EINVAL) + throw new SyncFailedException (JvNewStringLatin1 (strerror (errno))); +#else + throw new SyncFailedException (JvNewStringLatin1 (NO_FSYNC_MESSAGE)); +#endif +} +#endif + +jint +FileChannelImpl::open (jstring path, jint jflags) +{ + fd = -1; + char *buf = (char *) _Jv_AllocBytes (_Jv_GetStringUTFLength (path) + 1); + jsize total = JvGetStringUTFRegion (path, 0, path->length(), buf); + buf[total] = '\0'; + int flags = 0; +#ifdef O_BINARY + flags |= O_BINARY; +#endif + + JvAssert ((jflags & READ) || (jflags & WRITE)); + int mode = 0666; + if ((jflags & READ) && (jflags & WRITE)) + flags |= O_RDWR | O_CREAT; + else if ((jflags & READ)) + flags |= O_RDONLY; + else + { + flags |= O_WRONLY | O_CREAT; + if ((jflags & APPEND)) + flags |= O_APPEND; + else + flags |= O_TRUNC; + + if ((jflags & EXCL)) + { + flags |= O_EXCL; + // In this case we are making a temp file. + mode = 0600; + } + } + + if ((jflags & SYNC)) + flags |= O_SYNC; + + if ((jflags & DSYNC)) + flags |= O_DSYNC; + + int fd = ::open (buf, flags, mode); + if (fd == -1 && errno == EMFILE) + { + // Because finalize () calls close () we might be able to continue. + ::java::lang::System::gc (); + ::java::lang::System::runFinalization (); + fd = ::open (buf, flags, mode); + } + if (fd == -1) + { + // We choose the formatting here for JDK compatibility, believe + // it or not. + ::java::lang::StringBuffer *msg = new ::java::lang::StringBuffer (path); + msg->append (JvNewStringUTF (" (")); + msg->append (JvNewStringUTF (strerror (errno))); + msg->append (JvNewStringUTF (")")); + throw new ::java::io::FileNotFoundException (msg->toString ()); + } + + return fd; +} + +void +FileChannelImpl::write (jint b) +{ + jbyte d = (jbyte) b; + int r = 0; + while (r != 1) + { + r = ::write (fd, &d, 1); + if (r == -1) + { + if (::java::lang::Thread::interrupted()) + { + ::java::io::InterruptedIOException *iioe + = new ::java::io::InterruptedIOException (JvNewStringLatin1 (strerror (errno))); + iioe->bytesTransferred = r == -1 ? 0 : r; + throw iioe; + } + if (errno != EINTR) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + } + pos++; +} + +void +FileChannelImpl::write (jbyteArray b, jint offset, jint len) +{ + if (! b) + throw new ::java::lang::NullPointerException; + if (offset < 0 || len < 0 || offset + len > JvGetArrayLength (b)) + throw new ArrayIndexOutOfBoundsException; + jbyte *bytes = elements (b) + offset; + + int written = 0; + while (len > 0) + { + int r = ::write (fd, bytes, len); + if (r == -1) + { + if (::java::lang::Thread::interrupted()) + { + InterruptedIOException *iioe + = new InterruptedIOException (JvNewStringLatin1 (strerror (errno))); + iioe->bytesTransferred = written; + throw iioe; + } + if (errno != EINTR) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + continue; + } + + written += r; + len -= r; + bytes += r; + pos += r; + } +} + +void +FileChannelImpl::implCloseChannel (void) +{ + jint save = fd; + fd = -1; + if (::close (save)) + throw new IOException (JvNewStringLatin1 (strerror (errno))); +} + +void +FileChannelImpl::implTruncate (jlong size) +{ + struct stat sb; + +#ifdef HAVE_FTRUNCATE + if (::fstat (fd, &sb)) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + + if ((jlong) sb.st_size == size) + return; + + // If the file is too short, we extend it. We can't rely on + // ftruncate() extending the file. So we lseek() to 1 byte less + // than we want, and then we write a single byte at the end. + if ((jlong) sb.st_size < size) + { + if (::lseek (fd, (off_t) (size - 1), SEEK_SET) == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + char out = '\0'; + int r = ::write (fd, &out, 1); + if (r <= 0 || ::lseek (fd, pos, SEEK_SET) == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + else + { + if (::ftruncate (fd, (off_t) size)) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + if (pos > size + && ::lseek (fd, (off_t) size, SEEK_SET) == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + pos = size; + } +#else /* HAVE_FTRUNCATE */ + throw new IOException (JvNewStringLatin1 ("FileDescriptor.setLength not implemented")); +#endif /* HAVE_FTRUNCATE */ +} + +void +FileChannelImpl::seek (jlong newPos) +{ + off_t r = ::lseek (fd, (off_t) newPos, SEEK_SET); + if (r == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + pos = r; +} + +jlong +FileChannelImpl::size (void) +{ + struct stat sb; + if (::fstat (fd, &sb)) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + return sb.st_size; +} + +jlong +FileChannelImpl::implPosition (void) +{ + return pos; +} + +jint +FileChannelImpl::read (void) +{ + jbyte b; + int r; + do + { + r = ::read (fd, &b, 1); + if (r == 0) + return -1; + if (r == -1) + { + if (::java::lang::Thread::interrupted()) + { + InterruptedIOException *iioe + = new InterruptedIOException (JvNewStringLatin1 (strerror (errno))); + iioe->bytesTransferred = r == -1 ? 0 : r; + throw iioe; + } + if (errno != EINTR) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + } + while (r != 1); + pos++; + return b & 0xFF; +} + +jint +FileChannelImpl::read (jbyteArray buffer, jint offset, jint count) +{ + if (! buffer) + throw new ::java::lang::NullPointerException; + jsize bsize = JvGetArrayLength (buffer); + if (offset < 0 || count < 0 || offset + count > bsize) + throw new ::java::lang::ArrayIndexOutOfBoundsException; + + // Must return 0 if an attempt is made to read 0 bytes. + if (count == 0) + return 0; + + jbyte *bytes = elements (buffer) + offset; + int r; + do + { + r = ::read (fd, bytes, count); + if (r == 0) + return -1; + if (r == -1) + { + if (::java::lang::Thread::interrupted()) + { + InterruptedIOException *iioe + = new InterruptedIOException (JvNewStringLatin1 (strerror (errno))); + iioe->bytesTransferred = r == -1 ? 0 : r; + throw iioe; + } + if (errno != EINTR) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + } + while (r <= 0); + pos += r; + return r; +} + +jint +FileChannelImpl::available (void) +{ +#if defined (FIONREAD) || defined (HAVE_SELECT) || defined (HAVE_FSTAT) + int num = 0; + int r = 0; + bool num_set = false; + +#if defined (FIONREAD) + r = ::ioctl (fd, FIONREAD, &num); + if (r == -1 && errno == ENOTTY) + { + // If the ioctl doesn't work, we don't care. + r = 0; + num = 0; + } + else + num_set = true; +#elif defined (HAVE_SELECT) + if (fd < 0) + { + errno = EBADF; + r = -1; + } +#endif + + if (r == -1) + { + posix_error: + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + + // If we didn't get anything, and we have fstat, then see if see if + // we're reading a regular file. On many systems, FIONREAD does not + // work on regular files; select() likewise returns a useless + // result. This is run incorrectly when FIONREAD does work on + // regular files and we are at the end of the file. However, this + // case probably isn't very important. +#if defined (HAVE_FSTAT) + if (! num_set) + { + struct stat sb; + off_t where = 0; + if (fstat (fd, &sb) != -1 + && S_ISREG (sb.st_mode) + && (where = lseek (fd, 0, SEEK_CUR)) != (off_t) -1) + { + num = (int) (sb.st_size - where); + num_set = true; + } + } +#endif /* HAVE_FSTAT */ + +#if defined (HAVE_SELECT) + if (! num_set) + { + fd_set rd; + FD_ZERO (&rd); + FD_SET (fd, &rd); + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 0; + r = _Jv_select (fd + 1, &rd, NULL, NULL, &tv); + if (r == -1) + goto posix_error; + num = r == 0 ? 0 : 1; + } +#endif /* HAVE_SELECT */ + + return (jint) num; +#else + return 0; +#endif +} + +jboolean +FileChannelImpl::lock +(jlong pos, jlong len, jboolean shared, jboolean wait) +{ + struct flock lockdata; + + lockdata.l_type = shared ? F_RDLCK : F_WRLCK; + lockdata.l_whence = SEEK_SET; + lockdata.l_start = pos; + lockdata.l_len = len; + + if (::fcntl (fd, wait ? F_SETLKW : F_SETLK, &lockdata) == -1) + { + if (! wait && (errno == EACCES || errno == EAGAIN)) + return false; + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + return true; +} + +void +FileChannelImpl::unlock (jlong pos, jlong len) +{ + struct flock lockdata; + + lockdata.l_type = F_UNLCK; + lockdata.l_whence = SEEK_SET; + lockdata.l_start = pos; + lockdata.l_len = len; + + if (::fcntl (fd, F_SETLK, &lockdata) == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); +} + +java::nio::MappedByteBuffer * +FileChannelImpl::mapImpl (jchar mmode, jlong position, jint size) +{ +#if defined(HAVE_MMAP) + int prot, flags; + if (mmode == 'r') + { + prot = PROT_READ; + flags = MAP_PRIVATE; + } + else + { + prot = PROT_READ|PROT_WRITE; + flags = mmode == '+' ? MAP_SHARED : MAP_PRIVATE; + + // If the file is too short, we must extend it. While using + // ftruncate() to extend a file is not portable in general, it + // should work on all systems where you can mmap() a file. + struct stat st; + if (fstat (fd, &st) == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + if (position + size > st.st_size) + { + if (ftruncate (fd, position + size) == -1) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + } + } + jint page_size = ::getpagesize(); + jint offset = position & ~(page_size-1); + jint align = position - offset; + void* ptr = ::mmap(NULL, size + align, prot, flags, fd, offset); + MappedByteBufferImpl *buf + = new MappedByteBufferImpl ((RawData *) ((char *) ptr + align), + size, mmode == 'r'); + if (ptr == (void *) MAP_FAILED) + throw new IOException (JvNewStringLatin1 (strerror (errno))); + buf->implPtr = reinterpret_cast<RawData*> (ptr); + buf->implLen = size+align; + return buf; +#else + throw new IOException (JvNewStringUTF ("mmap not implemented")); +#endif +} + +void +MappedByteBufferImpl::unmapImpl () +{ +#if defined(HAVE_MMAP) + munmap_adaptor(munmap, implPtr, implLen); +#endif +} + +void +MappedByteBufferImpl::loadImpl () +{ +} + +jboolean +MappedByteBufferImpl::isLoadedImpl () +{ + return true; +} + +void +MappedByteBufferImpl::forceImpl () +{ +#if defined(HAVE_MMAP) + ::msync_adaptor(msync, implPtr, implLen, MS_SYNC); +#endif +} diff --git a/libjava/gnu/java/nio/channels/natFileChannelWin32.cc b/libjava/gnu/java/nio/channels/natFileChannelWin32.cc new file mode 100644 index 000000000..ab238e623 --- /dev/null +++ b/libjava/gnu/java/nio/channels/natFileChannelWin32.cc @@ -0,0 +1,466 @@ +// natFileChannelImplWin32.cc - Native part of FileChannelImpl class. + +/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 Free Software + Foundation, Inc. + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +// FIXME: In order to support interrupting of IO operations, we +// need to change to use the windows asynchronous IO functions + +#include <config.h> +#include <platform.h> + +#include <gcj/cni.h> +#include <gcj/javaprims.h> +#include <jvm.h> + +#include <stdio.h> + +#include <gnu/gcj/RawData.h> +#include <gnu/java/nio/FileLockImpl.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> +#include <java/io/FileNotFoundException.h> +#include <java/io/IOException.h> +#include <java/io/SyncFailedException.h> +#include <java/io/InterruptedIOException.h> +#include <java/io/EOFException.h> +#include <java/lang/ArrayIndexOutOfBoundsException.h> +#include <java/lang/NullPointerException.h> +#include <java/lang/System.h> +#include <java/lang/String.h> +#include <java/lang/Thread.h> +#include <java/nio/ByteBuffer.h> +#include <java/nio/MappedByteBufferImpl.h> +#include <java/nio/channels/FileChannel.h> +#include <java/nio/channels/FileLock.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> + +using gnu::gcj::RawData; +using java::io::IOException; +using java::nio::MappedByteBufferImpl; +using java::io::InterruptedIOException; +using java::io::FileNotFoundException; +using java::lang::ArrayIndexOutOfBoundsException; +using gnu::java::nio::channels::FileChannelImpl; + +#undef STRICT + +static bool testCanUseGetHandleInfo() +{ + /* Test to see whether GetHandleInformation can be used + for console input or screen buffers. This is better + a kludgy OS version check. */ + DWORD dwFlags; + return GetHandleInformation (GetStdHandle (STD_INPUT_HANDLE), + &dwFlags) != 0; +} + +// FIXME: casting a FILE (pointer) to a jint will not work on Win64 -- +// we should be using gnu.gcj.RawData's. + +void +FileChannelImpl::init(void) +{ + in = new FileChannelImpl((jint)(GetStdHandle (STD_INPUT_HANDLE)), + FileChannelImpl::READ); + out = new FileChannelImpl((jint)(GetStdHandle (STD_OUTPUT_HANDLE)), + FileChannelImpl::WRITE); + err = new FileChannelImpl((jint)(GetStdHandle (STD_ERROR_HANDLE)), + FileChannelImpl::WRITE); +} + +#if 0 +FileChannelImpl::sync (void) { + if (! FlushFileBuffers ((HANDLE)fd)) + { + DWORD dwErrorCode = GetLastError (); + throw new SyncFailedException (_Jv_WinStrError (dwErrorCode)); + } +} +#endif + +jint +FileChannelImpl::open (jstring path, jint jflags) { + + HANDLE handle = NULL; + DWORD access = 0; + DWORD create = OPEN_EXISTING; + + JV_TEMP_STRING_WIN32(cpath, path) + + JvAssert((jflags & READ) || (jflags & WRITE)); + + if ((jflags & READ) && (jflags & WRITE)) + { + access = GENERIC_READ | GENERIC_WRITE; + if (jflags & EXCL) + create = CREATE_NEW; // this will raise error if file exists. + else + create = OPEN_ALWAYS; // equivalent to O_CREAT + } + else if (jflags & READ) + { + access = GENERIC_READ; + create = OPEN_EXISTING; // ignore EXCL + } + else + { + access = GENERIC_WRITE; + if (jflags & EXCL) + create = CREATE_NEW; + else if (jflags & APPEND) + create = OPEN_ALWAYS; + else + create = CREATE_ALWAYS; + } + + handle = CreateFile(cpath, access, FILE_SHARE_READ | FILE_SHARE_WRITE, + NULL, create, 0, NULL); + + if (handle == INVALID_HANDLE_VALUE) + { + DWORD dwErrorCode = GetLastError (); + throw new FileNotFoundException (_Jv_WinStrError (cpath, dwErrorCode)); + } + + // For APPEND mode, move the file pointer to the end of the file. + if (jflags & APPEND) + { + DWORD low = SetFilePointer (handle, 0, NULL, FILE_END); + if ((low == (DWORD) 0xffffffff) && (GetLastError () != NO_ERROR)) + { + DWORD dwErrorCode = GetLastError (); + throw new FileNotFoundException (_Jv_WinStrError (cpath, dwErrorCode)); + } + } + + // Make this handle non-inheritable so that child + // processes don't inadvertently prevent us from + // closing this file. + _Jv_platform_close_on_exec (handle); + + return (jint) handle; +} + +void +FileChannelImpl::write (jint b) +{ + DWORD bytesWritten; + jbyte buf = (jbyte)b; + + if (WriteFile ((HANDLE)fd, &buf, 1, &bytesWritten, NULL)) + { + if (::java::lang::Thread::interrupted()) + { + InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted")); + iioe->bytesTransferred = bytesWritten; + throw iioe; + } + if (bytesWritten != 1) + _Jv_ThrowIOException (); + } + else + _Jv_ThrowIOException (); + // FIXME: loop until bytesWritten == 1 +} + +void +FileChannelImpl::write(jbyteArray b, jint offset, jint len) +{ + if (! b) + throw new ::java::lang::NullPointerException; + if(offset < 0 || len < 0 || offset + len > JvGetArrayLength (b)) + throw new ArrayIndexOutOfBoundsException; + + jbyte *buf = elements (b) + offset; + DWORD bytesWritten; + + if (WriteFile ((HANDLE)fd, buf, len, &bytesWritten, NULL)) + { + if (::java::lang::Thread::interrupted()) + { + InterruptedIOException *iioe = new InterruptedIOException (JvNewStringLatin1 ("write interrupted")); + iioe->bytesTransferred = bytesWritten; + throw iioe; + } + } + else + _Jv_ThrowIOException (); + // FIXME: loop until bytesWritten == len +} + +void +FileChannelImpl::implCloseChannel (void) +{ + HANDLE save = (HANDLE)fd; + fd = (jint)INVALID_HANDLE_VALUE; + if (! CloseHandle (save)) + _Jv_ThrowIOException (); +} + +void +FileChannelImpl::implTruncate (jlong size) +{ + LONG liOrigFilePointer; + LONG liNewFilePointer; + LONG liEndFilePointer; + + // Get the original file pointer. + if (SetFilePointer((HANDLE) fd, (LONG) 0, &liOrigFilePointer, + FILE_CURRENT) != (BOOL) 0 + && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + + // Get the length of the file. + if (SetFilePointer((HANDLE) fd, (LONG) 0, &liEndFilePointer, + FILE_END) != (BOOL) 0 + && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + + if ((jlong)liEndFilePointer == size) + { + // Restore the file pointer. + if (liOrigFilePointer != liEndFilePointer) + { + if (SetFilePointer((HANDLE) fd, liOrigFilePointer, &liNewFilePointer, + FILE_BEGIN) != (BOOL) 0 + && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + } + return; + } + + // Seek to the new end of file. + if (SetFilePointer((HANDLE) fd, (LONG) size, &liNewFilePointer, + FILE_BEGIN) != (BOOL) 0 + && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + + // Truncate the file at this point. + if (SetEndOfFile((HANDLE) fd) != (BOOL) 0 && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + + if (liOrigFilePointer < liNewFilePointer) + { + // Restore the file pointer. + if (SetFilePointer((HANDLE) fd, liOrigFilePointer, &liNewFilePointer, + FILE_BEGIN) != (BOOL) 0 + && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + } +} + +void +FileChannelImpl::seek (jlong newPos) +{ + LONG high = pos >> 32; + DWORD low = SetFilePointer ((HANDLE)fd, (DWORD)(0xffffffff & newPos), &high, FILE_BEGIN); + if ((low == 0xffffffff) && (GetLastError () != NO_ERROR)) + _Jv_ThrowIOException (); +} + +jlong +FileChannelImpl::implPosition (void) +{ + LONG high = 0; + DWORD low = SetFilePointer ((HANDLE)fd, 0, &high, FILE_CURRENT); + if ((low == 0xffffffff) && (GetLastError() != NO_ERROR)) + _Jv_ThrowIOException (); + return (((jlong)high) << 32L) | (jlong)low; +} + +jlong +FileChannelImpl::size (void) +{ + DWORD high; + DWORD low; + + low = GetFileSize ((HANDLE)fd, &high); + // FIXME: Error checking + return (((jlong)high) << 32L) | (jlong)low; +} + +jint +FileChannelImpl::read (void) +{ + CHAR buf; + DWORD read; + + if (! ReadFile ((HANDLE)fd, &buf, 1, &read, NULL)) + { + if (GetLastError () == ERROR_BROKEN_PIPE) + return -1; + else + _Jv_ThrowIOException (); + } + + if (! read) + return -1; + else + return (jint)(buf & 0xff); +} + +jint +FileChannelImpl::read (jbyteArray buffer, jint offset, jint count) +{ + if (! buffer) + throw new ::java::lang::NullPointerException; + + jsize bsize = JvGetArrayLength (buffer); + if (offset < 0 || count < 0 || offset + count > bsize) + throw new ArrayIndexOutOfBoundsException; + + // Must return 0 if an attempt is made to read 0 bytes. + if (count == 0) + return 0; + + jbyte *bytes = elements (buffer) + offset; + + DWORD read; + if (! ReadFile((HANDLE)fd, bytes, count, &read, NULL)) + { + if (GetLastError () == ERROR_BROKEN_PIPE) + return -1; + else + _Jv_ThrowIOException (); + } + + if (read == 0) return -1; + + return (jint)read; +} + +jint +FileChannelImpl::available (void) +{ + // FIXME: + return size() - position(); +} + +jboolean +FileChannelImpl::lock (jlong pos, jlong len, jboolean shared, jboolean wait) +{ + DWORD flags = 0; + OVERLAPPED ovlpd; + + ZeroMemory(&ovlpd,sizeof(OVERLAPPED)); + + if(!shared) + flags |= LOCKFILE_EXCLUSIVE_LOCK; + if(!wait) + flags |= LOCKFILE_FAIL_IMMEDIATELY; + + ovlpd.Offset = (DWORD)pos; + ovlpd.OffsetHigh = pos>>32; + + DWORD lenlow = (DWORD)len; + DWORD lenhigh = len>>32; + + BOOL ret = LockFileEx((HANDLE)fd,flags,0,lenlow,lenhigh,&ovlpd); + + if(ret==ERROR_IO_PENDING && !shared && wait) + ret = GetOverlappedResult((HANDLE)fd,&ovlpd,NULL,wait); + + if(!ret) + _Jv_ThrowIOException(GetLastError()); + + return true; +} + +void +FileChannelImpl::unlock (jlong pos, jlong len) +{ + OVERLAPPED ovlpd; + + ZeroMemory(&ovlpd,sizeof(OVERLAPPED)); + + ovlpd.Offset = (DWORD)pos; + ovlpd.OffsetHigh = pos>>32; + + DWORD lenlow = (DWORD)len; + DWORD lenhigh = len>>32; + + BOOL ret = UnlockFileEx((HANDLE)fd,0,lenlow,lenhigh,&ovlpd); + + if(!ret) + _Jv_ThrowIOException(GetLastError()); +} + +java::nio::MappedByteBuffer * +FileChannelImpl::mapImpl (jchar mmode, jlong position, jint size) +{ + SYSTEM_INFO siSysInfo; + GetSystemInfo(&siSysInfo); + DWORD page_size = siSysInfo.dwPageSize; + jlong offset = position & ~(page_size-1); + jint align = position - offset; + jlong high = position + size; + jlong max_size; + if (mmode == '+') + max_size = high - offset; + else + max_size = 0; + DWORD access, protect; + if (mmode == 'r') + { + access = FILE_MAP_READ; + protect = PAGE_READONLY; + } + else if (mmode == '+') + { + access = FILE_MAP_WRITE; + protect = PAGE_READWRITE; + } + else + { + access = FILE_MAP_COPY; + protect = PAGE_WRITECOPY; + } + HANDLE hFileMapping = CreateFileMapping((HANDLE) fd, + (LPSECURITY_ATTRIBUTES) NULL, + protect, + (DWORD) (max_size >> 32), + (DWORD) max_size, + (LPCTSTR) NULL); + if (hFileMapping == NULL) + throw new IOException(); + void *ptr = MapViewOfFile(hFileMapping, access, + (DWORD) (offset >> 32), (DWORD) offset, + (SIZE_T) (high - offset)); + if (ptr == NULL) + throw new IOException(); + MappedByteBufferImpl *buf + = new MappedByteBufferImpl((RawData *) ((char *) ptr + align), + size, mode == 'r'); + buf->implPtr = reinterpret_cast<RawData*> (ptr); + buf->implLen = (jlong) (size_t) hFileMapping; + return buf; +} + +void +MappedByteBufferImpl::unmapImpl () +{ + UnmapViewOfFile((void*)implPtr); + CloseHandle((HANDLE) (size_t) implLen); +} + +void +MappedByteBufferImpl::loadImpl () +{ +} + +jboolean +MappedByteBufferImpl::isLoadedImpl () +{ + return true; +} + +void +MappedByteBufferImpl::forceImpl () +{ +} diff --git a/libjava/gnu/java/nio/charset/ByteCharset$1.h b/libjava/gnu/java/nio/charset/ByteCharset$1.h new file mode 100644 index 000000000..d99d7fa59 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteCharset$1.h @@ -0,0 +1,42 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteCharset$1__ +#define __gnu_java_nio_charset_ByteCharset$1__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteDecodeLoopHelper.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteCharset$1; + class ByteCharset$Decoder; + } + } + } + } +} + +class gnu::java::nio::charset::ByteCharset$1 : public ::gnu::java::nio::charset::ByteDecodeLoopHelper +{ + +public: // actually package-private + ByteCharset$1(::gnu::java::nio::charset::ByteCharset$Decoder *); +public: // actually protected + virtual jboolean isMappable(jbyte); + virtual jchar mapToChar(jbyte); +public: // actually package-private + ::gnu::java::nio::charset::ByteCharset$Decoder * __attribute__((aligned(__alignof__( ::gnu::java::nio::charset::ByteDecodeLoopHelper)))) this$1; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteCharset$1__ diff --git a/libjava/gnu/java/nio/charset/ByteCharset$2.h b/libjava/gnu/java/nio/charset/ByteCharset$2.h new file mode 100644 index 000000000..4a1db5249 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteCharset$2.h @@ -0,0 +1,42 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteCharset$2__ +#define __gnu_java_nio_charset_ByteCharset$2__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteEncodeLoopHelper.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteCharset$2; + class ByteCharset$Encoder; + } + } + } + } +} + +class gnu::java::nio::charset::ByteCharset$2 : public ::gnu::java::nio::charset::ByteEncodeLoopHelper +{ + +public: // actually package-private + ByteCharset$2(::gnu::java::nio::charset::ByteCharset$Encoder *); +public: // actually protected + virtual jboolean isMappable(jchar); + virtual jbyte mapToByte(jchar); +public: // actually package-private + ::gnu::java::nio::charset::ByteCharset$Encoder * __attribute__((aligned(__alignof__( ::gnu::java::nio::charset::ByteEncodeLoopHelper)))) this$1; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteCharset$2__ diff --git a/libjava/gnu/java/nio/charset/ByteCharset$Decoder.h b/libjava/gnu/java/nio/charset/ByteCharset$Decoder.h new file mode 100644 index 000000000..0f5dd6c65 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteCharset$Decoder.h @@ -0,0 +1,59 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteCharset$Decoder__ +#define __gnu_java_nio_charset_ByteCharset$Decoder__ + +#pragma interface + +#include <java/nio/charset/CharsetDecoder.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteCharset; + class ByteCharset$Decoder; + class ByteDecodeLoopHelper; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::ByteCharset$Decoder : public ::java::nio::charset::CharsetDecoder +{ + +public: // actually package-private + ByteCharset$Decoder(::gnu::java::nio::charset::ByteCharset *); +public: // actually protected + ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); +public: // actually package-private + static JArray< jchar > * access$0(::gnu::java::nio::charset::ByteCharset$Decoder *); +private: + JArray< jchar > * __attribute__((aligned(__alignof__( ::java::nio::charset::CharsetDecoder)))) lookup; + ::gnu::java::nio::charset::ByteDecodeLoopHelper * helper; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteCharset$Decoder__ diff --git a/libjava/gnu/java/nio/charset/ByteCharset$Encoder.h b/libjava/gnu/java/nio/charset/ByteCharset$Encoder.h new file mode 100644 index 000000000..019bb4b5d --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteCharset$Encoder.h @@ -0,0 +1,62 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteCharset$Encoder__ +#define __gnu_java_nio_charset_ByteCharset$Encoder__ + +#pragma interface + +#include <java/nio/charset/CharsetEncoder.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteCharset; + class ByteCharset$Encoder; + class ByteEncodeLoopHelper; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::ByteCharset$Encoder : public ::java::nio::charset::CharsetEncoder +{ + +public: // actually package-private + ByteCharset$Encoder(::gnu::java::nio::charset::ByteCharset *); +public: + jboolean canEncode(jchar); + jboolean canEncode(::java::lang::CharSequence *); +public: // actually protected + ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); +public: // actually package-private + static JArray< jbyte > * access$0(::gnu::java::nio::charset::ByteCharset$Encoder *); +private: + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::nio::charset::CharsetEncoder)))) lookup; + ::gnu::java::nio::charset::ByteEncodeLoopHelper * helper; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteCharset$Encoder__ diff --git a/libjava/gnu/java/nio/charset/ByteCharset.h b/libjava/gnu/java/nio/charset/ByteCharset.h new file mode 100644 index 000000000..aa0890cb1 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteCharset.h @@ -0,0 +1,60 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteCharset__ +#define __gnu_java_nio_charset_ByteCharset__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteCharset; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::ByteCharset : public ::java::nio::charset::Charset +{ + +public: // actually package-private + ByteCharset(::java::lang::String *, JArray< ::java::lang::String * > *, JArray< jchar > *); +public: + virtual jboolean contains(::java::nio::charset::Charset *); +public: // actually package-private + virtual JArray< jchar > * getLookupTable(); +public: + virtual ::java::nio::charset::CharsetDecoder * newDecoder(); + virtual ::java::nio::charset::CharsetEncoder * newEncoder(); +public: // actually protected + JArray< jchar > * __attribute__((aligned(__alignof__( ::java::nio::charset::Charset)))) lookupTable; + static const jchar NONE = 65533; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteCharset__ diff --git a/libjava/gnu/java/nio/charset/ByteDecodeLoopHelper.h b/libjava/gnu/java/nio/charset/ByteDecodeLoopHelper.h new file mode 100644 index 000000000..1a373a1bf --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteDecodeLoopHelper.h @@ -0,0 +1,56 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteDecodeLoopHelper__ +#define __gnu_java_nio_charset_ByteDecodeLoopHelper__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteDecodeLoopHelper; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::ByteDecodeLoopHelper : public ::java::lang::Object +{ + +public: + ByteDecodeLoopHelper(); +public: // actually protected + virtual jboolean isMappable(jbyte) = 0; + virtual jchar mapToChar(jbyte) = 0; +public: // actually package-private + virtual ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); +private: + ::java::nio::charset::CoderResult * normalDecodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); + ::java::nio::charset::CoderResult * arrayDecodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteDecodeLoopHelper__ diff --git a/libjava/gnu/java/nio/charset/ByteEncodeLoopHelper.h b/libjava/gnu/java/nio/charset/ByteEncodeLoopHelper.h new file mode 100644 index 000000000..0b67645e7 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ByteEncodeLoopHelper.h @@ -0,0 +1,56 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ByteEncodeLoopHelper__ +#define __gnu_java_nio_charset_ByteEncodeLoopHelper__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteEncodeLoopHelper; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::ByteEncodeLoopHelper : public ::java::lang::Object +{ + +public: + ByteEncodeLoopHelper(); +public: // actually protected + virtual jboolean isMappable(jchar) = 0; + virtual jbyte mapToByte(jchar) = 0; +public: // actually package-private + virtual ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); +private: + ::java::nio::charset::CoderResult * normalEncodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); + ::java::nio::charset::CoderResult * arrayEncodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ByteEncodeLoopHelper__ diff --git a/libjava/gnu/java/nio/charset/Cp424.h b/libjava/gnu/java/nio/charset/Cp424.h new file mode 100644 index 000000000..29ea29f67 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp424.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp424__ +#define __gnu_java_nio_charset_Cp424__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp424; + } + } + } + } +} + +class gnu::java::nio::charset::Cp424 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp424(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp424__ diff --git a/libjava/gnu/java/nio/charset/Cp437.h b/libjava/gnu/java/nio/charset/Cp437.h new file mode 100644 index 000000000..5593ff0ca --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp437.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp437__ +#define __gnu_java_nio_charset_Cp437__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp437; + } + } + } + } +} + +class gnu::java::nio::charset::Cp437 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp437(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp437__ diff --git a/libjava/gnu/java/nio/charset/Cp737.h b/libjava/gnu/java/nio/charset/Cp737.h new file mode 100644 index 000000000..583075b7c --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp737.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp737__ +#define __gnu_java_nio_charset_Cp737__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp737; + } + } + } + } +} + +class gnu::java::nio::charset::Cp737 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp737(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp737__ diff --git a/libjava/gnu/java/nio/charset/Cp775.h b/libjava/gnu/java/nio/charset/Cp775.h new file mode 100644 index 000000000..995b7f621 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp775.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp775__ +#define __gnu_java_nio_charset_Cp775__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp775; + } + } + } + } +} + +class gnu::java::nio::charset::Cp775 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp775(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp775__ diff --git a/libjava/gnu/java/nio/charset/Cp850.h b/libjava/gnu/java/nio/charset/Cp850.h new file mode 100644 index 000000000..e1a17deda --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp850.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp850__ +#define __gnu_java_nio_charset_Cp850__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp850; + } + } + } + } +} + +class gnu::java::nio::charset::Cp850 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp850(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp850__ diff --git a/libjava/gnu/java/nio/charset/Cp852.h b/libjava/gnu/java/nio/charset/Cp852.h new file mode 100644 index 000000000..e5ff8292d --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp852.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp852__ +#define __gnu_java_nio_charset_Cp852__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp852; + } + } + } + } +} + +class gnu::java::nio::charset::Cp852 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp852(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp852__ diff --git a/libjava/gnu/java/nio/charset/Cp855.h b/libjava/gnu/java/nio/charset/Cp855.h new file mode 100644 index 000000000..2ff372c76 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp855.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp855__ +#define __gnu_java_nio_charset_Cp855__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp855; + } + } + } + } +} + +class gnu::java::nio::charset::Cp855 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp855(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp855__ diff --git a/libjava/gnu/java/nio/charset/Cp857.h b/libjava/gnu/java/nio/charset/Cp857.h new file mode 100644 index 000000000..eba0a48a4 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp857.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp857__ +#define __gnu_java_nio_charset_Cp857__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp857; + } + } + } + } +} + +class gnu::java::nio::charset::Cp857 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp857(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp857__ diff --git a/libjava/gnu/java/nio/charset/Cp860.h b/libjava/gnu/java/nio/charset/Cp860.h new file mode 100644 index 000000000..a93098358 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp860.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp860__ +#define __gnu_java_nio_charset_Cp860__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp860; + } + } + } + } +} + +class gnu::java::nio::charset::Cp860 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp860(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp860__ diff --git a/libjava/gnu/java/nio/charset/Cp861.h b/libjava/gnu/java/nio/charset/Cp861.h new file mode 100644 index 000000000..04d202c7f --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp861.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp861__ +#define __gnu_java_nio_charset_Cp861__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp861; + } + } + } + } +} + +class gnu::java::nio::charset::Cp861 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp861(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp861__ diff --git a/libjava/gnu/java/nio/charset/Cp862.h b/libjava/gnu/java/nio/charset/Cp862.h new file mode 100644 index 000000000..8ddc349f5 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp862.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp862__ +#define __gnu_java_nio_charset_Cp862__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp862; + } + } + } + } +} + +class gnu::java::nio::charset::Cp862 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp862(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp862__ diff --git a/libjava/gnu/java/nio/charset/Cp863.h b/libjava/gnu/java/nio/charset/Cp863.h new file mode 100644 index 000000000..76902574a --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp863.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp863__ +#define __gnu_java_nio_charset_Cp863__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp863; + } + } + } + } +} + +class gnu::java::nio::charset::Cp863 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp863(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp863__ diff --git a/libjava/gnu/java/nio/charset/Cp864.h b/libjava/gnu/java/nio/charset/Cp864.h new file mode 100644 index 000000000..3f245f7ad --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp864.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp864__ +#define __gnu_java_nio_charset_Cp864__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp864; + } + } + } + } +} + +class gnu::java::nio::charset::Cp864 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp864(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp864__ diff --git a/libjava/gnu/java/nio/charset/Cp865.h b/libjava/gnu/java/nio/charset/Cp865.h new file mode 100644 index 000000000..78c43729e --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp865.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp865__ +#define __gnu_java_nio_charset_Cp865__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp865; + } + } + } + } +} + +class gnu::java::nio::charset::Cp865 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp865(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp865__ diff --git a/libjava/gnu/java/nio/charset/Cp866.h b/libjava/gnu/java/nio/charset/Cp866.h new file mode 100644 index 000000000..2c6375a9e --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp866.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp866__ +#define __gnu_java_nio_charset_Cp866__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp866; + } + } + } + } +} + +class gnu::java::nio::charset::Cp866 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp866(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp866__ diff --git a/libjava/gnu/java/nio/charset/Cp869.h b/libjava/gnu/java/nio/charset/Cp869.h new file mode 100644 index 000000000..bc67408de --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp869.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp869__ +#define __gnu_java_nio_charset_Cp869__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp869; + } + } + } + } +} + +class gnu::java::nio::charset::Cp869 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp869(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp869__ diff --git a/libjava/gnu/java/nio/charset/Cp874.h b/libjava/gnu/java/nio/charset/Cp874.h new file mode 100644 index 000000000..590f84d77 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Cp874.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Cp874__ +#define __gnu_java_nio_charset_Cp874__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Cp874; + } + } + } + } +} + +class gnu::java::nio::charset::Cp874 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Cp874(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Cp874__ diff --git a/libjava/gnu/java/nio/charset/EncodingHelper.h b/libjava/gnu/java/nio/charset/EncodingHelper.h new file mode 100644 index 000000000..7fbd28968 --- /dev/null +++ b/libjava/gnu/java/nio/charset/EncodingHelper.h @@ -0,0 +1,53 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_EncodingHelper__ +#define __gnu_java_nio_charset_EncodingHelper__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class EncodingHelper; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + } + } + } +} + +class gnu::java::nio::charset::EncodingHelper : public ::java::lang::Object +{ + +public: + EncodingHelper(); + static ::java::lang::String * getDefaultEncoding(); + static ::java::lang::String * getOldCanonical(::java::lang::String *); + static jboolean isISOLatin1(::java::lang::String *); + static ::java::nio::charset::Charset * getCharset(::java::lang::String *); + static ::java::nio::charset::Charset * getDefaultCharset(); +private: + static ::java::util::HashMap * canonicalNames; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_EncodingHelper__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_1$1.h b/libjava/gnu/java/nio/charset/ISO_8859_1$1.h new file mode 100644 index 000000000..a13c36def --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_1$1.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_1$1__ +#define __gnu_java_nio_charset_ISO_8859_1$1__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteDecodeLoopHelper.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_1$1; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_1$1 : public ::gnu::java::nio::charset::ByteDecodeLoopHelper +{ + +public: // actually package-private + ISO_8859_1$1(); +public: // actually protected + virtual jboolean isMappable(jbyte); + virtual jchar mapToChar(jbyte); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_1$1__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_1$2.h b/libjava/gnu/java/nio/charset/ISO_8859_1$2.h new file mode 100644 index 000000000..52294261e --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_1$2.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_1$2__ +#define __gnu_java_nio_charset_ISO_8859_1$2__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteEncodeLoopHelper.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_1$2; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_1$2 : public ::gnu::java::nio::charset::ByteEncodeLoopHelper +{ + +public: // actually package-private + ISO_8859_1$2(); +public: // actually protected + virtual jboolean isMappable(jchar); + virtual jbyte mapToByte(jchar); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_1$2__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_1$Decoder.h b/libjava/gnu/java/nio/charset/ISO_8859_1$Decoder.h new file mode 100644 index 000000000..25e97ee0d --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_1$Decoder.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_1$Decoder__ +#define __gnu_java_nio_charset_ISO_8859_1$Decoder__ + +#pragma interface + +#include <java/nio/charset/CharsetDecoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteDecodeLoopHelper; + class ISO_8859_1$Decoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_1$Decoder : public ::java::nio::charset::CharsetDecoder +{ + +public: // actually package-private + ISO_8859_1$Decoder(::java::nio::charset::Charset *); +public: // actually protected + ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); +private: + static ::gnu::java::nio::charset::ByteDecodeLoopHelper * helper; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_1$Decoder__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_1$Encoder.h b/libjava/gnu/java/nio/charset/ISO_8859_1$Encoder.h new file mode 100644 index 000000000..e4da289cc --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_1$Encoder.h @@ -0,0 +1,57 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_1$Encoder__ +#define __gnu_java_nio_charset_ISO_8859_1$Encoder__ + +#pragma interface + +#include <java/nio/charset/CharsetEncoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteEncodeLoopHelper; + class ISO_8859_1$Encoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_1$Encoder : public ::java::nio::charset::CharsetEncoder +{ + +public: // actually package-private + ISO_8859_1$Encoder(::java::nio::charset::Charset *); +public: + jboolean canEncode(jchar); + jboolean canEncode(::java::lang::CharSequence *); +public: // actually protected + ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); +private: + static ::gnu::java::nio::charset::ByteEncodeLoopHelper * helper; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_1$Encoder__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_1.h b/libjava/gnu/java/nio/charset/ISO_8859_1.h new file mode 100644 index 000000000..dc03558f9 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_1.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_1__ +#define __gnu_java_nio_charset_ISO_8859_1__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_1; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_1 : public ::java::nio::charset::Charset +{ + +public: // actually package-private + ISO_8859_1(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_1__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_13.h b/libjava/gnu/java/nio/charset/ISO_8859_13.h new file mode 100644 index 000000000..dfe4240af --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_13.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_13__ +#define __gnu_java_nio_charset_ISO_8859_13__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_13; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_13 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_13(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_13__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_15.h b/libjava/gnu/java/nio/charset/ISO_8859_15.h new file mode 100644 index 000000000..617e2271b --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_15.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_15__ +#define __gnu_java_nio_charset_ISO_8859_15__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_15; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_15 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_15(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_15__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_2.h b/libjava/gnu/java/nio/charset/ISO_8859_2.h new file mode 100644 index 000000000..e201ddc55 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_2.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_2__ +#define __gnu_java_nio_charset_ISO_8859_2__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_2; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_2 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_2(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_2__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_3.h b/libjava/gnu/java/nio/charset/ISO_8859_3.h new file mode 100644 index 000000000..3c468fd52 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_3.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_3__ +#define __gnu_java_nio_charset_ISO_8859_3__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_3; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_3 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_3(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_3__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_4.h b/libjava/gnu/java/nio/charset/ISO_8859_4.h new file mode 100644 index 000000000..f338bf002 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_4.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_4__ +#define __gnu_java_nio_charset_ISO_8859_4__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_4; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_4 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_4(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_4__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_5.h b/libjava/gnu/java/nio/charset/ISO_8859_5.h new file mode 100644 index 000000000..4d626d022 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_5.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_5__ +#define __gnu_java_nio_charset_ISO_8859_5__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_5; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_5 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_5(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_5__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_6.h b/libjava/gnu/java/nio/charset/ISO_8859_6.h new file mode 100644 index 000000000..0ce45f24d --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_6.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_6__ +#define __gnu_java_nio_charset_ISO_8859_6__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_6; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_6 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_6(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_6__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_7.h b/libjava/gnu/java/nio/charset/ISO_8859_7.h new file mode 100644 index 000000000..0c661fa92 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_7.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_7__ +#define __gnu_java_nio_charset_ISO_8859_7__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_7; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_7 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_7(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_7__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_8.h b/libjava/gnu/java/nio/charset/ISO_8859_8.h new file mode 100644 index 000000000..96a255e43 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_8.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_8__ +#define __gnu_java_nio_charset_ISO_8859_8__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_8; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_8 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_8(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_8__ diff --git a/libjava/gnu/java/nio/charset/ISO_8859_9.h b/libjava/gnu/java/nio/charset/ISO_8859_9.h new file mode 100644 index 000000000..a5030b788 --- /dev/null +++ b/libjava/gnu/java/nio/charset/ISO_8859_9.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_ISO_8859_9__ +#define __gnu_java_nio_charset_ISO_8859_9__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ISO_8859_9; + } + } + } + } +} + +class gnu::java::nio::charset::ISO_8859_9 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + ISO_8859_9(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_ISO_8859_9__ diff --git a/libjava/gnu/java/nio/charset/KOI_8.h b/libjava/gnu/java/nio/charset/KOI_8.h new file mode 100644 index 000000000..db07f142b --- /dev/null +++ b/libjava/gnu/java/nio/charset/KOI_8.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_KOI_8__ +#define __gnu_java_nio_charset_KOI_8__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class KOI_8; + } + } + } + } +} + +class gnu::java::nio::charset::KOI_8 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + KOI_8(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_KOI_8__ diff --git a/libjava/gnu/java/nio/charset/MS874.h b/libjava/gnu/java/nio/charset/MS874.h new file mode 100644 index 000000000..c22c860b6 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MS874.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MS874__ +#define __gnu_java_nio_charset_MS874__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MS874; + } + } + } + } +} + +class gnu::java::nio::charset::MS874 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MS874(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MS874__ diff --git a/libjava/gnu/java/nio/charset/MacCentralEurope.h b/libjava/gnu/java/nio/charset/MacCentralEurope.h new file mode 100644 index 000000000..c91c915f0 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacCentralEurope.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacCentralEurope__ +#define __gnu_java_nio_charset_MacCentralEurope__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacCentralEurope; + } + } + } + } +} + +class gnu::java::nio::charset::MacCentralEurope : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacCentralEurope(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacCentralEurope__ diff --git a/libjava/gnu/java/nio/charset/MacCroatian.h b/libjava/gnu/java/nio/charset/MacCroatian.h new file mode 100644 index 000000000..8c03767f2 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacCroatian.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacCroatian__ +#define __gnu_java_nio_charset_MacCroatian__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacCroatian; + } + } + } + } +} + +class gnu::java::nio::charset::MacCroatian : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacCroatian(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacCroatian__ diff --git a/libjava/gnu/java/nio/charset/MacCyrillic.h b/libjava/gnu/java/nio/charset/MacCyrillic.h new file mode 100644 index 000000000..4190da579 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacCyrillic.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacCyrillic__ +#define __gnu_java_nio_charset_MacCyrillic__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacCyrillic; + } + } + } + } +} + +class gnu::java::nio::charset::MacCyrillic : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacCyrillic(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacCyrillic__ diff --git a/libjava/gnu/java/nio/charset/MacDingbat.h b/libjava/gnu/java/nio/charset/MacDingbat.h new file mode 100644 index 000000000..05995390b --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacDingbat.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacDingbat__ +#define __gnu_java_nio_charset_MacDingbat__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacDingbat; + } + } + } + } +} + +class gnu::java::nio::charset::MacDingbat : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacDingbat(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacDingbat__ diff --git a/libjava/gnu/java/nio/charset/MacGreek.h b/libjava/gnu/java/nio/charset/MacGreek.h new file mode 100644 index 000000000..df1f52fbb --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacGreek.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacGreek__ +#define __gnu_java_nio_charset_MacGreek__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacGreek; + } + } + } + } +} + +class gnu::java::nio::charset::MacGreek : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacGreek(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacGreek__ diff --git a/libjava/gnu/java/nio/charset/MacIceland.h b/libjava/gnu/java/nio/charset/MacIceland.h new file mode 100644 index 000000000..e8878e8ee --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacIceland.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacIceland__ +#define __gnu_java_nio_charset_MacIceland__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacIceland; + } + } + } + } +} + +class gnu::java::nio::charset::MacIceland : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacIceland(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacIceland__ diff --git a/libjava/gnu/java/nio/charset/MacRoman.h b/libjava/gnu/java/nio/charset/MacRoman.h new file mode 100644 index 000000000..a648b80cd --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacRoman.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacRoman__ +#define __gnu_java_nio_charset_MacRoman__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacRoman; + } + } + } + } +} + +class gnu::java::nio::charset::MacRoman : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacRoman(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacRoman__ diff --git a/libjava/gnu/java/nio/charset/MacRomania.h b/libjava/gnu/java/nio/charset/MacRomania.h new file mode 100644 index 000000000..ecc89ed4f --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacRomania.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacRomania__ +#define __gnu_java_nio_charset_MacRomania__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacRomania; + } + } + } + } +} + +class gnu::java::nio::charset::MacRomania : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacRomania(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacRomania__ diff --git a/libjava/gnu/java/nio/charset/MacSymbol.h b/libjava/gnu/java/nio/charset/MacSymbol.h new file mode 100644 index 000000000..e9ca0b1b4 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacSymbol.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacSymbol__ +#define __gnu_java_nio_charset_MacSymbol__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacSymbol; + } + } + } + } +} + +class gnu::java::nio::charset::MacSymbol : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacSymbol(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacSymbol__ diff --git a/libjava/gnu/java/nio/charset/MacThai.h b/libjava/gnu/java/nio/charset/MacThai.h new file mode 100644 index 000000000..dbf916687 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacThai.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacThai__ +#define __gnu_java_nio_charset_MacThai__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacThai; + } + } + } + } +} + +class gnu::java::nio::charset::MacThai : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacThai(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacThai__ diff --git a/libjava/gnu/java/nio/charset/MacTurkish.h b/libjava/gnu/java/nio/charset/MacTurkish.h new file mode 100644 index 000000000..077c35d26 --- /dev/null +++ b/libjava/gnu/java/nio/charset/MacTurkish.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_MacTurkish__ +#define __gnu_java_nio_charset_MacTurkish__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class MacTurkish; + } + } + } + } +} + +class gnu::java::nio::charset::MacTurkish : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + MacTurkish(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_MacTurkish__ diff --git a/libjava/gnu/java/nio/charset/Provider$1.h b/libjava/gnu/java/nio/charset/Provider$1.h new file mode 100644 index 000000000..4db0425cd --- /dev/null +++ b/libjava/gnu/java/nio/charset/Provider$1.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Provider$1__ +#define __gnu_java_nio_charset_Provider$1__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Provider; + class Provider$1; + } + } + } + } +} + +class gnu::java::nio::charset::Provider$1 : public ::java::lang::Object +{ + +public: // actually package-private + Provider$1(); +public: + virtual ::gnu::java::nio::charset::Provider * Provider$1$run(); + virtual ::java::lang::Object * run(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Provider$1__ diff --git a/libjava/gnu/java/nio/charset/Provider.h b/libjava/gnu/java/nio/charset/Provider.h new file mode 100644 index 000000000..04495ed8c --- /dev/null +++ b/libjava/gnu/java/nio/charset/Provider.h @@ -0,0 +1,60 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Provider__ +#define __gnu_java_nio_charset_Provider__ + +#pragma interface + +#include <java/nio/charset/spi/CharsetProvider.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Provider; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + } + } + } +} + +class gnu::java::nio::charset::Provider : public ::java::nio::charset::spi::CharsetProvider +{ + +public: // actually package-private + Provider(); +private: + void loadExtended(); +public: + ::java::util::Iterator * charsets(); + ::java::nio::charset::Charset * charsetForName(::java::lang::String *); +private: + void addCharset(::java::nio::charset::Charset *); +public: + static ::gnu::java::nio::charset::Provider * provider(); +private: + static ::gnu::java::nio::charset::Provider * singleton; + ::java::util::HashMap * __attribute__((aligned(__alignof__( ::java::nio::charset::spi::CharsetProvider)))) canonicalNames; + ::java::util::HashMap * charsets__; + jboolean extendedLoaded; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Provider__ diff --git a/libjava/gnu/java/nio/charset/US_ASCII$1.h b/libjava/gnu/java/nio/charset/US_ASCII$1.h new file mode 100644 index 000000000..ca8ff5980 --- /dev/null +++ b/libjava/gnu/java/nio/charset/US_ASCII$1.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_US_ASCII$1__ +#define __gnu_java_nio_charset_US_ASCII$1__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteDecodeLoopHelper.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class US_ASCII$1; + } + } + } + } +} + +class gnu::java::nio::charset::US_ASCII$1 : public ::gnu::java::nio::charset::ByteDecodeLoopHelper +{ + +public: // actually package-private + US_ASCII$1(); +public: // actually protected + virtual jboolean isMappable(jbyte); + virtual jchar mapToChar(jbyte); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_US_ASCII$1__ diff --git a/libjava/gnu/java/nio/charset/US_ASCII$2.h b/libjava/gnu/java/nio/charset/US_ASCII$2.h new file mode 100644 index 000000000..5a62bd950 --- /dev/null +++ b/libjava/gnu/java/nio/charset/US_ASCII$2.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_US_ASCII$2__ +#define __gnu_java_nio_charset_US_ASCII$2__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteEncodeLoopHelper.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class US_ASCII$2; + } + } + } + } +} + +class gnu::java::nio::charset::US_ASCII$2 : public ::gnu::java::nio::charset::ByteEncodeLoopHelper +{ + +public: // actually package-private + US_ASCII$2(); +public: // actually protected + virtual jboolean isMappable(jchar); + virtual jbyte mapToByte(jchar); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_US_ASCII$2__ diff --git a/libjava/gnu/java/nio/charset/US_ASCII$Decoder.h b/libjava/gnu/java/nio/charset/US_ASCII$Decoder.h new file mode 100644 index 000000000..9659ac2e7 --- /dev/null +++ b/libjava/gnu/java/nio/charset/US_ASCII$Decoder.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_US_ASCII$Decoder__ +#define __gnu_java_nio_charset_US_ASCII$Decoder__ + +#pragma interface + +#include <java/nio/charset/CharsetDecoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteDecodeLoopHelper; + class US_ASCII$Decoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::US_ASCII$Decoder : public ::java::nio::charset::CharsetDecoder +{ + +public: // actually package-private + US_ASCII$Decoder(::java::nio::charset::Charset *); +public: // actually protected + ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); +private: + static ::gnu::java::nio::charset::ByteDecodeLoopHelper * helper; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_US_ASCII$Decoder__ diff --git a/libjava/gnu/java/nio/charset/US_ASCII$Encoder.h b/libjava/gnu/java/nio/charset/US_ASCII$Encoder.h new file mode 100644 index 000000000..467f6b770 --- /dev/null +++ b/libjava/gnu/java/nio/charset/US_ASCII$Encoder.h @@ -0,0 +1,57 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_US_ASCII$Encoder__ +#define __gnu_java_nio_charset_US_ASCII$Encoder__ + +#pragma interface + +#include <java/nio/charset/CharsetEncoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class ByteEncodeLoopHelper; + class US_ASCII$Encoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::US_ASCII$Encoder : public ::java::nio::charset::CharsetEncoder +{ + +public: // actually package-private + US_ASCII$Encoder(::java::nio::charset::Charset *); +public: + jboolean canEncode(jchar); + jboolean canEncode(::java::lang::CharSequence *); +public: // actually protected + ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); +private: + static ::gnu::java::nio::charset::ByteEncodeLoopHelper * helper; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_US_ASCII$Encoder__ diff --git a/libjava/gnu/java/nio/charset/US_ASCII.h b/libjava/gnu/java/nio/charset/US_ASCII.h new file mode 100644 index 000000000..297cf1114 --- /dev/null +++ b/libjava/gnu/java/nio/charset/US_ASCII.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_US_ASCII__ +#define __gnu_java_nio_charset_US_ASCII__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class US_ASCII; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::US_ASCII : public ::java::nio::charset::Charset +{ + +public: // actually package-private + US_ASCII(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_US_ASCII__ diff --git a/libjava/gnu/java/nio/charset/UTF_16.h b/libjava/gnu/java/nio/charset/UTF_16.h new file mode 100644 index 000000000..afb0fd8fa --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_16.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_16__ +#define __gnu_java_nio_charset_UTF_16__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_16; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::UTF_16 : public ::java::nio::charset::Charset +{ + +public: // actually package-private + UTF_16(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_16__ diff --git a/libjava/gnu/java/nio/charset/UTF_16BE.h b/libjava/gnu/java/nio/charset/UTF_16BE.h new file mode 100644 index 000000000..8b2bccfed --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_16BE.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_16BE__ +#define __gnu_java_nio_charset_UTF_16BE__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_16BE; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::UTF_16BE : public ::java::nio::charset::Charset +{ + +public: // actually package-private + UTF_16BE(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_16BE__ diff --git a/libjava/gnu/java/nio/charset/UTF_16Decoder.h b/libjava/gnu/java/nio/charset/UTF_16Decoder.h new file mode 100644 index 000000000..b23c3e72b --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_16Decoder.h @@ -0,0 +1,63 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_16Decoder__ +#define __gnu_java_nio_charset_UTF_16Decoder__ + +#pragma interface + +#include <java/nio/charset/CharsetDecoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_16Decoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::UTF_16Decoder : public ::java::nio::charset::CharsetDecoder +{ + +public: // actually package-private + UTF_16Decoder(::java::nio::charset::Charset *, jint); +public: // actually protected + ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); + void implReset(); +public: // actually package-private + static const jint BIG_ENDIAN = 0; + static const jint LITTLE_ENDIAN = 1; + static const jint UNKNOWN_ENDIAN = 2; + static const jint MAYBE_BIG_ENDIAN = 3; + static const jint MAYBE_LITTLE_ENDIAN = 4; +private: + static const jchar BYTE_ORDER_MARK = 65279; + static const jchar REVERSED_BYTE_ORDER_MARK = 65534; + jint __attribute__((aligned(__alignof__( ::java::nio::charset::CharsetDecoder)))) originalByteOrder; + jint byteOrder; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_16Decoder__ diff --git a/libjava/gnu/java/nio/charset/UTF_16Encoder.h b/libjava/gnu/java/nio/charset/UTF_16Encoder.h new file mode 100644 index 000000000..9dc499484 --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_16Encoder.h @@ -0,0 +1,61 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_16Encoder__ +#define __gnu_java_nio_charset_UTF_16Encoder__ + +#pragma interface + +#include <java/nio/charset/CharsetEncoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_16Encoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::UTF_16Encoder : public ::java::nio::charset::CharsetEncoder +{ + +public: // actually package-private + UTF_16Encoder(::java::nio::charset::Charset *, jint, jboolean); +public: // actually protected + ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); + void implReset(); +public: // actually package-private + static const jint BIG_ENDIAN = 0; + static const jint LITTLE_ENDIAN = 1; +private: + static const jchar BYTE_ORDER_MARK = 65279; + ::java::nio::ByteOrder * __attribute__((aligned(__alignof__( ::java::nio::charset::CharsetEncoder)))) byteOrder; + jboolean useByteOrderMark; + jboolean needsByteOrderMark; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_16Encoder__ diff --git a/libjava/gnu/java/nio/charset/UTF_16LE.h b/libjava/gnu/java/nio/charset/UTF_16LE.h new file mode 100644 index 000000000..8b5ee1b35 --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_16LE.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_16LE__ +#define __gnu_java_nio_charset_UTF_16LE__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_16LE; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::UTF_16LE : public ::java::nio::charset::Charset +{ + +public: // actually package-private + UTF_16LE(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_16LE__ diff --git a/libjava/gnu/java/nio/charset/UTF_8$Decoder.h b/libjava/gnu/java/nio/charset/UTF_8$Decoder.h new file mode 100644 index 000000000..89ec73287 --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_8$Decoder.h @@ -0,0 +1,53 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_8$Decoder__ +#define __gnu_java_nio_charset_UTF_8$Decoder__ + +#pragma interface + +#include <java/nio/charset/CharsetDecoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_8$Decoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::UTF_8$Decoder : public ::java::nio::charset::CharsetDecoder +{ + +public: // actually package-private + UTF_8$Decoder(::java::nio::charset::Charset *); +public: // actually protected + ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *); +private: + static jboolean isContinuation(jbyte); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_8$Decoder__ diff --git a/libjava/gnu/java/nio/charset/UTF_8$Encoder.h b/libjava/gnu/java/nio/charset/UTF_8$Encoder.h new file mode 100644 index 000000000..13745f293 --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_8$Encoder.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_8$Encoder__ +#define __gnu_java_nio_charset_UTF_8$Encoder__ + +#pragma interface + +#include <java/nio/charset/CharsetEncoder.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_8$Encoder; + } + } + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CoderResult; + } + } + } +} + +class gnu::java::nio::charset::UTF_8$Encoder : public ::java::nio::charset::CharsetEncoder +{ + +public: // actually package-private + UTF_8$Encoder(::java::nio::charset::Charset *); +public: // actually protected + ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *); +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_8$Encoder__ diff --git a/libjava/gnu/java/nio/charset/UTF_8.h b/libjava/gnu/java/nio/charset/UTF_8.h new file mode 100644 index 000000000..0be5e400a --- /dev/null +++ b/libjava/gnu/java/nio/charset/UTF_8.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UTF_8__ +#define __gnu_java_nio_charset_UTF_8__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UTF_8; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::UTF_8 : public ::java::nio::charset::Charset +{ + +public: // actually package-private + UTF_8(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UTF_8__ diff --git a/libjava/gnu/java/nio/charset/UnicodeLittle.h b/libjava/gnu/java/nio/charset/UnicodeLittle.h new file mode 100644 index 000000000..8086fd8a6 --- /dev/null +++ b/libjava/gnu/java/nio/charset/UnicodeLittle.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_UnicodeLittle__ +#define __gnu_java_nio_charset_UnicodeLittle__ + +#pragma interface + +#include <java/nio/charset/Charset.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class UnicodeLittle; + } + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class gnu::java::nio::charset::UnicodeLittle : public ::java::nio::charset::Charset +{ + +public: // actually package-private + UnicodeLittle(); +public: + jboolean contains(::java::nio::charset::Charset *); + ::java::nio::charset::CharsetDecoder * newDecoder(); + ::java::nio::charset::CharsetEncoder * newEncoder(); + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_UnicodeLittle__ diff --git a/libjava/gnu/java/nio/charset/Windows1250.h b/libjava/gnu/java/nio/charset/Windows1250.h new file mode 100644 index 000000000..3e0bdae7e --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1250.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1250__ +#define __gnu_java_nio_charset_Windows1250__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1250; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1250 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1250(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1250__ diff --git a/libjava/gnu/java/nio/charset/Windows1251.h b/libjava/gnu/java/nio/charset/Windows1251.h new file mode 100644 index 000000000..5671f5a47 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1251.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1251__ +#define __gnu_java_nio_charset_Windows1251__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1251; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1251 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1251(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1251__ diff --git a/libjava/gnu/java/nio/charset/Windows1252.h b/libjava/gnu/java/nio/charset/Windows1252.h new file mode 100644 index 000000000..f1e18a51b --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1252.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1252__ +#define __gnu_java_nio_charset_Windows1252__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1252; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1252 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1252(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1252__ diff --git a/libjava/gnu/java/nio/charset/Windows1253.h b/libjava/gnu/java/nio/charset/Windows1253.h new file mode 100644 index 000000000..4c9199d6f --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1253.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1253__ +#define __gnu_java_nio_charset_Windows1253__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1253; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1253 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1253(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1253__ diff --git a/libjava/gnu/java/nio/charset/Windows1254.h b/libjava/gnu/java/nio/charset/Windows1254.h new file mode 100644 index 000000000..d14346deb --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1254.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1254__ +#define __gnu_java_nio_charset_Windows1254__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1254; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1254 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1254(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1254__ diff --git a/libjava/gnu/java/nio/charset/Windows1255.h b/libjava/gnu/java/nio/charset/Windows1255.h new file mode 100644 index 000000000..e8367b4a4 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1255.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1255__ +#define __gnu_java_nio_charset_Windows1255__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1255; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1255 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1255(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1255__ diff --git a/libjava/gnu/java/nio/charset/Windows1256.h b/libjava/gnu/java/nio/charset/Windows1256.h new file mode 100644 index 000000000..c29502bd4 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1256.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1256__ +#define __gnu_java_nio_charset_Windows1256__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1256; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1256 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1256(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1256__ diff --git a/libjava/gnu/java/nio/charset/Windows1257.h b/libjava/gnu/java/nio/charset/Windows1257.h new file mode 100644 index 000000000..6f9c0ec4a --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1257.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1257__ +#define __gnu_java_nio_charset_Windows1257__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1257; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1257 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1257(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1257__ diff --git a/libjava/gnu/java/nio/charset/Windows1258.h b/libjava/gnu/java/nio/charset/Windows1258.h new file mode 100644 index 000000000..2c7ea3185 --- /dev/null +++ b/libjava/gnu/java/nio/charset/Windows1258.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __gnu_java_nio_charset_Windows1258__ +#define __gnu_java_nio_charset_Windows1258__ + +#pragma interface + +#include <gnu/java/nio/charset/ByteCharset.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace charset + { + class Windows1258; + } + } + } + } +} + +class gnu::java::nio::charset::Windows1258 : public ::gnu::java::nio::charset::ByteCharset +{ + +public: + Windows1258(); +private: + static JArray< jchar > * lookup; +public: + static ::java::lang::Class class$; +}; + +#endif // __gnu_java_nio_charset_Windows1258__ diff --git a/libjava/gnu/java/nio/natNIOServerSocket.cc b/libjava/gnu/java/nio/natNIOServerSocket.cc new file mode 100644 index 000000000..2d3fb2db7 --- /dev/null +++ b/libjava/gnu/java/nio/natNIOServerSocket.cc @@ -0,0 +1,24 @@ +// natNIOServerSocket.cc + +/* Copyright (C) 2003 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <gnu/java/net/PlainSocketImpl.h> +#include <gnu/java/nio/NIOServerSocket.h> +#include <java/net/ServerSocket.h> +#include <java/net/SocketImpl.h> + +gnu::java::net::PlainSocketImpl* +gnu::java::nio::NIOServerSocket::getPlainSocketImpl() +{ + return (gnu::java::net::PlainSocketImpl*) + ::java::net::ServerSocket::getImpl(); +} diff --git a/libjava/gnu/java/nio/natVMChannel.cc b/libjava/gnu/java/nio/natVMChannel.cc new file mode 100644 index 000000000..4b4da7896 --- /dev/null +++ b/libjava/gnu/java/nio/natVMChannel.cc @@ -0,0 +1,46 @@ +#include <config.h> + +#include <gnu/java/nio/VMChannel.h> +#include <gcj/cni.h> +#include <java/lang/UnsupportedOperationException.h> + +void +gnu::java::nio::VMChannel::setBlocking (jint, jboolean) +{ + throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::nio::VMChannel::setBlocking (jint, jboolean) not implemented")); +} + + +jint +gnu::java::nio::VMChannel::read (jint, ::java::nio::ByteBuffer *) +{ + throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::nio::VMChannel::read (jint, ::java::nio::ByteBuffer *) not implemented")); +} + + +jlong +gnu::java::nio::VMChannel::readScattering (jint, JArray< ::java::nio::ByteBuffer *> *, jint, jint) +{ + throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::nio::VMChannel::readScattering (jint, JArray< ::java::nio::ByteBuffer *> *, jint, jint) not implemented")); +} + + +jint +gnu::java::nio::VMChannel::write (jint, ::java::nio::ByteBuffer *) +{ + throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::nio::VMChannel::write (jint, ::java::nio::ByteBuffer *) not implemented")); +} + + +jlong +gnu::java::nio::VMChannel::writeGathering (jint, JArray< ::java::nio::ByteBuffer *> *, jint, jint) +{ + throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::nio::VMChannel::writeGathering (jint, JArray< ::java::nio::ByteBuffer *> *, jint, jint) not implemented")); +} + + +void +gnu::java::nio::VMChannel::initIDs () +{ + throw new ::java::lang::UnsupportedOperationException (JvNewStringLatin1 ("gnu::java::nio::VMChannel::initIDs () not implemented")); +} diff --git a/libjava/gnu/java/nio/natVMPipeEcos.cc b/libjava/gnu/java/nio/natVMPipeEcos.cc new file mode 100644 index 000000000..c806fb49e --- /dev/null +++ b/libjava/gnu/java/nio/natVMPipeEcos.cc @@ -0,0 +1,27 @@ +// natVMPipeImplEcos.cc + +/* Copyright (C) 2003, 2004, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include <gnu/java/nio/PipeImpl.h> +#include <gnu/java/nio/VMPipe.h> +#include <java/io/IOException.h> + +void +gnu::java::nio::VMPipe::init (gnu::java::nio::PipeImpl *self, + ::java::nio::channels::spi::SelectorProvider*) +{ + throw new ::java::io::IOException (JvNewStringUTF ("nativeInit() not implemented")); +} diff --git a/libjava/gnu/java/nio/natVMPipePosix.cc b/libjava/gnu/java/nio/natVMPipePosix.cc new file mode 100644 index 000000000..3de136a6e --- /dev/null +++ b/libjava/gnu/java/nio/natVMPipePosix.cc @@ -0,0 +1,41 @@ +// natVMPipeImplPosix.cc + +/* Copyright (C) 2003, 2004, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include <gnu/java/nio/PipeImpl.h> +#include <gnu/java/nio/VMPipe.h> +//#include <gnu/java/nio/PipeImpl$SinkChannelImpl.h> +//#include <gnu/java/nio/PipeImpl$SourceChannelImpl.h> +#include <java/io/IOException.h> +#include <java/nio/channels/spi/SelectorProvider.h> + +void +gnu::java::nio::VMPipe::init (gnu::java::nio::PipeImpl*, /*self*/ + ::java::nio::channels::spi::SelectorProvider* + /*provider*/) +{ + int filedes [2]; + + if (_Jv_pipe (filedes) < 0) + throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); + + /* FIXME + source = new gnu::java::nio::PipeImpl$SourceChannelImpl + (this, provider, filedes [0]); + sink = new gnu::java::nio::PipeImpl$SinkChannelImpl + (this, provider, filedes [1]); + */ +} diff --git a/libjava/gnu/java/nio/natVMPipeWin32.cc b/libjava/gnu/java/nio/natVMPipeWin32.cc new file mode 100644 index 000000000..5278c7a89 --- /dev/null +++ b/libjava/gnu/java/nio/natVMPipeWin32.cc @@ -0,0 +1,40 @@ +// natVMPipeImplWin32.cc + +/* Copyright (C) 2003, 2004, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <errno.h> +#include <string.h> +#include <unistd.h> + +#include <gnu/java/nio/PipeImpl.h> +#include <gnu/java/nio/VMPipe.h> +//#include <gnu/java/nio/PipeImpl$SinkChannelImpl.h> +//#include <gnu/java/nio/PipeImpl$SourceChannelImpl.h> +#include <java/io/IOException.h> +#include <java/nio/channels/spi/SelectorProvider.h> + +void +gnu::java::nio::VMPipe::init (gnu::java::nio::PipeImpl *self, + ::java::nio::channels::spi::SelectorProvider* /*provider*/) +{ + int filedes [2]; + + if (_Jv_pipe (filedes) < 0) + throw new ::java::io::IOException (JvNewStringUTF (strerror (errno))); + + /* FIXME + source = new gnu::java::nio::PipeImpl$SourceChannelImpl + (this, provider, filedes [0]); + sink = new gnu::java::nio::PipeImpl$SinkChannelImpl + (this, provider, filedes [1]); + */ +} diff --git a/libjava/gnu/java/nio/natVMSelectorEcos.cc b/libjava/gnu/java/nio/natVMSelectorEcos.cc new file mode 100644 index 000000000..f2ebff809 --- /dev/null +++ b/libjava/gnu/java/nio/natVMSelectorEcos.cc @@ -0,0 +1,25 @@ +// natVMSelectorImplEcos.cc + +/* Copyright (C) 2003, 2004, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <errno.h> +#include <string.h> + +#include <gnu/java/nio/VMSelector.h> +#include <java/io/IOException.h> + +jint +gnu::java::nio::VMSelector::select (jintArray read, jintArray write, + jintArray except, jlong timeout) +{ + throw new ::java::io::IOException (JvNewStringUTF ("implSelect() not implemented")); +} diff --git a/libjava/gnu/java/nio/natVMSelectorPosix.cc b/libjava/gnu/java/nio/natVMSelectorPosix.cc new file mode 100644 index 000000000..9f026792a --- /dev/null +++ b/libjava/gnu/java/nio/natVMSelectorPosix.cc @@ -0,0 +1,127 @@ +// natVMSelectorImplPosix.cc + +/* Copyright (C) 2002, 2003, 2004, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <errno.h> +#include <string.h> + +#include <gnu/java/nio/VMSelector.h> +#include <java/io/InterruptedIOException.h> +#include <java/io/IOException.h> +#include <java/lang/Thread.h> + +static void +helper_put_filedescriptors (jintArray fdArray, fd_set& fds, int& max_fd) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + { + int fd = tmpFDArray [index]; + if (fd > 0) + { + FD_SET (tmpFDArray [index], &fds); + + if (tmpFDArray [index] > max_fd) + max_fd = tmpFDArray [index]; + } + } +} + +static void +helper_get_filedescriptors (jintArray& fdArray, fd_set fds) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + { + int fd = tmpFDArray [index]; + if (fd < 0 || !FD_ISSET (fd, &fds)) + tmpFDArray [index] = 0; + } +} + +static void +helper_reset (jintArray& fdArray) +{ + jint* tmpFDArray = elements (fdArray); + + for (int index = 0; index < JvGetArrayLength (fdArray); index++) + tmpFDArray [index] = 0; +} + +jint +gnu::java::nio::VMSelector::select (jintArray read, jintArray write, + jintArray except, jlong timeout) +{ + jint result; + int max_fd = 0; + fd_set read_fds; + fd_set write_fds; + fd_set except_fds; + struct timeval real_time_data; + struct timeval *time_data = NULL; + + // If a legal timeout value isn't given, use NULL. + // This means an infinite timeout. The specification + // also says that a zero timeout should be treated + // as infinite. Otherwise (if the timeout value is legal), + // fill our timeval struct and use it for the select. + if (timeout > 0) + { + real_time_data.tv_sec = timeout / 1000; + real_time_data.tv_usec = (timeout % 1000) * 1000; + time_data = &real_time_data; + } + + // Reset all fd_set structures + FD_ZERO (&read_fds); + FD_ZERO (&write_fds); + FD_ZERO (&except_fds); + + // Fill the fd_set data structures for the _Jv_select() call. + helper_put_filedescriptors (read, read_fds, max_fd); + helper_put_filedescriptors (write, write_fds, max_fd); + helper_put_filedescriptors (except, except_fds, max_fd); + + // Actually do the select + try + { + result = _Jv_select (max_fd + 1, &read_fds, &write_fds, + &except_fds, time_data); + } + catch (::java::io::InterruptedIOException *e) + { + // The behavior of JRE 1.4.1 is that no exception is thrown + // when the thread is interrupted, but the thread's interrupt + // status is set. Clear all of our select sets and return 0, + // indicating that nothing was selected. + ::java::lang::Thread::currentThread ()->interrupt (); + helper_reset (read); + helper_reset (write); + helper_reset (except); + return 0; + } + + if (result < 0) + { + char* strerr = strerror (errno); + throw new ::java::io::IOException (JvNewStringUTF (strerr)); + } + + // Set the file descriptors according to the values returned from select(). + helper_get_filedescriptors (read, read_fds); + helper_get_filedescriptors (write, write_fds); + helper_get_filedescriptors (except, except_fds); + + return result; +} diff --git a/libjava/gnu/java/nio/natVMSelectorWin32.cc b/libjava/gnu/java/nio/natVMSelectorWin32.cc new file mode 100644 index 000000000..790de22e4 --- /dev/null +++ b/libjava/gnu/java/nio/natVMSelectorWin32.cc @@ -0,0 +1,93 @@ +// natVMSelectorImplWin32.cc + +/* Copyright (C) 2003, 2004, 2007 Free Software Foundation + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +#include <config.h> +#include <platform.h> + +#include <gnu/java/nio/VMSelector.h> +#include <java/lang/Thread.h> + +jint +gnu::java::nio::VMSelector::select (jintArray read, jintArray write, + jintArray except, jlong timeout) +{ + // FIXME: The API for implSelect is biased towards POSIX implementations. + jint* pReadFD = elements (read); + int nNbReadFDs = JvGetArrayLength (read); + + jint* pWriteFD = elements (write); + int nNbWriteFDs = JvGetArrayLength (write); + + int nNbEvents = nNbReadFDs + nNbWriteFDs; + + // Create and initialize our event wrapper array + + // FIXME: We're creating fresh WSAEVENTs for each call. + // This is inefficient. It would probably be better to cache these + // in the Win32 socket implementation class. + WSAEventWrapper aArray[nNbEvents]; + + int nCurIndex = 0; + for (int i=0; i < nNbReadFDs; ++i) + aArray[nCurIndex++].init(pReadFD[i], FD_ACCEPT | FD_READ); + + for (int i=0; i < nNbWriteFDs; ++i) + aArray[nCurIndex++].init(pWriteFD[i], FD_WRITE); + + // Build our array of WSAEVENTs to wait on. Also throw in our thread's + // interrupt event in order to detect thread interruption. + HANDLE arh[nNbEvents + 1]; + for (int i=0; i < nNbEvents; ++i) + arh[i] = aArray[i].getEventHandle(); + arh[nNbEvents] = _Jv_Win32GetInterruptEvent (); + + // A timeout value of 0 needs to be treated as infinite. + if (timeout <= 0) + timeout = WSA_INFINITE; + + // Do the select. + DWORD dwRet = WSAWaitForMultipleEvents (nNbEvents+1, arh, 0, timeout, false); + + if (dwRet == WSA_WAIT_FAILED) + _Jv_ThrowIOException (); + + // Before we do anything else, clear output file descriptor arrays. + memset(pReadFD, 0, sizeof(jint) * nNbReadFDs); + memset(pWriteFD, 0, sizeof(jint) * nNbWriteFDs); + memset(elements (except), 0, sizeof(jint) * JvGetArrayLength (except)); + + if (dwRet == DWORD(WSA_WAIT_EVENT_0 + nNbEvents)) + { + // We were interrupted. Set the current thread's interrupt + // status and get out of here, with nothing selected.. + ::java::lang::Thread::currentThread ()->interrupt (); + return 0; + } + else if (dwRet < DWORD(WSA_WAIT_EVENT_0 + nNbEvents)) + { + int nSelectedEventIndex = dwRet - WSA_WAIT_EVENT_0; + + // Record the selected file descriptor. + // FIXME: This implementation only allows one file descriptor + // to be selected at a time. Remedy this by looping on + // WSAWaitForMultipleEvents 'til nothing more is selected. + jint fd = aArray[nSelectedEventIndex].getFD(); + if (nSelectedEventIndex < nNbReadFDs) + pReadFD[0] = fd; + else + pWriteFD[0] = fd; + + return 1; + } + else + // None of the event objects was signalled, so nothing was + // selected. + return 0; +} |