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/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/java/nio')
102 files changed, 6425 insertions, 0 deletions
diff --git a/libjava/java/nio/Buffer.h b/libjava/java/nio/Buffer.h new file mode 100644 index 000000000..3b958b496 --- /dev/null +++ b/libjava/java/nio/Buffer.h @@ -0,0 +1,66 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_Buffer__ +#define __java_nio_Buffer__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class Buffer; + } + } +} + +class java::nio::Buffer : public ::java::lang::Object +{ + +public: // actually package-private + Buffer(jint, jint, jint, jint, ::gnu::gcj::RawData *); +public: + virtual jint capacity(); + virtual ::java::nio::Buffer * clear(); + virtual ::java::nio::Buffer * flip(); + virtual jboolean hasRemaining(); + virtual jboolean isReadOnly() = 0; + virtual jint limit(); + virtual ::java::nio::Buffer * limit(jint); + virtual ::java::nio::Buffer * mark(); + virtual jint position(); + virtual ::java::nio::Buffer * position(jint); + virtual jint remaining(); + virtual ::java::nio::Buffer * reset(); + virtual ::java::nio::Buffer * rewind(); +public: // actually package-private + virtual void checkForUnderflow(); + virtual void checkForUnderflow(jint); + virtual void checkForOverflow(); + virtual void checkForOverflow(jint); + virtual void checkIndex(jint); + virtual void checkIfReadOnly(); + static void checkArraySize(jint, jint, jint); +private: + jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) cap; +public: // actually package-private + jint limit__; + jint pos; + jint mark__; + ::gnu::gcj::RawData * address; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_Buffer__ diff --git a/libjava/java/nio/Buffer.java b/libjava/java/nio/Buffer.java new file mode 100644 index 000000000..222b84fd5 --- /dev/null +++ b/libjava/java/nio/Buffer.java @@ -0,0 +1,367 @@ +/* Buffer.java -- + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.nio; + +import gnu.gcj.RawData; + +/** + * @since 1.4 + */ +public abstract class Buffer +{ + private final int cap; + int limit; + int pos; + int mark; + final RawData address; + + /** + * Creates a new Buffer. + * + * Should be package private. + */ + Buffer (int capacity, int limit, int position, int mark, + RawData address) + { + if (capacity < 0) + throw new IllegalArgumentException (); + + this.address = address; + cap = capacity; + limit (limit); + position (position); + + if (mark >= 0) + { + if (mark > pos) + throw new IllegalArgumentException (); + + this.mark = mark; + } + else + { + this.mark = -1; + } + } + + /** + * Retrieves the capacity of the buffer. + * + * @return the capacity of the buffer + */ + public final int capacity () + { + return cap; + } + + /** + * Clears the buffer. + * + * @return this buffer + */ + public final Buffer clear () + { + limit = cap; + pos = 0; + mark = -1; + return this; + } + + /** + * Flips the buffer. + * + * @return this buffer + */ + public final Buffer flip () + { + limit = pos; + pos = 0; + mark = -1; + return this; + } + + /** + * Tells whether the buffer has remaining data to read or not. + * + * @return true if the buffer contains remaining data to read, + * false otherwise + */ + public final boolean hasRemaining () + { + return remaining() > 0; + } + + /** + * Tells whether this buffer is read only or not. + * + * @return true if the buffer is read only, false otherwise + */ + public abstract boolean isReadOnly (); + + /** + * Retrieves the current limit of the buffer. + * + * @return the limit of the buffer + */ + public final int limit () + { + return limit; + } + + /** + * Sets this buffer's limit. + * + * @param newLimit The new limit value; must be non-negative and no larger + * than this buffer's capacity. + * + * @return this buffer + * + * @exception IllegalArgumentException If the preconditions on newLimit + * do not hold. + */ + public final Buffer limit (int newLimit) + { + if ((newLimit < 0) || (newLimit > cap)) + throw new IllegalArgumentException (); + + if (newLimit < mark) + mark = -1; + + if (pos > newLimit) + pos = newLimit; + + limit = newLimit; + return this; + } + + /** + * Sets this buffer's mark at its position. + * + * @return this buffer + */ + public final Buffer mark () + { + mark = pos; + return this; + } + + /** + * Retrieves the current position of this buffer. + * + * @return the current position of this buffer + */ + public final int position () + { + return pos; + } + + /** + * Sets this buffer's position. If the mark is defined and larger than the + * new position then it is discarded. + * + * @param newPosition The new position value; must be non-negative and no + * larger than the current limit. + * + * @return this buffer + * + * @exception IllegalArgumentException If the preconditions on newPosition + * do not hold + */ + public final Buffer position (int newPosition) + { + if ((newPosition < 0) || (newPosition > limit)) + throw new IllegalArgumentException (); + + if (newPosition <= mark) + mark = -1; + + pos = newPosition; + return this; + } + + /** + * Returns the number of elements between the current position and the limit. + * + * @return the number of remaining elements + */ + public final int remaining() + { + return limit - pos; + } + + /** + * Resets this buffer's position to the previously-marked position. + * + * @return this buffer + * + * @exception InvalidMarkException If the mark has not been set. + */ + public final Buffer reset() + { + if (mark == -1) + throw new InvalidMarkException (); + + pos = mark; + return this; + } + + /** + * Rewinds this buffer. The position is set to zero and the mark + * is discarded. + * + * @return this buffer + */ + public final Buffer rewind() + { + pos = 0; + mark = -1; + return this; + } + + /** + * Checks for underflow. This method is used internally to check + * whether a buffer has enough elements left to satisfy a read + * request. + * + * @exception BufferUnderflowException If there are no remaining + * elements in this buffer. + */ + final void checkForUnderflow() + { + if (!hasRemaining()) + throw new BufferUnderflowException(); + } + + /** + * Checks for underflow. This method is used internally to check + * whether a buffer has enough elements left to satisfy a read + * request for a given number of elements. + * + * @param length The length of a sequence of elements. + * + * @exception BufferUnderflowException If there are not enough + * remaining elements in this buffer. + */ + final void checkForUnderflow(int length) + { + if (remaining() < length) + throw new BufferUnderflowException(); + } + + /** + * Checks for overflow. This method is used internally to check + * whether a buffer has enough space left to satisfy a write + * request. + * + * @exception BufferOverflowException If there is no remaining + * space in this buffer. + */ + final void checkForOverflow() + { + if (!hasRemaining()) + throw new BufferOverflowException(); + } + + /** + * Checks for overflow. This method is used internally to check + * whether a buffer has enough space left to satisfy a write + * request for a given number of elements. + * + * @param length The length of a sequence of elements. + * + * @exception BufferUnderflowException If there is not enough + * remaining space in this buffer. + */ + final void checkForOverflow(int length) + { + if (remaining() < length) + throw new BufferOverflowException(); + } + + /** + * Checks if index is negative or not smaller than the buffer's + * limit. This method is used internally to check whether + * an indexed request can be fulfilled. + * + * @param index The requested position in the buffer. + * + * @exception IndexOutOfBoundsException If index is negative or not smaller + * than the buffer's limit. + */ + final void checkIndex(int index) + { + if (index < 0 + || index >= limit ()) + throw new IndexOutOfBoundsException (); + } + + /** + * Checks if buffer is read-only. This method is used internally to + * check if elements can be put into a buffer. + * + * @exception ReadOnlyBufferException If this buffer is read-only. + */ + final void checkIfReadOnly() + { + if (isReadOnly()) + throw new ReadOnlyBufferException (); + } + + /** + * Checks whether an array is large enough to hold the given number of + * elements at the given offset. This method is used internally to + * check if an array is big enough. + * + * @param arraylength The length of the array. + * @param offset The offset within the array of the first byte to be read; + * must be non-negative and no larger than arraylength. + * @param length The number of bytes to be read from the given array; + * must be non-negative and no larger than arraylength - offset. + * + * @exception IndexOutOfBoundsException If the preconditions on the offset + * and length parameters do not hold + */ + static final void checkArraySize(int arraylength, int offset, int length) + { + if ((offset < 0) || + (length < 0) || + (arraylength < length + offset)) + throw new IndexOutOfBoundsException (); + } +} diff --git a/libjava/java/nio/BufferOverflowException.h b/libjava/java/nio/BufferOverflowException.h new file mode 100644 index 000000000..2c2a8c2c4 --- /dev/null +++ b/libjava/java/nio/BufferOverflowException.h @@ -0,0 +1,32 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_BufferOverflowException__ +#define __java_nio_BufferOverflowException__ + +#pragma interface + +#include <java/lang/RuntimeException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class BufferOverflowException; + } + } +} + +class java::nio::BufferOverflowException : public ::java::lang::RuntimeException +{ + +public: + BufferOverflowException(); +private: + static const jlong serialVersionUID = -5484897634319144535LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_BufferOverflowException__ diff --git a/libjava/java/nio/BufferUnderflowException.h b/libjava/java/nio/BufferUnderflowException.h new file mode 100644 index 000000000..6b52f20c7 --- /dev/null +++ b/libjava/java/nio/BufferUnderflowException.h @@ -0,0 +1,32 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_BufferUnderflowException__ +#define __java_nio_BufferUnderflowException__ + +#pragma interface + +#include <java/lang/RuntimeException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class BufferUnderflowException; + } + } +} + +class java::nio::BufferUnderflowException : public ::java::lang::RuntimeException +{ + +public: + BufferUnderflowException(); +private: + static const jlong serialVersionUID = -1713313658691622206LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_BufferUnderflowException__ diff --git a/libjava/java/nio/ByteBuffer.h b/libjava/java/nio/ByteBuffer.h new file mode 100644 index 000000000..cf1f5be66 --- /dev/null +++ b/libjava/java/nio/ByteBuffer.h @@ -0,0 +1,112 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ByteBuffer__ +#define __java_nio_ByteBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class CharBuffer; + class DoubleBuffer; + class FloatBuffer; + class IntBuffer; + class LongBuffer; + class ShortBuffer; + } + } +} + +class java::nio::ByteBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + ByteBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jbyte > *, jint); +public: + static ::java::nio::ByteBuffer * allocateDirect(jint); + static ::java::nio::ByteBuffer * allocate(jint); + static ::java::nio::ByteBuffer * wrap(JArray< jbyte > *, jint, jint); + static ::java::nio::ByteBuffer * wrap(JArray< jbyte > *); + virtual ::java::nio::ByteBuffer * get(JArray< jbyte > *, jint, jint); + virtual ::java::nio::ByteBuffer * get(JArray< jbyte > *); + virtual ::java::nio::ByteBuffer * put(::java::nio::ByteBuffer *); + virtual ::java::nio::ByteBuffer * put(JArray< jbyte > *, jint, jint); + virtual ::java::nio::ByteBuffer * put(JArray< jbyte > *); + virtual jboolean hasArray(); + virtual JArray< jbyte > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint ByteBuffer$compareTo(::java::nio::ByteBuffer *); + virtual ::java::nio::ByteOrder * order(); + virtual ::java::nio::ByteBuffer * order(::java::nio::ByteOrder *); + virtual jbyte get() = 0; + virtual ::java::nio::ByteBuffer * put(jbyte) = 0; + virtual jbyte get(jint) = 0; + virtual ::java::nio::ByteBuffer * put(jint, jbyte) = 0; + virtual ::java::nio::ByteBuffer * compact() = 0; +public: // actually package-private + virtual void shiftDown(jint, jint, jint); +public: + virtual jboolean isDirect() = 0; + virtual ::java::nio::ByteBuffer * slice() = 0; + virtual ::java::nio::ByteBuffer * duplicate() = 0; + virtual ::java::nio::ByteBuffer * asReadOnlyBuffer() = 0; + virtual ::java::nio::ShortBuffer * asShortBuffer() = 0; + virtual ::java::nio::CharBuffer * asCharBuffer() = 0; + virtual ::java::nio::IntBuffer * asIntBuffer() = 0; + virtual ::java::nio::LongBuffer * asLongBuffer() = 0; + virtual ::java::nio::FloatBuffer * asFloatBuffer() = 0; + virtual ::java::nio::DoubleBuffer * asDoubleBuffer() = 0; + virtual jchar getChar() = 0; + virtual ::java::nio::ByteBuffer * putChar(jchar) = 0; + virtual jchar getChar(jint) = 0; + virtual ::java::nio::ByteBuffer * putChar(jint, jchar) = 0; + virtual jshort getShort() = 0; + virtual ::java::nio::ByteBuffer * putShort(jshort) = 0; + virtual jshort getShort(jint) = 0; + virtual ::java::nio::ByteBuffer * putShort(jint, jshort) = 0; + virtual jint getInt() = 0; + virtual ::java::nio::ByteBuffer * putInt(jint) = 0; + virtual jint getInt(jint) = 0; + virtual ::java::nio::ByteBuffer * putInt(jint, jint) = 0; + virtual jlong getLong() = 0; + virtual ::java::nio::ByteBuffer * putLong(jlong) = 0; + virtual jlong getLong(jint) = 0; + virtual ::java::nio::ByteBuffer * putLong(jint, jlong) = 0; + virtual jfloat getFloat() = 0; + virtual ::java::nio::ByteBuffer * putFloat(jfloat) = 0; + virtual jfloat getFloat(jint) = 0; + virtual ::java::nio::ByteBuffer * putFloat(jint, jfloat) = 0; + virtual jdouble getDouble() = 0; + virtual ::java::nio::ByteBuffer * putDouble(jdouble) = 0; + virtual jdouble getDouble(jint) = 0; + virtual ::java::nio::ByteBuffer * putDouble(jint, jdouble) = 0; + virtual ::java::lang::String * toString(); + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + ::java::nio::ByteOrder * __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) endian; + JArray< jbyte > * backing_buffer; + jint array_offset; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ByteBuffer__ diff --git a/libjava/java/nio/ByteBufferHelper.h b/libjava/java/nio/ByteBufferHelper.h new file mode 100644 index 000000000..851b57aad --- /dev/null +++ b/libjava/java/nio/ByteBufferHelper.h @@ -0,0 +1,56 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ByteBufferHelper__ +#define __java_nio_ByteBufferHelper__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteBufferHelper; + class ByteOrder; + } + } +} + +class java::nio::ByteBufferHelper : public ::java::lang::Object +{ + +public: // actually package-private + ByteBufferHelper(); +public: + static jchar getChar(::java::nio::ByteBuffer *, ::java::nio::ByteOrder *); + static void putChar(::java::nio::ByteBuffer *, jchar, ::java::nio::ByteOrder *); + static jchar getChar(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static void putChar(::java::nio::ByteBuffer *, jint, jchar, ::java::nio::ByteOrder *); + static jshort getShort(::java::nio::ByteBuffer *, ::java::nio::ByteOrder *); + static void putShort(::java::nio::ByteBuffer *, jshort, ::java::nio::ByteOrder *); + static jshort getShort(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static void putShort(::java::nio::ByteBuffer *, jint, jshort, ::java::nio::ByteOrder *); + static jint getInt(::java::nio::ByteBuffer *, ::java::nio::ByteOrder *); + static void putInt(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static jint getInt(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static void putInt(::java::nio::ByteBuffer *, jint, jint, ::java::nio::ByteOrder *); + static jlong getLong(::java::nio::ByteBuffer *, ::java::nio::ByteOrder *); + static void putLong(::java::nio::ByteBuffer *, jlong, ::java::nio::ByteOrder *); + static jlong getLong(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static void putLong(::java::nio::ByteBuffer *, jint, jlong, ::java::nio::ByteOrder *); + static jfloat getFloat(::java::nio::ByteBuffer *, ::java::nio::ByteOrder *); + static void putFloat(::java::nio::ByteBuffer *, jfloat, ::java::nio::ByteOrder *); + static jfloat getFloat(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static void putFloat(::java::nio::ByteBuffer *, jint, jfloat, ::java::nio::ByteOrder *); + static jdouble getDouble(::java::nio::ByteBuffer *, ::java::nio::ByteOrder *); + static void putDouble(::java::nio::ByteBuffer *, jdouble, ::java::nio::ByteOrder *); + static jdouble getDouble(::java::nio::ByteBuffer *, jint, ::java::nio::ByteOrder *); + static void putDouble(::java::nio::ByteBuffer *, jint, jdouble, ::java::nio::ByteOrder *); + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ByteBufferHelper__ diff --git a/libjava/java/nio/ByteBufferImpl.h b/libjava/java/nio/ByteBufferImpl.h new file mode 100644 index 000000000..12621a0c7 --- /dev/null +++ b/libjava/java/nio/ByteBufferImpl.h @@ -0,0 +1,87 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ByteBufferImpl__ +#define __java_nio_ByteBufferImpl__ + +#pragma interface + +#include <java/nio/ByteBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteBufferImpl; + class CharBuffer; + class DoubleBuffer; + class FloatBuffer; + class IntBuffer; + class LongBuffer; + class ShortBuffer; + } + } +} + +class java::nio::ByteBufferImpl : public ::java::nio::ByteBuffer +{ + +public: // actually package-private + ByteBufferImpl(JArray< jbyte > *, jint, jint, jint, jint, jint, jboolean); +public: + ::java::nio::CharBuffer * asCharBuffer(); + ::java::nio::ShortBuffer * asShortBuffer(); + ::java::nio::IntBuffer * asIntBuffer(); + ::java::nio::LongBuffer * asLongBuffer(); + ::java::nio::FloatBuffer * asFloatBuffer(); + ::java::nio::DoubleBuffer * asDoubleBuffer(); + jboolean isReadOnly(); + ::java::nio::ByteBuffer * slice(); + ::java::nio::ByteBuffer * duplicate(); + ::java::nio::ByteBuffer * asReadOnlyBuffer(); +public: // actually package-private + void shiftDown(jint, jint, jint); +public: + ::java::nio::ByteBuffer * compact(); + jboolean isDirect(); + jbyte get(); + ::java::nio::ByteBuffer * get(JArray< jbyte > *, jint, jint); + ::java::nio::ByteBuffer * put(JArray< jbyte > *, jint, jint); + ::java::nio::ByteBuffer * put(jbyte); + jbyte get(jint); + ::java::nio::ByteBuffer * put(jint, jbyte); + jchar getChar(); + ::java::nio::ByteBuffer * putChar(jchar); + jchar getChar(jint); + ::java::nio::ByteBuffer * putChar(jint, jchar); + jshort getShort(); + ::java::nio::ByteBuffer * putShort(jshort); + jshort getShort(jint); + ::java::nio::ByteBuffer * putShort(jint, jshort); + jint getInt(); + ::java::nio::ByteBuffer * putInt(jint); + jint getInt(jint); + ::java::nio::ByteBuffer * putInt(jint, jint); + jlong getLong(); + ::java::nio::ByteBuffer * putLong(jlong); + jlong getLong(jint); + ::java::nio::ByteBuffer * putLong(jint, jlong); + jfloat getFloat(); + ::java::nio::ByteBuffer * putFloat(jfloat); + jfloat getFloat(jint); + ::java::nio::ByteBuffer * putFloat(jint, jfloat); + jdouble getDouble(); + ::java::nio::ByteBuffer * putDouble(jdouble); + jdouble getDouble(jint); + ::java::nio::ByteBuffer * putDouble(jint, jdouble); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::ByteBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ByteBufferImpl__ diff --git a/libjava/java/nio/ByteOrder.h b/libjava/java/nio/ByteOrder.h new file mode 100644 index 000000000..730cb7fd9 --- /dev/null +++ b/libjava/java/nio/ByteOrder.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ByteOrder__ +#define __java_nio_ByteOrder__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + } + } +} + +class java::nio::ByteOrder : public ::java::lang::Object +{ + +public: + static ::java::nio::ByteOrder * nativeOrder(); + ::java::lang::String * toString(); +private: + ByteOrder(); +public: + static ::java::nio::ByteOrder * BIG_ENDIAN; + static ::java::nio::ByteOrder * LITTLE_ENDIAN; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ByteOrder__ diff --git a/libjava/java/nio/CharBuffer.h b/libjava/java/nio/CharBuffer.h new file mode 100644 index 000000000..73b4ba917 --- /dev/null +++ b/libjava/java/nio/CharBuffer.h @@ -0,0 +1,84 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_CharBuffer__ +#define __java_nio_CharBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteOrder; + class CharBuffer; + } + } +} + +class java::nio::CharBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + CharBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jchar > *, jint); +public: + static ::java::nio::CharBuffer * allocate(jint); + static ::java::nio::CharBuffer * wrap(JArray< jchar > *, jint, jint); + static ::java::nio::CharBuffer * wrap(::java::lang::CharSequence *); + static ::java::nio::CharBuffer * wrap(::java::lang::CharSequence *, jint, jint); + static ::java::nio::CharBuffer * wrap(JArray< jchar > *); + virtual ::java::nio::CharBuffer * get(JArray< jchar > *, jint, jint); + virtual jint read(::java::nio::CharBuffer *); + virtual ::java::nio::CharBuffer * get(JArray< jchar > *); + virtual ::java::nio::CharBuffer * put(::java::nio::CharBuffer *); + virtual ::java::nio::CharBuffer * put(JArray< jchar > *, jint, jint); + virtual ::java::nio::CharBuffer * put(JArray< jchar > *); + virtual jboolean hasArray(); + virtual JArray< jchar > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint CharBuffer$compareTo(::java::nio::CharBuffer *); + virtual ::java::nio::ByteOrder * order() = 0; + virtual jchar get() = 0; + virtual ::java::nio::CharBuffer * put(jchar) = 0; + virtual jchar get(jint) = 0; + virtual ::java::nio::CharBuffer * put(jint, jchar) = 0; + virtual ::java::nio::CharBuffer * compact() = 0; + virtual jboolean isDirect() = 0; + virtual ::java::nio::CharBuffer * slice() = 0; + virtual ::java::nio::CharBuffer * duplicate() = 0; + virtual ::java::nio::CharBuffer * asReadOnlyBuffer() = 0; + virtual ::java::lang::String * toString(); + virtual jint length(); + virtual ::java::lang::CharSequence * subSequence(jint, jint) = 0; + virtual ::java::nio::CharBuffer * put(::java::lang::String *, jint, jint); + virtual ::java::nio::CharBuffer * put(::java::lang::String *); + virtual jchar charAt(jint); + virtual ::java::nio::CharBuffer * CharBuffer$append(jchar); + virtual ::java::nio::CharBuffer * CharBuffer$append(::java::lang::CharSequence *); + virtual ::java::nio::CharBuffer * CharBuffer$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *); + virtual ::java::lang::Appendable * append(jchar); + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) array_offset; + JArray< jchar > * backing_buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_CharBuffer__ diff --git a/libjava/java/nio/CharBufferImpl.h b/libjava/java/nio/CharBufferImpl.h new file mode 100644 index 000000000..4cbf50ec3 --- /dev/null +++ b/libjava/java/nio/CharBufferImpl.h @@ -0,0 +1,53 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_CharBufferImpl__ +#define __java_nio_CharBufferImpl__ + +#pragma interface + +#include <java/nio/CharBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class CharBuffer; + class CharBufferImpl; + } + } +} + +class java::nio::CharBufferImpl : public ::java::nio::CharBuffer +{ + +public: // actually package-private + CharBufferImpl(jint); + CharBufferImpl(JArray< jchar > *, jint, jint, jint, jint, jint, jboolean); +public: + CharBufferImpl(::java::nio::CharBufferImpl *); + jboolean isReadOnly(); + ::java::nio::CharBuffer * slice(); + ::java::nio::CharBuffer * duplicate(); + ::java::nio::CharBuffer * asReadOnlyBuffer(); + ::java::nio::CharBuffer * compact(); + jboolean isDirect(); + ::java::lang::CharSequence * subSequence(jint, jint); + jchar get(); + ::java::nio::CharBuffer * put(jchar); + jchar get(jint); + ::java::nio::CharBuffer * get(JArray< jchar > *, jint, jint); + ::java::nio::CharBuffer * put(JArray< jchar > *, jint, jint); + ::java::nio::CharBuffer * put(jint, jchar); + ::java::nio::ByteOrder * order(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::CharBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_CharBufferImpl__ diff --git a/libjava/java/nio/CharSequenceBuffer.h b/libjava/java/nio/CharSequenceBuffer.h new file mode 100644 index 000000000..b46b2b60d --- /dev/null +++ b/libjava/java/nio/CharSequenceBuffer.h @@ -0,0 +1,48 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_CharSequenceBuffer__ +#define __java_nio_CharSequenceBuffer__ + +#pragma interface + +#include <java/nio/CharBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class CharBuffer; + class CharSequenceBuffer; + } + } +} + +class java::nio::CharSequenceBuffer : public ::java::nio::CharBuffer +{ + +public: // actually package-private + CharSequenceBuffer(::java::lang::CharSequence *, jint, jint, jint, jint, jint); + CharSequenceBuffer(::java::lang::CharSequence *, jint, jint); +public: + ::java::nio::CharBuffer * asReadOnlyBuffer(); + ::java::nio::CharBuffer * compact(); + ::java::nio::CharBuffer * duplicate(); + jchar get(); + jchar get(jint); + jboolean isDirect(); + ::java::nio::ByteOrder * order(); + ::java::nio::CharBuffer * put(jchar); + ::java::nio::CharBuffer * put(jint, jchar); + ::java::nio::CharBuffer * slice(); + ::java::lang::CharSequence * subSequence(jint, jint); + jboolean isReadOnly(); +private: + ::java::lang::CharSequence * __attribute__((aligned(__alignof__( ::java::nio::CharBuffer)))) charSequence; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_CharSequenceBuffer__ diff --git a/libjava/java/nio/CharViewBufferImpl.h b/libjava/java/nio/CharViewBufferImpl.h new file mode 100644 index 000000000..fbde2de15 --- /dev/null +++ b/libjava/java/nio/CharViewBufferImpl.h @@ -0,0 +1,55 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_CharViewBufferImpl__ +#define __java_nio_CharViewBufferImpl__ + +#pragma interface + +#include <java/nio/CharBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class CharBuffer; + class CharViewBufferImpl; + } + } +} + +class java::nio::CharViewBufferImpl : public ::java::nio::CharBuffer +{ + +public: // actually package-private + CharViewBufferImpl(::java::nio::ByteBuffer *, jint); +public: + CharViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *); + virtual jchar get(); + virtual jchar get(jint); + virtual ::java::nio::CharBuffer * put(jchar); + virtual ::java::nio::CharBuffer * put(jint, jchar); + virtual ::java::nio::CharBuffer * compact(); + virtual ::java::nio::CharBuffer * slice(); +public: // actually package-private + virtual ::java::nio::CharBuffer * duplicate(jboolean); +public: + virtual ::java::nio::CharBuffer * duplicate(); + virtual ::java::nio::CharBuffer * asReadOnlyBuffer(); + virtual ::java::lang::CharSequence * subSequence(jint, jint); + virtual jboolean isReadOnly(); + virtual jboolean isDirect(); + virtual ::java::nio::ByteOrder * order(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::CharBuffer)))) offset; + ::java::nio::ByteBuffer * bb; + jboolean readOnly; + ::java::nio::ByteOrder * endian; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_CharViewBufferImpl__ diff --git a/libjava/java/nio/DirectByteBufferImpl$ReadOnly.h b/libjava/java/nio/DirectByteBufferImpl$ReadOnly.h new file mode 100644 index 000000000..f94c05ace --- /dev/null +++ b/libjava/java/nio/DirectByteBufferImpl$ReadOnly.h @@ -0,0 +1,41 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_DirectByteBufferImpl$ReadOnly__ +#define __java_nio_DirectByteBufferImpl$ReadOnly__ + +#pragma interface + +#include <java/nio/DirectByteBufferImpl.h> +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class DirectByteBufferImpl$ReadOnly; + } + } +} + +class java::nio::DirectByteBufferImpl$ReadOnly : public ::java::nio::DirectByteBufferImpl +{ + +public: // actually package-private + DirectByteBufferImpl$ReadOnly(::java::lang::Object *, ::gnu::gcj::RawData *, jint, jint, jint); +public: + ::java::nio::ByteBuffer * put(jbyte); + ::java::nio::ByteBuffer * put(jint, jbyte); + jboolean isReadOnly(); + static ::java::lang::Class class$; +}; + +#endif // __java_nio_DirectByteBufferImpl$ReadOnly__ diff --git a/libjava/java/nio/DirectByteBufferImpl$ReadWrite.h b/libjava/java/nio/DirectByteBufferImpl$ReadWrite.h new file mode 100644 index 000000000..aa8c5ad0a --- /dev/null +++ b/libjava/java/nio/DirectByteBufferImpl$ReadWrite.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_DirectByteBufferImpl$ReadWrite__ +#define __java_nio_DirectByteBufferImpl$ReadWrite__ + +#pragma interface + +#include <java/nio/DirectByteBufferImpl.h> +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class DirectByteBufferImpl$ReadWrite; + } + } +} + +class java::nio::DirectByteBufferImpl$ReadWrite : public ::java::nio::DirectByteBufferImpl +{ + +public: // actually package-private + DirectByteBufferImpl$ReadWrite(jint); + DirectByteBufferImpl$ReadWrite(::gnu::gcj::RawData *, jint); + DirectByteBufferImpl$ReadWrite(::java::lang::Object *, ::gnu::gcj::RawData *, jint, jint, jint); +public: + jboolean isReadOnly(); + static ::java::lang::Class class$; +}; + +#endif // __java_nio_DirectByteBufferImpl$ReadWrite__ diff --git a/libjava/java/nio/DirectByteBufferImpl.h b/libjava/java/nio/DirectByteBufferImpl.h new file mode 100644 index 000000000..b5a566907 --- /dev/null +++ b/libjava/java/nio/DirectByteBufferImpl.h @@ -0,0 +1,101 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_DirectByteBufferImpl__ +#define __java_nio_DirectByteBufferImpl__ + +#pragma interface + +#include <java/nio/ByteBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + class DirectByteBufferImpl; + class DoubleBuffer; + class FloatBuffer; + class IntBuffer; + class LongBuffer; + class ShortBuffer; + } + } +} + +class java::nio::DirectByteBufferImpl : public ::java::nio::ByteBuffer +{ + +public: // actually package-private + DirectByteBufferImpl(jint); + DirectByteBufferImpl(::gnu::gcj::RawData *, jint); + DirectByteBufferImpl(::java::lang::Object *, ::gnu::gcj::RawData *, jint, jint, jint); +public: + static ::java::nio::ByteBuffer * allocate(jint); +public: // actually protected + virtual void finalize(); +public: + virtual jbyte get(); + virtual jbyte get(jint); + virtual ::java::nio::ByteBuffer * get(JArray< jbyte > *, jint, jint); + virtual ::java::nio::ByteBuffer * put(jbyte); + virtual ::java::nio::ByteBuffer * put(jint, jbyte); +public: // actually package-private + virtual void shiftDown(jint, jint, jint); +public: + virtual ::java::nio::ByteBuffer * compact(); + virtual ::java::nio::ByteBuffer * slice(); +private: + ::java::nio::ByteBuffer * duplicate(jboolean); +public: + virtual ::java::nio::ByteBuffer * duplicate(); + virtual ::java::nio::ByteBuffer * asReadOnlyBuffer(); + virtual jboolean isDirect(); + virtual ::java::nio::CharBuffer * asCharBuffer(); + virtual ::java::nio::ShortBuffer * asShortBuffer(); + virtual ::java::nio::IntBuffer * asIntBuffer(); + virtual ::java::nio::LongBuffer * asLongBuffer(); + virtual ::java::nio::FloatBuffer * asFloatBuffer(); + virtual ::java::nio::DoubleBuffer * asDoubleBuffer(); + virtual jchar getChar(); + virtual ::java::nio::ByteBuffer * putChar(jchar); + virtual jchar getChar(jint); + virtual ::java::nio::ByteBuffer * putChar(jint, jchar); + virtual jshort getShort(); + virtual ::java::nio::ByteBuffer * putShort(jshort); + virtual jshort getShort(jint); + virtual ::java::nio::ByteBuffer * putShort(jint, jshort); + virtual jint getInt(); + virtual ::java::nio::ByteBuffer * putInt(jint); + virtual jint getInt(jint); + virtual ::java::nio::ByteBuffer * putInt(jint, jint); + virtual jlong getLong(); + virtual ::java::nio::ByteBuffer * putLong(jlong); + virtual jlong getLong(jint); + virtual ::java::nio::ByteBuffer * putLong(jint, jlong); + virtual jfloat getFloat(); + virtual ::java::nio::ByteBuffer * putFloat(jfloat); + virtual jfloat getFloat(jint); + virtual ::java::nio::ByteBuffer * putFloat(jint, jfloat); + virtual jdouble getDouble(); + virtual ::java::nio::ByteBuffer * putDouble(jdouble); + virtual jdouble getDouble(jint); + virtual ::java::nio::ByteBuffer * putDouble(jint, jdouble); +private: + ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::nio::ByteBuffer)))) owner; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_DirectByteBufferImpl__ diff --git a/libjava/java/nio/DirectByteBufferImpl.java b/libjava/java/nio/DirectByteBufferImpl.java new file mode 100644 index 000000000..dd40d5a41 --- /dev/null +++ b/libjava/java/nio/DirectByteBufferImpl.java @@ -0,0 +1,429 @@ +/* DirectByteBufferImpl.java -- + Copyright (C) 2003, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.nio; + +import gnu.gcj.RawData; + +abstract class DirectByteBufferImpl extends ByteBuffer +{ + /** + * The owner is used to keep alive the object that actually owns the + * memory. There are three possibilities: + * 1) owner == this: We allocated the memory and we should free it, + * but *only* in finalize (if we've been sliced + * other objects will also have access to the + * memory). + * 2) owner == null: The byte buffer was created thru + * JNI.NewDirectByteBuffer. The JNI code is + * responsible for freeing the memory. + * 3) owner == some other object: The other object allocated the + * memory and should free it. + */ + private final Object owner; + + static final class ReadOnly extends DirectByteBufferImpl + { + ReadOnly(Object owner, RawData address, + int capacity, int limit, + int position) + { + super(owner, address, capacity, limit, position); + } + + public ByteBuffer put(byte value) + { + throw new ReadOnlyBufferException (); + } + + public ByteBuffer put(int index, byte value) + { + throw new ReadOnlyBufferException (); + } + + public boolean isReadOnly() + { + return true; + } + } + + static final class ReadWrite extends DirectByteBufferImpl + { + ReadWrite(int capacity) + { + super(capacity); + } + + ReadWrite(RawData address, int capacity) + { + super(address, capacity); + } + + ReadWrite(Object owner, RawData address, + int capacity, int limit, + int position) + { + super(owner, address, capacity, limit, position); + } + + public boolean isReadOnly() + { + return false; + } + } + + DirectByteBufferImpl(int capacity) + { + super(capacity, capacity, 0, -1, + VMDirectByteBuffer.allocate(capacity), null, 0); + this.owner = this; + } + + DirectByteBufferImpl(RawData address, int capacity) + { + super(capacity, capacity, 0, -1, address, null, 0); + this.owner = null; + } + + DirectByteBufferImpl(Object owner, RawData address, + int capacity, int limit, + int position) + { + super(capacity, limit, position, -1, address, null, 0); + this.owner = owner; + } + + /** + * Allocates a new direct byte buffer. + */ + public static ByteBuffer allocate(int capacity) + { + return new DirectByteBufferImpl.ReadWrite(capacity); + } + + protected void finalize() throws Throwable + { + if (owner == this) + VMDirectByteBuffer.free(address); + } + + public byte get() + { + checkForUnderflow(); + + int pos = position(); + byte result = VMDirectByteBuffer.get(address, pos); + position(pos + 1); + return result; + } + + public byte get(int index) + { + checkIndex(index); + + return VMDirectByteBuffer.get(address, index); + } + + public ByteBuffer get(byte[] dst, int offset, int length) + { + checkArraySize(dst.length, offset, length); + checkForUnderflow(length); + + int index = position(); + VMDirectByteBuffer.get(address, index, dst, offset, length); + position(index+length); + + return this; + } + + public ByteBuffer put(byte value) + { + checkForOverflow(); + + int pos = position(); + VMDirectByteBuffer.put(address, pos, value); + position(pos + 1); + return this; + } + + public ByteBuffer put(int index, byte value) + { + checkIndex(index); + + VMDirectByteBuffer.put(address, index, value); + return this; + } + + void shiftDown(int dst_offset, int src_offset, int count) + { + VMDirectByteBuffer.shiftDown(address, dst_offset, src_offset, count); + } + + public ByteBuffer compact() + { + checkIfReadOnly(); + mark = -1; + int pos = position(); + if (pos > 0) + { + int count = remaining(); + VMDirectByteBuffer.shiftDown(address, 0, pos, count); + position(count); + limit(capacity()); + } + else + { + position(limit()); + limit(capacity()); + } + return this; + } + + public ByteBuffer slice() + { + int rem = remaining(); + if (isReadOnly()) + return new DirectByteBufferImpl.ReadOnly + (owner, VMDirectByteBuffer.adjustAddress(address, position()), + rem, rem, 0); + else + return new DirectByteBufferImpl.ReadWrite + (owner, VMDirectByteBuffer.adjustAddress(address, position()), + rem, rem, 0); + } + + private ByteBuffer duplicate(boolean readOnly) + { + int pos = position(); + reset(); + int mark = position(); + position(pos); + DirectByteBufferImpl result; + if (readOnly) + result = new DirectByteBufferImpl.ReadOnly(owner, address, capacity(), + limit(), pos); + else + result = new DirectByteBufferImpl.ReadWrite(owner, address, capacity(), + limit(), pos); + + if (mark != pos) + { + result.position(mark); + result.mark(); + result.position(pos); + } + return result; + } + + public ByteBuffer duplicate() + { + return duplicate(isReadOnly()); + } + + public ByteBuffer asReadOnlyBuffer() + { + return duplicate(true); + } + + public boolean isDirect() + { + return true; + } + + public CharBuffer asCharBuffer() + { + return new CharViewBufferImpl(this, remaining() >> 1); + } + + public ShortBuffer asShortBuffer() + { + return new ShortViewBufferImpl(this, remaining() >> 1); + } + + public IntBuffer asIntBuffer() + { + return new IntViewBufferImpl(this, remaining() >> 2); + } + + public LongBuffer asLongBuffer() + { + return new LongViewBufferImpl(this, remaining() >> 3); + } + + public FloatBuffer asFloatBuffer() + { + return new FloatViewBufferImpl(this, remaining() >> 2); + } + + public DoubleBuffer asDoubleBuffer() + { + return new DoubleViewBufferImpl(this, remaining() >> 3); + } + + public char getChar() + { + return ByteBufferHelper.getChar(this, order()); + } + + public ByteBuffer putChar(char value) + { + ByteBufferHelper.putChar(this, value, order()); + return this; + } + + public char getChar(int index) + { + return ByteBufferHelper.getChar(this, index, order()); + } + + public ByteBuffer putChar(int index, char value) + { + ByteBufferHelper.putChar(this, index, value, order()); + return this; + } + + public short getShort() + { + return ByteBufferHelper.getShort(this, order()); + } + + public ByteBuffer putShort(short value) + { + ByteBufferHelper.putShort(this, value, order()); + return this; + } + + public short getShort(int index) + { + return ByteBufferHelper.getShort(this, index, order()); + } + + public ByteBuffer putShort(int index, short value) + { + ByteBufferHelper.putShort(this, index, value, order()); + return this; + } + + public int getInt() + { + return ByteBufferHelper.getInt(this, order()); + } + + public ByteBuffer putInt(int value) + { + ByteBufferHelper.putInt(this, value, order()); + return this; + } + + public int getInt(int index) + { + return ByteBufferHelper.getInt(this, index, order()); + } + + public ByteBuffer putInt(int index, int value) + { + ByteBufferHelper.putInt(this, index, value, order()); + return this; + } + + public long getLong() + { + return ByteBufferHelper.getLong(this, order()); + } + + public ByteBuffer putLong(long value) + { + ByteBufferHelper.putLong(this, value, order()); + return this; + } + + public long getLong(int index) + { + return ByteBufferHelper.getLong(this, index, order()); + } + + public ByteBuffer putLong(int index, long value) + { + ByteBufferHelper.putLong(this, index, value, order()); + return this; + } + + public float getFloat() + { + return ByteBufferHelper.getFloat(this, order()); + } + + public ByteBuffer putFloat(float value) + { + ByteBufferHelper.putFloat(this, value, order()); + return this; + } + + public float getFloat(int index) + { + return ByteBufferHelper.getFloat(this, index, order()); + } + + public ByteBuffer putFloat(int index, float value) + { + ByteBufferHelper.putFloat(this, index, value, order()); + return this; + } + + public double getDouble() + { + return ByteBufferHelper.getDouble(this, order()); + } + + public ByteBuffer putDouble(double value) + { + ByteBufferHelper.putDouble(this, value, order()); + return this; + } + + public double getDouble(int index) + { + return ByteBufferHelper.getDouble(this, index, order()); + } + + public ByteBuffer putDouble(int index, double value) + { + ByteBufferHelper.putDouble(this, index, value, order()); + return this; + } +} diff --git a/libjava/java/nio/DoubleBuffer.h b/libjava/java/nio/DoubleBuffer.h new file mode 100644 index 000000000..cb7da18f2 --- /dev/null +++ b/libjava/java/nio/DoubleBuffer.h @@ -0,0 +1,69 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_DoubleBuffer__ +#define __java_nio_DoubleBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteOrder; + class DoubleBuffer; + } + } +} + +class java::nio::DoubleBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + DoubleBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jdouble > *, jint); +public: + static ::java::nio::DoubleBuffer * allocate(jint); + static ::java::nio::DoubleBuffer * wrap(JArray< jdouble > *, jint, jint); + static ::java::nio::DoubleBuffer * wrap(JArray< jdouble > *); + virtual ::java::nio::DoubleBuffer * get(JArray< jdouble > *, jint, jint); + virtual ::java::nio::DoubleBuffer * get(JArray< jdouble > *); + virtual ::java::nio::DoubleBuffer * put(::java::nio::DoubleBuffer *); + virtual ::java::nio::DoubleBuffer * put(JArray< jdouble > *, jint, jint); + virtual ::java::nio::DoubleBuffer * put(JArray< jdouble > *); + virtual jboolean hasArray(); + virtual JArray< jdouble > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint DoubleBuffer$compareTo(::java::nio::DoubleBuffer *); + virtual ::java::nio::ByteOrder * order() = 0; + virtual jdouble get() = 0; + virtual ::java::nio::DoubleBuffer * put(jdouble) = 0; + virtual jdouble get(jint) = 0; + virtual ::java::nio::DoubleBuffer * put(jint, jdouble) = 0; + virtual ::java::nio::DoubleBuffer * compact() = 0; + virtual jboolean isDirect() = 0; + virtual ::java::nio::DoubleBuffer * slice() = 0; + virtual ::java::nio::DoubleBuffer * duplicate() = 0; + virtual ::java::nio::DoubleBuffer * asReadOnlyBuffer() = 0; + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) array_offset; + JArray< jdouble > * backing_buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_DoubleBuffer__ diff --git a/libjava/java/nio/DoubleBufferImpl.h b/libjava/java/nio/DoubleBufferImpl.h new file mode 100644 index 000000000..f87e69c05 --- /dev/null +++ b/libjava/java/nio/DoubleBufferImpl.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_DoubleBufferImpl__ +#define __java_nio_DoubleBufferImpl__ + +#pragma interface + +#include <java/nio/DoubleBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class DoubleBuffer; + class DoubleBufferImpl; + } + } +} + +class java::nio::DoubleBufferImpl : public ::java::nio::DoubleBuffer +{ + +public: // actually package-private + DoubleBufferImpl(jint); + DoubleBufferImpl(JArray< jdouble > *, jint, jint, jint, jint, jint, jboolean); +public: + jboolean isReadOnly(); + ::java::nio::DoubleBuffer * slice(); + ::java::nio::DoubleBuffer * duplicate(); + ::java::nio::DoubleBuffer * asReadOnlyBuffer(); + ::java::nio::DoubleBuffer * compact(); + jboolean isDirect(); + jdouble get(); + ::java::nio::DoubleBuffer * put(jdouble); + jdouble get(jint); + ::java::nio::DoubleBuffer * put(jint, jdouble); + ::java::nio::ByteOrder * order(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::DoubleBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_DoubleBufferImpl__ diff --git a/libjava/java/nio/DoubleViewBufferImpl.h b/libjava/java/nio/DoubleViewBufferImpl.h new file mode 100644 index 000000000..778a0aca2 --- /dev/null +++ b/libjava/java/nio/DoubleViewBufferImpl.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_DoubleViewBufferImpl__ +#define __java_nio_DoubleViewBufferImpl__ + +#pragma interface + +#include <java/nio/DoubleBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class DoubleBuffer; + class DoubleViewBufferImpl; + } + } +} + +class java::nio::DoubleViewBufferImpl : public ::java::nio::DoubleBuffer +{ + +public: // actually package-private + DoubleViewBufferImpl(::java::nio::ByteBuffer *, jint); +public: + DoubleViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *); + jdouble get(); + jdouble get(jint); + ::java::nio::DoubleBuffer * put(jdouble); + ::java::nio::DoubleBuffer * put(jint, jdouble); + ::java::nio::DoubleBuffer * compact(); + ::java::nio::DoubleBuffer * slice(); +public: // actually package-private + ::java::nio::DoubleBuffer * duplicate(jboolean); +public: + ::java::nio::DoubleBuffer * duplicate(); + ::java::nio::DoubleBuffer * asReadOnlyBuffer(); + jboolean isReadOnly(); + jboolean isDirect(); + ::java::nio::ByteOrder * order(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::DoubleBuffer)))) offset; + ::java::nio::ByteBuffer * bb; + jboolean readOnly; + ::java::nio::ByteOrder * endian; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_DoubleViewBufferImpl__ diff --git a/libjava/java/nio/FloatBuffer.h b/libjava/java/nio/FloatBuffer.h new file mode 100644 index 000000000..334bdc482 --- /dev/null +++ b/libjava/java/nio/FloatBuffer.h @@ -0,0 +1,69 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_FloatBuffer__ +#define __java_nio_FloatBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteOrder; + class FloatBuffer; + } + } +} + +class java::nio::FloatBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + FloatBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jfloat > *, jint); +public: + static ::java::nio::FloatBuffer * allocate(jint); + static ::java::nio::FloatBuffer * wrap(JArray< jfloat > *, jint, jint); + static ::java::nio::FloatBuffer * wrap(JArray< jfloat > *); + virtual ::java::nio::FloatBuffer * get(JArray< jfloat > *, jint, jint); + virtual ::java::nio::FloatBuffer * get(JArray< jfloat > *); + virtual ::java::nio::FloatBuffer * put(::java::nio::FloatBuffer *); + virtual ::java::nio::FloatBuffer * put(JArray< jfloat > *, jint, jint); + virtual ::java::nio::FloatBuffer * put(JArray< jfloat > *); + virtual jboolean hasArray(); + virtual JArray< jfloat > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint FloatBuffer$compareTo(::java::nio::FloatBuffer *); + virtual ::java::nio::ByteOrder * order() = 0; + virtual jfloat get() = 0; + virtual ::java::nio::FloatBuffer * put(jfloat) = 0; + virtual jfloat get(jint) = 0; + virtual ::java::nio::FloatBuffer * put(jint, jfloat) = 0; + virtual ::java::nio::FloatBuffer * compact() = 0; + virtual jboolean isDirect() = 0; + virtual ::java::nio::FloatBuffer * slice() = 0; + virtual ::java::nio::FloatBuffer * duplicate() = 0; + virtual ::java::nio::FloatBuffer * asReadOnlyBuffer() = 0; + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) array_offset; + JArray< jfloat > * backing_buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_FloatBuffer__ diff --git a/libjava/java/nio/FloatBufferImpl.h b/libjava/java/nio/FloatBufferImpl.h new file mode 100644 index 000000000..6dad3a9b1 --- /dev/null +++ b/libjava/java/nio/FloatBufferImpl.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_FloatBufferImpl__ +#define __java_nio_FloatBufferImpl__ + +#pragma interface + +#include <java/nio/FloatBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class FloatBuffer; + class FloatBufferImpl; + } + } +} + +class java::nio::FloatBufferImpl : public ::java::nio::FloatBuffer +{ + +public: // actually package-private + FloatBufferImpl(jint); + FloatBufferImpl(JArray< jfloat > *, jint, jint, jint, jint, jint, jboolean); +public: + jboolean isReadOnly(); + ::java::nio::FloatBuffer * slice(); + ::java::nio::FloatBuffer * duplicate(); + ::java::nio::FloatBuffer * asReadOnlyBuffer(); + ::java::nio::FloatBuffer * compact(); + jboolean isDirect(); + jfloat get(); + ::java::nio::FloatBuffer * put(jfloat); + jfloat get(jint); + ::java::nio::FloatBuffer * put(jint, jfloat); + ::java::nio::ByteOrder * order(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::FloatBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_FloatBufferImpl__ diff --git a/libjava/java/nio/FloatViewBufferImpl.h b/libjava/java/nio/FloatViewBufferImpl.h new file mode 100644 index 000000000..5ba181b5a --- /dev/null +++ b/libjava/java/nio/FloatViewBufferImpl.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_FloatViewBufferImpl__ +#define __java_nio_FloatViewBufferImpl__ + +#pragma interface + +#include <java/nio/FloatBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class FloatBuffer; + class FloatViewBufferImpl; + } + } +} + +class java::nio::FloatViewBufferImpl : public ::java::nio::FloatBuffer +{ + +public: // actually package-private + FloatViewBufferImpl(::java::nio::ByteBuffer *, jint); +public: + FloatViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *); + jfloat get(); + jfloat get(jint); + ::java::nio::FloatBuffer * put(jfloat); + ::java::nio::FloatBuffer * put(jint, jfloat); + ::java::nio::FloatBuffer * compact(); + ::java::nio::FloatBuffer * slice(); +public: // actually package-private + ::java::nio::FloatBuffer * duplicate(jboolean); +public: + ::java::nio::FloatBuffer * duplicate(); + ::java::nio::FloatBuffer * asReadOnlyBuffer(); + jboolean isReadOnly(); + jboolean isDirect(); + ::java::nio::ByteOrder * order(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::FloatBuffer)))) offset; + ::java::nio::ByteBuffer * bb; + jboolean readOnly; + ::java::nio::ByteOrder * endian; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_FloatViewBufferImpl__ diff --git a/libjava/java/nio/IntBuffer.h b/libjava/java/nio/IntBuffer.h new file mode 100644 index 000000000..fa2250712 --- /dev/null +++ b/libjava/java/nio/IntBuffer.h @@ -0,0 +1,69 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_IntBuffer__ +#define __java_nio_IntBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteOrder; + class IntBuffer; + } + } +} + +class java::nio::IntBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + IntBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jint > *, jint); +public: + static ::java::nio::IntBuffer * allocate(jint); + static ::java::nio::IntBuffer * wrap(JArray< jint > *, jint, jint); + static ::java::nio::IntBuffer * wrap(JArray< jint > *); + virtual ::java::nio::IntBuffer * get(JArray< jint > *, jint, jint); + virtual ::java::nio::IntBuffer * get(JArray< jint > *); + virtual ::java::nio::IntBuffer * put(::java::nio::IntBuffer *); + virtual ::java::nio::IntBuffer * put(JArray< jint > *, jint, jint); + virtual ::java::nio::IntBuffer * put(JArray< jint > *); + virtual jboolean hasArray(); + virtual JArray< jint > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint IntBuffer$compareTo(::java::nio::IntBuffer *); + virtual ::java::nio::ByteOrder * order() = 0; + virtual jint get() = 0; + virtual ::java::nio::IntBuffer * put(jint) = 0; + virtual jint get(jint) = 0; + virtual ::java::nio::IntBuffer * put(jint, jint) = 0; + virtual ::java::nio::IntBuffer * compact() = 0; + virtual jboolean isDirect() = 0; + virtual ::java::nio::IntBuffer * slice() = 0; + virtual ::java::nio::IntBuffer * duplicate() = 0; + virtual ::java::nio::IntBuffer * asReadOnlyBuffer() = 0; + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) array_offset; + JArray< jint > * backing_buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_IntBuffer__ diff --git a/libjava/java/nio/IntBufferImpl.h b/libjava/java/nio/IntBufferImpl.h new file mode 100644 index 000000000..2492f028f --- /dev/null +++ b/libjava/java/nio/IntBufferImpl.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_IntBufferImpl__ +#define __java_nio_IntBufferImpl__ + +#pragma interface + +#include <java/nio/IntBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class IntBuffer; + class IntBufferImpl; + } + } +} + +class java::nio::IntBufferImpl : public ::java::nio::IntBuffer +{ + +public: // actually package-private + IntBufferImpl(jint); + IntBufferImpl(JArray< jint > *, jint, jint, jint, jint, jint, jboolean); +public: + jboolean isReadOnly(); + ::java::nio::IntBuffer * slice(); + ::java::nio::IntBuffer * duplicate(); + ::java::nio::IntBuffer * asReadOnlyBuffer(); + ::java::nio::IntBuffer * compact(); + jboolean isDirect(); + jint get(); + ::java::nio::IntBuffer * put(jint); + jint get(jint); + ::java::nio::IntBuffer * put(jint, jint); + ::java::nio::ByteOrder * order(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::IntBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_IntBufferImpl__ diff --git a/libjava/java/nio/IntViewBufferImpl.h b/libjava/java/nio/IntViewBufferImpl.h new file mode 100644 index 000000000..8dfe695e2 --- /dev/null +++ b/libjava/java/nio/IntViewBufferImpl.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_IntViewBufferImpl__ +#define __java_nio_IntViewBufferImpl__ + +#pragma interface + +#include <java/nio/IntBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class IntBuffer; + class IntViewBufferImpl; + } + } +} + +class java::nio::IntViewBufferImpl : public ::java::nio::IntBuffer +{ + +public: // actually package-private + IntViewBufferImpl(::java::nio::ByteBuffer *, jint); +public: + IntViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *); + jint get(); + jint get(jint); + ::java::nio::IntBuffer * put(jint); + ::java::nio::IntBuffer * put(jint, jint); + ::java::nio::IntBuffer * compact(); + ::java::nio::IntBuffer * slice(); +public: // actually package-private + ::java::nio::IntBuffer * duplicate(jboolean); +public: + ::java::nio::IntBuffer * duplicate(); + ::java::nio::IntBuffer * asReadOnlyBuffer(); + jboolean isReadOnly(); + jboolean isDirect(); + ::java::nio::ByteOrder * order(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::IntBuffer)))) offset; + ::java::nio::ByteBuffer * bb; + jboolean readOnly; + ::java::nio::ByteOrder * endian; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_IntViewBufferImpl__ diff --git a/libjava/java/nio/InvalidMarkException.h b/libjava/java/nio/InvalidMarkException.h new file mode 100644 index 000000000..7b095c2cd --- /dev/null +++ b/libjava/java/nio/InvalidMarkException.h @@ -0,0 +1,32 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_InvalidMarkException__ +#define __java_nio_InvalidMarkException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class InvalidMarkException; + } + } +} + +class java::nio::InvalidMarkException : public ::java::lang::IllegalStateException +{ + +public: + InvalidMarkException(); +private: + static const jlong serialVersionUID = 1698329710438510774LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_InvalidMarkException__ diff --git a/libjava/java/nio/LongBuffer.h b/libjava/java/nio/LongBuffer.h new file mode 100644 index 000000000..622f2419c --- /dev/null +++ b/libjava/java/nio/LongBuffer.h @@ -0,0 +1,69 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_LongBuffer__ +#define __java_nio_LongBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteOrder; + class LongBuffer; + } + } +} + +class java::nio::LongBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + LongBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jlong > *, jint); +public: + static ::java::nio::LongBuffer * allocate(jint); + static ::java::nio::LongBuffer * wrap(JArray< jlong > *, jint, jint); + static ::java::nio::LongBuffer * wrap(JArray< jlong > *); + virtual ::java::nio::LongBuffer * get(JArray< jlong > *, jint, jint); + virtual ::java::nio::LongBuffer * get(JArray< jlong > *); + virtual ::java::nio::LongBuffer * put(::java::nio::LongBuffer *); + virtual ::java::nio::LongBuffer * put(JArray< jlong > *, jint, jint); + virtual ::java::nio::LongBuffer * put(JArray< jlong > *); + virtual jboolean hasArray(); + virtual JArray< jlong > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint LongBuffer$compareTo(::java::nio::LongBuffer *); + virtual ::java::nio::ByteOrder * order() = 0; + virtual jlong get() = 0; + virtual ::java::nio::LongBuffer * put(jlong) = 0; + virtual jlong get(jint) = 0; + virtual ::java::nio::LongBuffer * put(jint, jlong) = 0; + virtual ::java::nio::LongBuffer * compact() = 0; + virtual jboolean isDirect() = 0; + virtual ::java::nio::LongBuffer * slice() = 0; + virtual ::java::nio::LongBuffer * duplicate() = 0; + virtual ::java::nio::LongBuffer * asReadOnlyBuffer() = 0; + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) array_offset; + JArray< jlong > * backing_buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_LongBuffer__ diff --git a/libjava/java/nio/LongBufferImpl.h b/libjava/java/nio/LongBufferImpl.h new file mode 100644 index 000000000..ad28128bd --- /dev/null +++ b/libjava/java/nio/LongBufferImpl.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_LongBufferImpl__ +#define __java_nio_LongBufferImpl__ + +#pragma interface + +#include <java/nio/LongBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class LongBuffer; + class LongBufferImpl; + } + } +} + +class java::nio::LongBufferImpl : public ::java::nio::LongBuffer +{ + +public: // actually package-private + LongBufferImpl(jint); + LongBufferImpl(JArray< jlong > *, jint, jint, jint, jint, jint, jboolean); +public: + jboolean isReadOnly(); + ::java::nio::LongBuffer * slice(); + ::java::nio::LongBuffer * duplicate(); + ::java::nio::LongBuffer * asReadOnlyBuffer(); + ::java::nio::LongBuffer * compact(); + jboolean isDirect(); + jlong get(); + ::java::nio::LongBuffer * put(jlong); + jlong get(jint); + ::java::nio::LongBuffer * put(jint, jlong); + ::java::nio::ByteOrder * order(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::LongBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_LongBufferImpl__ diff --git a/libjava/java/nio/LongViewBufferImpl.h b/libjava/java/nio/LongViewBufferImpl.h new file mode 100644 index 000000000..59e678c0f --- /dev/null +++ b/libjava/java/nio/LongViewBufferImpl.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_LongViewBufferImpl__ +#define __java_nio_LongViewBufferImpl__ + +#pragma interface + +#include <java/nio/LongBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class LongBuffer; + class LongViewBufferImpl; + } + } +} + +class java::nio::LongViewBufferImpl : public ::java::nio::LongBuffer +{ + +public: // actually package-private + LongViewBufferImpl(::java::nio::ByteBuffer *, jint); +public: + LongViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *); + jlong get(); + jlong get(jint); + ::java::nio::LongBuffer * put(jlong); + ::java::nio::LongBuffer * put(jint, jlong); + ::java::nio::LongBuffer * compact(); + ::java::nio::LongBuffer * slice(); +public: // actually package-private + ::java::nio::LongBuffer * duplicate(jboolean); +public: + ::java::nio::LongBuffer * duplicate(); + ::java::nio::LongBuffer * asReadOnlyBuffer(); + jboolean isReadOnly(); + jboolean isDirect(); + ::java::nio::ByteOrder * order(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::LongBuffer)))) offset; + ::java::nio::ByteBuffer * bb; + jboolean readOnly; + ::java::nio::ByteOrder * endian; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_LongViewBufferImpl__ diff --git a/libjava/java/nio/MappedByteBuffer.h b/libjava/java/nio/MappedByteBuffer.h new file mode 100644 index 000000000..05fe81b3c --- /dev/null +++ b/libjava/java/nio/MappedByteBuffer.h @@ -0,0 +1,52 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_MappedByteBuffer__ +#define __java_nio_MappedByteBuffer__ + +#pragma interface + +#include <java/nio/ByteBuffer.h> +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class MappedByteBuffer; + } + } +} + +class java::nio::MappedByteBuffer : public ::java::nio::ByteBuffer +{ + +public: // actually package-private + MappedByteBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *); + virtual void forceImpl(); +public: + virtual ::java::nio::MappedByteBuffer * force(); +public: // actually package-private + virtual jboolean isLoadedImpl(); +public: + virtual jboolean isLoaded(); +public: // actually package-private + virtual void loadImpl(); +public: + virtual ::java::nio::MappedByteBuffer * load(); +public: // actually package-private + virtual void unmapImpl(); +public: // actually protected + virtual void finalize(); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_MappedByteBuffer__ diff --git a/libjava/java/nio/MappedByteBufferImpl.h b/libjava/java/nio/MappedByteBufferImpl.h new file mode 100644 index 000000000..71725bf1b --- /dev/null +++ b/libjava/java/nio/MappedByteBufferImpl.h @@ -0,0 +1,99 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_MappedByteBufferImpl__ +#define __java_nio_MappedByteBufferImpl__ + +#pragma interface + +#include <java/nio/MappedByteBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + class DoubleBuffer; + class FloatBuffer; + class IntBuffer; + class LongBuffer; + class MappedByteBufferImpl; + class ShortBuffer; + } + } +} + +class java::nio::MappedByteBufferImpl : public ::java::nio::MappedByteBuffer +{ + +public: + MappedByteBufferImpl(::gnu::gcj::RawData *, jint, jboolean); + jboolean isReadOnly(); + jbyte get(); + ::java::nio::ByteBuffer * put(jbyte); + jbyte get(jint); + ::java::nio::ByteBuffer * get(JArray< jbyte > *, jint, jint); + ::java::nio::ByteBuffer * put(jint, jbyte); + ::java::nio::ByteBuffer * compact(); + jboolean isDirect(); + ::java::nio::ByteBuffer * slice(); +private: + ::java::nio::ByteBuffer * duplicate(jboolean); +public: + ::java::nio::ByteBuffer * duplicate(); + ::java::nio::ByteBuffer * asReadOnlyBuffer(); + ::java::nio::CharBuffer * asCharBuffer(); + ::java::nio::ShortBuffer * asShortBuffer(); + ::java::nio::IntBuffer * asIntBuffer(); + ::java::nio::LongBuffer * asLongBuffer(); + ::java::nio::FloatBuffer * asFloatBuffer(); + ::java::nio::DoubleBuffer * asDoubleBuffer(); + jchar getChar(); + ::java::nio::ByteBuffer * putChar(jchar); + jchar getChar(jint); + ::java::nio::ByteBuffer * putChar(jint, jchar); + jshort getShort(); + ::java::nio::ByteBuffer * putShort(jshort); + jshort getShort(jint); + ::java::nio::ByteBuffer * putShort(jint, jshort); + jint getInt(); + ::java::nio::ByteBuffer * putInt(jint); + jint getInt(jint); + ::java::nio::ByteBuffer * putInt(jint, jint); + jlong getLong(); + ::java::nio::ByteBuffer * putLong(jlong); + jlong getLong(jint); + ::java::nio::ByteBuffer * putLong(jint, jlong); + jfloat getFloat(); + ::java::nio::ByteBuffer * putFloat(jfloat); + jfloat getFloat(jint); + ::java::nio::ByteBuffer * putFloat(jint, jfloat); + jdouble getDouble(); + ::java::nio::ByteBuffer * putDouble(jdouble); + jdouble getDouble(jint); + ::java::nio::ByteBuffer * putDouble(jint, jdouble); +public: // actually package-private + void unmapImpl(); + jboolean isLoadedImpl(); + void loadImpl(); + void forceImpl(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::MappedByteBuffer)))) readOnly; +public: + ::gnu::gcj::RawData * implPtr; + jlong implLen; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_MappedByteBufferImpl__ diff --git a/libjava/java/nio/MappedByteBufferImpl.java b/libjava/java/nio/MappedByteBufferImpl.java new file mode 100644 index 000000000..c8d458a38 --- /dev/null +++ b/libjava/java/nio/MappedByteBufferImpl.java @@ -0,0 +1,359 @@ +/* MappedByteBufferImpl.java -- + Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.nio; + +import gnu.gcj.RawData; + +import java.io.IOException; + +final class MappedByteBufferImpl extends MappedByteBuffer +{ + private final boolean readOnly; + + /** Posix uses this for the pointer returned by mmap; + * Win32 uses it for the pointer returned by MapViewOfFile. */ + public RawData implPtr; + /** Posix uses this for the actual length passed to mmap; + * Win32 uses it for the pointer returned by CreateFileMapping. */ + public long implLen; + + public MappedByteBufferImpl(RawData address, int size, boolean readOnly) + throws IOException + { + super(size, size, 0, -1, address); + this.readOnly = readOnly; + } + + public boolean isReadOnly() + { + return readOnly; + } + + public byte get() + { + checkForUnderflow(); + + int pos = position(); + byte result = VMDirectByteBuffer.get(address, pos); + position(pos + 1); + return result; + } + + public ByteBuffer put(byte value) + { + checkIfReadOnly(); + checkForOverflow(); + + int pos = position(); + VMDirectByteBuffer.put(address, pos, value); + position(pos + 1); + return this; + } + + public byte get(int index) + { + checkIndex(index); + + return VMDirectByteBuffer.get(address, index); + } + + public ByteBuffer get(byte[] dst, int offset, int length) + { + checkArraySize(dst.length, offset, length); + checkForUnderflow(length); + + int index = position(); + VMDirectByteBuffer.get(address, index, dst, offset, length); + position(index+length); + + return this; + } + + public ByteBuffer put(int index, byte value) + { + checkIfReadOnly(); + checkIndex(index); + + VMDirectByteBuffer.put(address, index, value); + return this; + } + + public ByteBuffer compact() + { + checkIfReadOnly(); + mark = -1; + int pos = position(); + if (pos > 0) + { + int count = remaining(); + // Call shiftDown method optimized for direct buffers. + VMDirectByteBuffer.shiftDown(address, 0, pos, count); + position(count); + limit(capacity()); + } + else + { + position(limit()); + limit(capacity()); + } + return this; + } + + public boolean isDirect() + { + return true; + } + + public ByteBuffer slice() + { + int rem = remaining(); + if (isReadOnly()) + return new DirectByteBufferImpl.ReadOnly + (this, VMDirectByteBuffer.adjustAddress(address, position()), + rem, rem, 0); + else + return new DirectByteBufferImpl.ReadWrite + (this, VMDirectByteBuffer.adjustAddress(address, position()), + rem, rem, 0); + } + + private ByteBuffer duplicate(boolean readOnly) + { + int pos = position(); + reset(); + int mark = position(); + position(pos); + DirectByteBufferImpl result; + if (readOnly) + result = new DirectByteBufferImpl.ReadOnly(this, address, capacity(), + limit(), pos); + else + result = new DirectByteBufferImpl.ReadWrite(this, address, capacity(), + limit(), pos); + + if (mark != pos) + { + result.position(mark); + result.mark(); + result.position(pos); + } + return result; + } + + public ByteBuffer duplicate() + { + return duplicate(isReadOnly()); + } + + public ByteBuffer asReadOnlyBuffer() + { + return duplicate(true); + } + + public CharBuffer asCharBuffer() + { + return new CharViewBufferImpl(this, remaining() >> 1); + } + + public ShortBuffer asShortBuffer() + { + return new ShortViewBufferImpl(this, remaining() >> 1); + } + + public IntBuffer asIntBuffer() + { + return new IntViewBufferImpl(this, remaining() >> 2); + } + + public LongBuffer asLongBuffer() + { + return new LongViewBufferImpl(this, remaining() >> 3); + } + + public FloatBuffer asFloatBuffer() + { + return new FloatViewBufferImpl(this, remaining() >> 2); + } + + public DoubleBuffer asDoubleBuffer() + { + return new DoubleViewBufferImpl(this, remaining() >> 3); + } + + public char getChar() + { + return ByteBufferHelper.getChar(this, order()); + } + + public ByteBuffer putChar(char value) + { + ByteBufferHelper.putChar(this, value, order()); + return this; + } + + public char getChar(int index) + { + return ByteBufferHelper.getChar(this, index, order()); + } + + public ByteBuffer putChar(int index, char value) + { + ByteBufferHelper.putChar(this, index, value, order()); + return this; + } + + public short getShort() + { + return ByteBufferHelper.getShort(this, order()); + } + + public ByteBuffer putShort(short value) + { + ByteBufferHelper.putShort(this, value, order()); + return this; + } + + public short getShort(int index) + { + return ByteBufferHelper.getShort(this, index, order()); + } + + public ByteBuffer putShort(int index, short value) + { + ByteBufferHelper.putShort(this, index, value, order()); + return this; + } + + public int getInt() + { + return ByteBufferHelper.getInt(this, order()); + } + + public ByteBuffer putInt(int value) + { + ByteBufferHelper.putInt(this, value, order()); + return this; + } + + public int getInt(int index) + { + return ByteBufferHelper.getInt(this, index, order()); + } + + public ByteBuffer putInt(int index, int value) + { + ByteBufferHelper.putInt(this, index, value, order()); + return this; + } + + public long getLong() + { + return ByteBufferHelper.getLong(this, order()); + } + + public ByteBuffer putLong(long value) + { + ByteBufferHelper.putLong(this, value, order()); + return this; + } + + public long getLong(int index) + { + return ByteBufferHelper.getLong(this, index, order()); + } + + public ByteBuffer putLong(int index, long value) + { + ByteBufferHelper.putLong(this, index, value, order()); + return this; + } + + public float getFloat() + { + return ByteBufferHelper.getFloat(this, order()); + } + + public ByteBuffer putFloat(float value) + { + ByteBufferHelper.putFloat(this, value, order()); + return this; + } + + public float getFloat(int index) + { + return ByteBufferHelper.getFloat(this, index, order()); + } + + public ByteBuffer putFloat(int index, float value) + { + ByteBufferHelper.putFloat(this, index, value, order()); + return this; + } + + public double getDouble() + { + return ByteBufferHelper.getDouble(this, order()); + } + + public ByteBuffer putDouble(double value) + { + ByteBufferHelper.putDouble(this, value, order()); + return this; + } + + public double getDouble(int index) + { + return ByteBufferHelper.getDouble(this, index, order()); + } + + public ByteBuffer putDouble(int index, double value) + { + ByteBufferHelper.putDouble(this, index, value, order()); + return this; + } + + // NOTE: In libgcj these methods are implemented in natFileChannelXxx.cc, + // because they're small, and to put them next to FileChannelImpl::mapImpl. + native void unmapImpl(); + native boolean isLoadedImpl(); + // FIXME: Try to load all pages into memory. + native void loadImpl(); + + native void forceImpl(); +} diff --git a/libjava/java/nio/ReadOnlyBufferException.h b/libjava/java/nio/ReadOnlyBufferException.h new file mode 100644 index 000000000..58fe414ff --- /dev/null +++ b/libjava/java/nio/ReadOnlyBufferException.h @@ -0,0 +1,32 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ReadOnlyBufferException__ +#define __java_nio_ReadOnlyBufferException__ + +#pragma interface + +#include <java/lang/UnsupportedOperationException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ReadOnlyBufferException; + } + } +} + +class java::nio::ReadOnlyBufferException : public ::java::lang::UnsupportedOperationException +{ + +public: + ReadOnlyBufferException(); +private: + static const jlong serialVersionUID = -1210063976496234090LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ReadOnlyBufferException__ diff --git a/libjava/java/nio/ShortBuffer.h b/libjava/java/nio/ShortBuffer.h new file mode 100644 index 000000000..1cb82a085 --- /dev/null +++ b/libjava/java/nio/ShortBuffer.h @@ -0,0 +1,69 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ShortBuffer__ +#define __java_nio_ShortBuffer__ + +#pragma interface + +#include <java/nio/Buffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class ByteOrder; + class ShortBuffer; + } + } +} + +class java::nio::ShortBuffer : public ::java::nio::Buffer +{ + +public: // actually package-private + ShortBuffer(jint, jint, jint, jint, ::gnu::gcj::RawData *, JArray< jshort > *, jint); +public: + static ::java::nio::ShortBuffer * allocate(jint); + static ::java::nio::ShortBuffer * wrap(JArray< jshort > *, jint, jint); + static ::java::nio::ShortBuffer * wrap(JArray< jshort > *); + virtual ::java::nio::ShortBuffer * get(JArray< jshort > *, jint, jint); + virtual ::java::nio::ShortBuffer * get(JArray< jshort > *); + virtual ::java::nio::ShortBuffer * put(::java::nio::ShortBuffer *); + virtual ::java::nio::ShortBuffer * put(JArray< jshort > *, jint, jint); + virtual ::java::nio::ShortBuffer * put(JArray< jshort > *); + virtual jboolean hasArray(); + virtual JArray< jshort > * array(); + virtual jint arrayOffset(); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual jint ShortBuffer$compareTo(::java::nio::ShortBuffer *); + virtual ::java::nio::ByteOrder * order() = 0; + virtual jshort get() = 0; + virtual ::java::nio::ShortBuffer * put(jshort) = 0; + virtual jshort get(jint) = 0; + virtual ::java::nio::ShortBuffer * put(jint, jshort) = 0; + virtual ::java::nio::ShortBuffer * compact() = 0; + virtual jboolean isDirect() = 0; + virtual ::java::nio::ShortBuffer * slice() = 0; + virtual ::java::nio::ShortBuffer * duplicate() = 0; + virtual ::java::nio::ShortBuffer * asReadOnlyBuffer() = 0; + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::nio::Buffer)))) array_offset; + JArray< jshort > * backing_buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ShortBuffer__ diff --git a/libjava/java/nio/ShortBufferImpl.h b/libjava/java/nio/ShortBufferImpl.h new file mode 100644 index 000000000..a4150a8e9 --- /dev/null +++ b/libjava/java/nio/ShortBufferImpl.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ShortBufferImpl__ +#define __java_nio_ShortBufferImpl__ + +#pragma interface + +#include <java/nio/ShortBuffer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteOrder; + class ShortBuffer; + class ShortBufferImpl; + } + } +} + +class java::nio::ShortBufferImpl : public ::java::nio::ShortBuffer +{ + +public: // actually package-private + ShortBufferImpl(jint); + ShortBufferImpl(JArray< jshort > *, jint, jint, jint, jint, jint, jboolean); +public: + jboolean isReadOnly(); + ::java::nio::ShortBuffer * slice(); + ::java::nio::ShortBuffer * duplicate(); + ::java::nio::ShortBuffer * asReadOnlyBuffer(); + ::java::nio::ShortBuffer * compact(); + jboolean isDirect(); + jshort get(); + ::java::nio::ShortBuffer * put(jshort); + jshort get(jint); + ::java::nio::ShortBuffer * put(jint, jshort); + ::java::nio::ByteOrder * order(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::ShortBuffer)))) readOnly; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ShortBufferImpl__ diff --git a/libjava/java/nio/ShortViewBufferImpl.h b/libjava/java/nio/ShortViewBufferImpl.h new file mode 100644 index 000000000..179cc32c5 --- /dev/null +++ b/libjava/java/nio/ShortViewBufferImpl.h @@ -0,0 +1,54 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_ShortViewBufferImpl__ +#define __java_nio_ShortViewBufferImpl__ + +#pragma interface + +#include <java/nio/ShortBuffer.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class ByteOrder; + class ShortBuffer; + class ShortViewBufferImpl; + } + } +} + +class java::nio::ShortViewBufferImpl : public ::java::nio::ShortBuffer +{ + +public: // actually package-private + ShortViewBufferImpl(::java::nio::ByteBuffer *, jint); +public: + ShortViewBufferImpl(::java::nio::ByteBuffer *, jint, jint, jint, jint, jint, jboolean, ::java::nio::ByteOrder *); + jshort get(); + jshort get(jint); + ::java::nio::ShortBuffer * put(jshort); + ::java::nio::ShortBuffer * put(jint, jshort); + ::java::nio::ShortBuffer * compact(); + ::java::nio::ShortBuffer * slice(); +public: // actually package-private + ::java::nio::ShortBuffer * duplicate(jboolean); +public: + ::java::nio::ShortBuffer * duplicate(); + ::java::nio::ShortBuffer * asReadOnlyBuffer(); + jboolean isReadOnly(); + jboolean isDirect(); + ::java::nio::ByteOrder * order(); +private: + jint __attribute__((aligned(__alignof__( ::java::nio::ShortBuffer)))) offset; + ::java::nio::ByteBuffer * bb; + jboolean readOnly; + ::java::nio::ByteOrder * endian; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_ShortViewBufferImpl__ diff --git a/libjava/java/nio/VMDirectByteBuffer.h b/libjava/java/nio/VMDirectByteBuffer.h new file mode 100644 index 000000000..2434caf19 --- /dev/null +++ b/libjava/java/nio/VMDirectByteBuffer.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_VMDirectByteBuffer__ +#define __java_nio_VMDirectByteBuffer__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + class RawData; + } + } + namespace java + { + namespace nio + { + class VMDirectByteBuffer; + } + } +} + +class java::nio::VMDirectByteBuffer : public ::java::lang::Object +{ + +public: // actually package-private + VMDirectByteBuffer(); + static ::gnu::gcj::RawData * allocate(jint); + static void free(::gnu::gcj::RawData *); + static jbyte get(::gnu::gcj::RawData *, jint); + static void get(::gnu::gcj::RawData *, jint, JArray< jbyte > *, jint, jint); + static void put(::gnu::gcj::RawData *, jint, jbyte); + static ::gnu::gcj::RawData * adjustAddress(::gnu::gcj::RawData *, jint); + static void shiftDown(::gnu::gcj::RawData *, jint, jint, jint); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_VMDirectByteBuffer__ diff --git a/libjava/java/nio/VMDirectByteBuffer.java b/libjava/java/nio/VMDirectByteBuffer.java new file mode 100644 index 000000000..2aefaeb4b --- /dev/null +++ b/libjava/java/nio/VMDirectByteBuffer.java @@ -0,0 +1,53 @@ +/* VMDirectByteBuffer.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 java.nio; + +import gnu.classpath.Configuration; +import gnu.gcj.RawData; + +final class VMDirectByteBuffer +{ + static native RawData allocate (int capacity); + static native void free(RawData address); + static native byte get(RawData address, int index); + static native void get(RawData address, int index, byte[] dst, int offset, int length); + static native void put(RawData address, int index, byte value); + static native RawData adjustAddress(RawData address, int offset); + static native void shiftDown(RawData address, int dst_offset, int src_offset, int count); +} diff --git a/libjava/java/nio/channels/AlreadyConnectedException.h b/libjava/java/nio/channels/AlreadyConnectedException.h new file mode 100644 index 000000000..08d6d479e --- /dev/null +++ b/libjava/java/nio/channels/AlreadyConnectedException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_AlreadyConnectedException__ +#define __java_nio_channels_AlreadyConnectedException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class AlreadyConnectedException; + } + } + } +} + +class java::nio::channels::AlreadyConnectedException : public ::java::lang::IllegalStateException +{ + +public: + AlreadyConnectedException(); +private: + static const jlong serialVersionUID = -7331895245053773357LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_AlreadyConnectedException__ diff --git a/libjava/java/nio/channels/AsynchronousCloseException.h b/libjava/java/nio/channels/AsynchronousCloseException.h new file mode 100644 index 000000000..bfcbf2eb4 --- /dev/null +++ b/libjava/java/nio/channels/AsynchronousCloseException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_AsynchronousCloseException__ +#define __java_nio_channels_AsynchronousCloseException__ + +#pragma interface + +#include <java/nio/channels/ClosedChannelException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class AsynchronousCloseException; + } + } + } +} + +class java::nio::channels::AsynchronousCloseException : public ::java::nio::channels::ClosedChannelException +{ + +public: + AsynchronousCloseException(); +private: + static const jlong serialVersionUID = 6891178312432313966LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_AsynchronousCloseException__ diff --git a/libjava/java/nio/channels/ByteChannel.h b/libjava/java/nio/channels/ByteChannel.h new file mode 100644 index 000000000..a81364813 --- /dev/null +++ b/libjava/java/nio/channels/ByteChannel.h @@ -0,0 +1,36 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ByteChannel__ +#define __java_nio_channels_ByteChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class ByteChannel; + } + } + } +} + +class java::nio::channels::ByteChannel : public ::java::lang::Object +{ + +public: + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jboolean isOpen() = 0; + virtual void close() = 0; + virtual jint write(::java::nio::ByteBuffer *) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_ByteChannel__ diff --git a/libjava/java/nio/channels/CancelledKeyException.h b/libjava/java/nio/channels/CancelledKeyException.h new file mode 100644 index 000000000..742185f1f --- /dev/null +++ b/libjava/java/nio/channels/CancelledKeyException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_CancelledKeyException__ +#define __java_nio_channels_CancelledKeyException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class CancelledKeyException; + } + } + } +} + +class java::nio::channels::CancelledKeyException : public ::java::lang::IllegalStateException +{ + +public: + CancelledKeyException(); +private: + static const jlong serialVersionUID = -8438032138028814268LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_CancelledKeyException__ diff --git a/libjava/java/nio/channels/Channel.h b/libjava/java/nio/channels/Channel.h new file mode 100644 index 000000000..fc0177d6f --- /dev/null +++ b/libjava/java/nio/channels/Channel.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_Channel__ +#define __java_nio_channels_Channel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class Channel; + } + } + } +} + +class java::nio::channels::Channel : public ::java::lang::Object +{ + +public: + virtual jboolean isOpen() = 0; + virtual void close() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_Channel__ diff --git a/libjava/java/nio/channels/Channels.h b/libjava/java/nio/channels/Channels.h new file mode 100644 index 000000000..384156483 --- /dev/null +++ b/libjava/java/nio/channels/Channels.h @@ -0,0 +1,47 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_Channels__ +#define __java_nio_channels_Channels__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class Channels; + class ReadableByteChannel; + class WritableByteChannel; + } + namespace charset + { + class CharsetDecoder; + class CharsetEncoder; + } + } + } +} + +class java::nio::channels::Channels : public ::java::lang::Object +{ + + Channels(); +public: + static ::java::io::InputStream * newInputStream(::java::nio::channels::ReadableByteChannel *); + static ::java::io::OutputStream * newOutputStream(::java::nio::channels::WritableByteChannel *); + static ::java::nio::channels::ReadableByteChannel * newChannel(::java::io::InputStream *); + static ::java::nio::channels::WritableByteChannel * newChannel(::java::io::OutputStream *); + static ::java::io::Reader * newReader(::java::nio::channels::ReadableByteChannel *, ::java::nio::charset::CharsetDecoder *, jint); + static ::java::io::Reader * newReader(::java::nio::channels::ReadableByteChannel *, ::java::lang::String *); + static ::java::io::Writer * newWriter(::java::nio::channels::WritableByteChannel *, ::java::nio::charset::CharsetEncoder *, jint); + static ::java::io::Writer * newWriter(::java::nio::channels::WritableByteChannel *, ::java::lang::String *); + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_Channels__ diff --git a/libjava/java/nio/channels/ClosedByInterruptException.h b/libjava/java/nio/channels/ClosedByInterruptException.h new file mode 100644 index 000000000..742dddc60 --- /dev/null +++ b/libjava/java/nio/channels/ClosedByInterruptException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ClosedByInterruptException__ +#define __java_nio_channels_ClosedByInterruptException__ + +#pragma interface + +#include <java/nio/channels/AsynchronousCloseException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class ClosedByInterruptException; + } + } + } +} + +class java::nio::channels::ClosedByInterruptException : public ::java::nio::channels::AsynchronousCloseException +{ + +public: + ClosedByInterruptException(); +private: + static const jlong serialVersionUID = -4488191543534286750LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_ClosedByInterruptException__ diff --git a/libjava/java/nio/channels/ClosedChannelException.h b/libjava/java/nio/channels/ClosedChannelException.h new file mode 100644 index 000000000..3bca678e5 --- /dev/null +++ b/libjava/java/nio/channels/ClosedChannelException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ClosedChannelException__ +#define __java_nio_channels_ClosedChannelException__ + +#pragma interface + +#include <java/io/IOException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class ClosedChannelException; + } + } + } +} + +class java::nio::channels::ClosedChannelException : public ::java::io::IOException +{ + +public: + ClosedChannelException(); +private: + static const jlong serialVersionUID = 882777185433553857LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_ClosedChannelException__ diff --git a/libjava/java/nio/channels/ClosedSelectorException.h b/libjava/java/nio/channels/ClosedSelectorException.h new file mode 100644 index 000000000..80b821ed4 --- /dev/null +++ b/libjava/java/nio/channels/ClosedSelectorException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ClosedSelectorException__ +#define __java_nio_channels_ClosedSelectorException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class ClosedSelectorException; + } + } + } +} + +class java::nio::channels::ClosedSelectorException : public ::java::lang::IllegalStateException +{ + +public: + ClosedSelectorException(); +private: + static const jlong serialVersionUID = 6466297122317847835LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_ClosedSelectorException__ diff --git a/libjava/java/nio/channels/ConnectionPendingException.h b/libjava/java/nio/channels/ConnectionPendingException.h new file mode 100644 index 000000000..29f483071 --- /dev/null +++ b/libjava/java/nio/channels/ConnectionPendingException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ConnectionPendingException__ +#define __java_nio_channels_ConnectionPendingException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class ConnectionPendingException; + } + } + } +} + +class java::nio::channels::ConnectionPendingException : public ::java::lang::IllegalStateException +{ + +public: + ConnectionPendingException(); +private: + static const jlong serialVersionUID = 2008393366501760879LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_ConnectionPendingException__ diff --git a/libjava/java/nio/channels/DatagramChannel.h b/libjava/java/nio/channels/DatagramChannel.h new file mode 100644 index 000000000..cb2dabcc0 --- /dev/null +++ b/libjava/java/nio/channels/DatagramChannel.h @@ -0,0 +1,59 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_DatagramChannel__ +#define __java_nio_channels_DatagramChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelectableChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace net + { + class DatagramSocket; + class SocketAddress; + } + namespace nio + { + class ByteBuffer; + namespace channels + { + class DatagramChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::DatagramChannel : public ::java::nio::channels::spi::AbstractSelectableChannel +{ + +public: // actually protected + DatagramChannel(::java::nio::channels::spi::SelectorProvider *); +public: + static ::java::nio::channels::DatagramChannel * open(); + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *); + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *); + virtual ::java::nio::channels::DatagramChannel * connect(::java::net::SocketAddress *) = 0; + virtual ::java::nio::channels::DatagramChannel * disconnect() = 0; + virtual jboolean isConnected() = 0; + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual ::java::net::SocketAddress * receive(::java::nio::ByteBuffer *) = 0; + virtual jint send(::java::nio::ByteBuffer *, ::java::net::SocketAddress *) = 0; + virtual ::java::net::DatagramSocket * socket() = 0; + virtual jint write(::java::nio::ByteBuffer *) = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jint validOps(); + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_DatagramChannel__ diff --git a/libjava/java/nio/channels/FileChannel$MapMode.h b/libjava/java/nio/channels/FileChannel$MapMode.h new file mode 100644 index 000000000..954e6979e --- /dev/null +++ b/libjava/java/nio/channels/FileChannel$MapMode.h @@ -0,0 +1,40 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_FileChannel$MapMode__ +#define __java_nio_channels_FileChannel$MapMode__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class FileChannel$MapMode; + } + } + } +} + +class java::nio::channels::FileChannel$MapMode : public ::java::lang::Object +{ + +public: // actually package-private + FileChannel$MapMode(jint); +public: + virtual ::java::lang::String * toString(); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) m; +public: + static ::java::nio::channels::FileChannel$MapMode * READ_ONLY; + static ::java::nio::channels::FileChannel$MapMode * READ_WRITE; + static ::java::nio::channels::FileChannel$MapMode * PRIVATE; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_FileChannel$MapMode__ diff --git a/libjava/java/nio/channels/FileChannel.h b/libjava/java/nio/channels/FileChannel.h new file mode 100644 index 000000000..10cc314cc --- /dev/null +++ b/libjava/java/nio/channels/FileChannel.h @@ -0,0 +1,64 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_FileChannel__ +#define __java_nio_channels_FileChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractInterruptibleChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class MappedByteBuffer; + namespace channels + { + class FileChannel; + class FileChannel$MapMode; + class FileLock; + class ReadableByteChannel; + class WritableByteChannel; + } + } + } +} + +class java::nio::channels::FileChannel : public ::java::nio::channels::spi::AbstractInterruptibleChannel +{ + +public: // actually protected + FileChannel(); +public: + virtual ::java::nio::MappedByteBuffer * map(::java::nio::channels::FileChannel$MapMode *, jlong, jlong) = 0; + virtual jlong size() = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *); + virtual jint write(::java::nio::ByteBuffer *) = 0; + virtual jint write(::java::nio::ByteBuffer *, jlong) = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *); + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jint read(::java::nio::ByteBuffer *, jlong) = 0; +public: // actually protected + virtual void implCloseChannel() = 0; +public: + virtual void force(jboolean) = 0; + virtual ::java::nio::channels::FileLock * lock(); + virtual ::java::nio::channels::FileLock * lock(jlong, jlong, jboolean) = 0; + virtual ::java::nio::channels::FileLock * tryLock(); + virtual ::java::nio::channels::FileLock * tryLock(jlong, jlong, jboolean) = 0; + virtual jlong position() = 0; + virtual ::java::nio::channels::FileChannel * position(jlong) = 0; + virtual jlong transferTo(jlong, jlong, ::java::nio::channels::WritableByteChannel *) = 0; + virtual jlong transferFrom(::java::nio::channels::ReadableByteChannel *, jlong, jlong) = 0; + virtual ::java::nio::channels::FileChannel * truncate(jlong) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_FileChannel__ diff --git a/libjava/java/nio/channels/FileLock.h b/libjava/java/nio/channels/FileLock.h new file mode 100644 index 000000000..fb3585835 --- /dev/null +++ b/libjava/java/nio/channels/FileLock.h @@ -0,0 +1,48 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_FileLock__ +#define __java_nio_channels_FileLock__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class FileChannel; + class FileLock; + } + } + } +} + +class java::nio::channels::FileLock : public ::java::lang::Object +{ + +public: // actually protected + FileLock(::java::nio::channels::FileChannel *, jlong, jlong, jboolean); +public: + virtual jboolean isValid() = 0; + virtual void release() = 0; + virtual ::java::nio::channels::FileChannel * channel(); + virtual jboolean isShared(); + virtual jboolean overlaps(jlong, jlong); + virtual jlong position(); + virtual jlong size(); + virtual ::java::lang::String * toString(); +private: + ::java::nio::channels::FileChannel * __attribute__((aligned(__alignof__( ::java::lang::Object)))) channel__; + jlong position__; + jlong size__; + jboolean shared; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_FileLock__ diff --git a/libjava/java/nio/channels/FileLockInterruptionException.h b/libjava/java/nio/channels/FileLockInterruptionException.h new file mode 100644 index 000000000..ad5e25076 --- /dev/null +++ b/libjava/java/nio/channels/FileLockInterruptionException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_FileLockInterruptionException__ +#define __java_nio_channels_FileLockInterruptionException__ + +#pragma interface + +#include <java/io/IOException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class FileLockInterruptionException; + } + } + } +} + +class java::nio::channels::FileLockInterruptionException : public ::java::io::IOException +{ + +public: + FileLockInterruptionException(); +private: + static const jlong serialVersionUID = 7104080643653532383LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_FileLockInterruptionException__ diff --git a/libjava/java/nio/channels/GatheringByteChannel.h b/libjava/java/nio/channels/GatheringByteChannel.h new file mode 100644 index 000000000..c69c1954a --- /dev/null +++ b/libjava/java/nio/channels/GatheringByteChannel.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_GatheringByteChannel__ +#define __java_nio_channels_GatheringByteChannel__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class GatheringByteChannel; + } + } + } +} + +class java::nio::channels::GatheringByteChannel : public ::java::lang::Object +{ + +public: + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *) = 0; + virtual jint write(::java::nio::ByteBuffer *) = 0; + virtual jboolean isOpen() = 0; + virtual void close() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_GatheringByteChannel__ diff --git a/libjava/java/nio/channels/IllegalBlockingModeException.h b/libjava/java/nio/channels/IllegalBlockingModeException.h new file mode 100644 index 000000000..38eda0379 --- /dev/null +++ b/libjava/java/nio/channels/IllegalBlockingModeException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_IllegalBlockingModeException__ +#define __java_nio_channels_IllegalBlockingModeException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class IllegalBlockingModeException; + } + } + } +} + +class java::nio::channels::IllegalBlockingModeException : public ::java::lang::IllegalStateException +{ + +public: + IllegalBlockingModeException(); +private: + static const jlong serialVersionUID = -3335774961855590474LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_IllegalBlockingModeException__ diff --git a/libjava/java/nio/channels/IllegalSelectorException.h b/libjava/java/nio/channels/IllegalSelectorException.h new file mode 100644 index 000000000..9f137e423 --- /dev/null +++ b/libjava/java/nio/channels/IllegalSelectorException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_IllegalSelectorException__ +#define __java_nio_channels_IllegalSelectorException__ + +#pragma interface + +#include <java/lang/IllegalArgumentException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class IllegalSelectorException; + } + } + } +} + +class java::nio::channels::IllegalSelectorException : public ::java::lang::IllegalArgumentException +{ + +public: + IllegalSelectorException(); +private: + static const jlong serialVersionUID = -8406323347253320987LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_IllegalSelectorException__ diff --git a/libjava/java/nio/channels/InterruptibleChannel.h b/libjava/java/nio/channels/InterruptibleChannel.h new file mode 100644 index 000000000..fa8a68385 --- /dev/null +++ b/libjava/java/nio/channels/InterruptibleChannel.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_InterruptibleChannel__ +#define __java_nio_channels_InterruptibleChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class InterruptibleChannel; + } + } + } +} + +class java::nio::channels::InterruptibleChannel : public ::java::lang::Object +{ + +public: + virtual void close() = 0; + virtual jboolean isOpen() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_InterruptibleChannel__ diff --git a/libjava/java/nio/channels/NoConnectionPendingException.h b/libjava/java/nio/channels/NoConnectionPendingException.h new file mode 100644 index 000000000..5be57aefd --- /dev/null +++ b/libjava/java/nio/channels/NoConnectionPendingException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_NoConnectionPendingException__ +#define __java_nio_channels_NoConnectionPendingException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class NoConnectionPendingException; + } + } + } +} + +class java::nio::channels::NoConnectionPendingException : public ::java::lang::IllegalStateException +{ + +public: + NoConnectionPendingException(); +private: + static const jlong serialVersionUID = -8296561183633134743LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_NoConnectionPendingException__ diff --git a/libjava/java/nio/channels/NonReadableChannelException.h b/libjava/java/nio/channels/NonReadableChannelException.h new file mode 100644 index 000000000..210d8369b --- /dev/null +++ b/libjava/java/nio/channels/NonReadableChannelException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_NonReadableChannelException__ +#define __java_nio_channels_NonReadableChannelException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class NonReadableChannelException; + } + } + } +} + +class java::nio::channels::NonReadableChannelException : public ::java::lang::IllegalStateException +{ + +public: + NonReadableChannelException(); +private: + static const jlong serialVersionUID = -3200915679294993514LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_NonReadableChannelException__ diff --git a/libjava/java/nio/channels/NonWritableChannelException.h b/libjava/java/nio/channels/NonWritableChannelException.h new file mode 100644 index 000000000..4a56ef988 --- /dev/null +++ b/libjava/java/nio/channels/NonWritableChannelException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_NonWritableChannelException__ +#define __java_nio_channels_NonWritableChannelException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class NonWritableChannelException; + } + } + } +} + +class java::nio::channels::NonWritableChannelException : public ::java::lang::IllegalStateException +{ + +public: + NonWritableChannelException(); +private: + static const jlong serialVersionUID = -7071230488279011621LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_NonWritableChannelException__ diff --git a/libjava/java/nio/channels/NotYetBoundException.h b/libjava/java/nio/channels/NotYetBoundException.h new file mode 100644 index 000000000..d4f1ad2d6 --- /dev/null +++ b/libjava/java/nio/channels/NotYetBoundException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_NotYetBoundException__ +#define __java_nio_channels_NotYetBoundException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class NotYetBoundException; + } + } + } +} + +class java::nio::channels::NotYetBoundException : public ::java::lang::IllegalStateException +{ + +public: + NotYetBoundException(); +private: + static const jlong serialVersionUID = 4640999303950202242LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_NotYetBoundException__ diff --git a/libjava/java/nio/channels/NotYetConnectedException.h b/libjava/java/nio/channels/NotYetConnectedException.h new file mode 100644 index 000000000..a38417a82 --- /dev/null +++ b/libjava/java/nio/channels/NotYetConnectedException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_NotYetConnectedException__ +#define __java_nio_channels_NotYetConnectedException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class NotYetConnectedException; + } + } + } +} + +class java::nio::channels::NotYetConnectedException : public ::java::lang::IllegalStateException +{ + +public: + NotYetConnectedException(); +private: + static const jlong serialVersionUID = 4697316551909513464LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_NotYetConnectedException__ diff --git a/libjava/java/nio/channels/OverlappingFileLockException.h b/libjava/java/nio/channels/OverlappingFileLockException.h new file mode 100644 index 000000000..b2551f907 --- /dev/null +++ b/libjava/java/nio/channels/OverlappingFileLockException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_OverlappingFileLockException__ +#define __java_nio_channels_OverlappingFileLockException__ + +#pragma interface + +#include <java/lang/IllegalStateException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class OverlappingFileLockException; + } + } + } +} + +class java::nio::channels::OverlappingFileLockException : public ::java::lang::IllegalStateException +{ + +public: + OverlappingFileLockException(); +private: + static const jlong serialVersionUID = 2047812138163068433LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_OverlappingFileLockException__ diff --git a/libjava/java/nio/channels/Pipe$SinkChannel.h b/libjava/java/nio/channels/Pipe$SinkChannel.h new file mode 100644 index 000000000..d6842b79b --- /dev/null +++ b/libjava/java/nio/channels/Pipe$SinkChannel.h @@ -0,0 +1,44 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_Pipe$SinkChannel__ +#define __java_nio_channels_Pipe$SinkChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelectableChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class Pipe$SinkChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::Pipe$SinkChannel : public ::java::nio::channels::spi::AbstractSelectableChannel +{ + +public: // actually protected + Pipe$SinkChannel(::java::nio::channels::spi::SelectorProvider *); +public: + virtual jint validOps(); + virtual jint write(::java::nio::ByteBuffer *) = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_Pipe$SinkChannel__ diff --git a/libjava/java/nio/channels/Pipe$SourceChannel.h b/libjava/java/nio/channels/Pipe$SourceChannel.h new file mode 100644 index 000000000..9bc78ea3b --- /dev/null +++ b/libjava/java/nio/channels/Pipe$SourceChannel.h @@ -0,0 +1,44 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_Pipe$SourceChannel__ +#define __java_nio_channels_Pipe$SourceChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelectableChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class Pipe$SourceChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::Pipe$SourceChannel : public ::java::nio::channels::spi::AbstractSelectableChannel +{ + +public: // actually protected + Pipe$SourceChannel(::java::nio::channels::spi::SelectorProvider *); +public: + virtual jint validOps(); + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_Pipe$SourceChannel__ diff --git a/libjava/java/nio/channels/Pipe.h b/libjava/java/nio/channels/Pipe.h new file mode 100644 index 000000000..771dca23e --- /dev/null +++ b/libjava/java/nio/channels/Pipe.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_Pipe__ +#define __java_nio_channels_Pipe__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class Pipe; + class Pipe$SinkChannel; + class Pipe$SourceChannel; + } + } + } +} + +class java::nio::channels::Pipe : public ::java::lang::Object +{ + +public: // actually protected + Pipe(); +public: + static ::java::nio::channels::Pipe * open(); + virtual ::java::nio::channels::Pipe$SinkChannel * sink() = 0; + virtual ::java::nio::channels::Pipe$SourceChannel * source() = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_Pipe__ diff --git a/libjava/java/nio/channels/ReadableByteChannel.h b/libjava/java/nio/channels/ReadableByteChannel.h new file mode 100644 index 000000000..9f3e4cf01 --- /dev/null +++ b/libjava/java/nio/channels/ReadableByteChannel.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ReadableByteChannel__ +#define __java_nio_channels_ReadableByteChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class ReadableByteChannel; + } + } + } +} + +class java::nio::channels::ReadableByteChannel : public ::java::lang::Object +{ + +public: + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jboolean isOpen() = 0; + virtual void close() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_ReadableByteChannel__ diff --git a/libjava/java/nio/channels/ScatteringByteChannel.h b/libjava/java/nio/channels/ScatteringByteChannel.h new file mode 100644 index 000000000..eeba864d4 --- /dev/null +++ b/libjava/java/nio/channels/ScatteringByteChannel.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ScatteringByteChannel__ +#define __java_nio_channels_ScatteringByteChannel__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class ScatteringByteChannel; + } + } + } +} + +class java::nio::channels::ScatteringByteChannel : public ::java::lang::Object +{ + +public: + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *) = 0; + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jboolean isOpen() = 0; + virtual void close() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_ScatteringByteChannel__ diff --git a/libjava/java/nio/channels/SelectableChannel.h b/libjava/java/nio/channels/SelectableChannel.h new file mode 100644 index 000000000..82cf82880 --- /dev/null +++ b/libjava/java/nio/channels/SelectableChannel.h @@ -0,0 +1,48 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_SelectableChannel__ +#define __java_nio_channels_SelectableChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractInterruptibleChannel.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class SelectableChannel; + class SelectionKey; + class Selector; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::SelectableChannel : public ::java::nio::channels::spi::AbstractInterruptibleChannel +{ + +public: // actually protected + SelectableChannel(); +public: + virtual ::java::lang::Object * blockingLock() = 0; + virtual ::java::nio::channels::SelectableChannel * configureBlocking(jboolean) = 0; + virtual jboolean isBlocking() = 0; + virtual jboolean isRegistered() = 0; + virtual ::java::nio::channels::SelectionKey * keyFor(::java::nio::channels::Selector *) = 0; + virtual ::java::nio::channels::spi::SelectorProvider * provider() = 0; + virtual ::java::nio::channels::SelectionKey * register$(::java::nio::channels::Selector *, jint); + virtual ::java::nio::channels::SelectionKey * register$(::java::nio::channels::Selector *, jint, ::java::lang::Object *) = 0; + virtual jint validOps() = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_SelectableChannel__ diff --git a/libjava/java/nio/channels/SelectionKey.h b/libjava/java/nio/channels/SelectionKey.h new file mode 100644 index 000000000..1b6b03974 --- /dev/null +++ b/libjava/java/nio/channels/SelectionKey.h @@ -0,0 +1,55 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_SelectionKey__ +#define __java_nio_channels_SelectionKey__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class SelectableChannel; + class SelectionKey; + class Selector; + } + } + } +} + +class java::nio::channels::SelectionKey : public ::java::lang::Object +{ + +public: // actually protected + SelectionKey(); +public: + virtual ::java::lang::Object * attach(::java::lang::Object *); + virtual ::java::lang::Object * attachment(); + virtual jboolean isAcceptable(); + virtual jboolean isConnectable(); + virtual jboolean isReadable(); + virtual jboolean isWritable(); + virtual void cancel() = 0; + virtual ::java::nio::channels::SelectableChannel * channel() = 0; + virtual jint interestOps() = 0; + virtual ::java::nio::channels::SelectionKey * interestOps(jint) = 0; + virtual jboolean isValid() = 0; + virtual jint readyOps() = 0; + virtual ::java::nio::channels::Selector * selector() = 0; + static const jint OP_ACCEPT = 16; + static const jint OP_CONNECT = 8; + static const jint OP_READ = 1; + static const jint OP_WRITE = 4; +public: // actually package-private + ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) attached; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_SelectionKey__ diff --git a/libjava/java/nio/channels/Selector.h b/libjava/java/nio/channels/Selector.h new file mode 100644 index 000000000..7d561adff --- /dev/null +++ b/libjava/java/nio/channels/Selector.h @@ -0,0 +1,47 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_Selector__ +#define __java_nio_channels_Selector__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class Selector; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::Selector : public ::java::lang::Object +{ + +public: // actually protected + Selector(); +public: + static ::java::nio::channels::Selector * open(); + virtual void close() = 0; + virtual jboolean isOpen() = 0; + virtual ::java::util::Set * keys() = 0; + virtual ::java::nio::channels::spi::SelectorProvider * provider() = 0; + virtual jint select() = 0; + virtual jint select(jlong) = 0; + virtual ::java::util::Set * selectedKeys() = 0; + virtual jint selectNow() = 0; + virtual ::java::nio::channels::Selector * wakeup() = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_Selector__ diff --git a/libjava/java/nio/channels/ServerSocketChannel.h b/libjava/java/nio/channels/ServerSocketChannel.h new file mode 100644 index 000000000..b68d0b9a5 --- /dev/null +++ b/libjava/java/nio/channels/ServerSocketChannel.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_ServerSocketChannel__ +#define __java_nio_channels_ServerSocketChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelectableChannel.h> +extern "Java" +{ + namespace java + { + namespace net + { + class ServerSocket; + } + namespace nio + { + namespace channels + { + class ServerSocketChannel; + class SocketChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::ServerSocketChannel : public ::java::nio::channels::spi::AbstractSelectableChannel +{ + +public: // actually protected + ServerSocketChannel(::java::nio::channels::spi::SelectorProvider *); +public: + virtual ::java::nio::channels::SocketChannel * accept() = 0; + virtual ::java::net::ServerSocket * socket() = 0; + static ::java::nio::channels::ServerSocketChannel * open(); + virtual jint validOps(); + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_ServerSocketChannel__ diff --git a/libjava/java/nio/channels/SocketChannel.h b/libjava/java/nio/channels/SocketChannel.h new file mode 100644 index 000000000..b742cdbdc --- /dev/null +++ b/libjava/java/nio/channels/SocketChannel.h @@ -0,0 +1,59 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_SocketChannel__ +#define __java_nio_channels_SocketChannel__ + +#pragma interface + +#include <java/nio/channels/spi/AbstractSelectableChannel.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace net + { + class Socket; + class SocketAddress; + } + namespace nio + { + class ByteBuffer; + namespace channels + { + class SocketChannel; + namespace spi + { + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::SocketChannel : public ::java::nio::channels::spi::AbstractSelectableChannel +{ + +public: // actually protected + SocketChannel(::java::nio::channels::spi::SelectorProvider *); +public: + static ::java::nio::channels::SocketChannel * open(); + static ::java::nio::channels::SocketChannel * open(::java::net::SocketAddress *); + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *); + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *); + virtual jint validOps(); + virtual jint read(::java::nio::ByteBuffer *) = 0; + virtual jboolean connect(::java::net::SocketAddress *) = 0; + virtual jboolean finishConnect() = 0; + virtual jboolean isConnected() = 0; + virtual jboolean isConnectionPending() = 0; + virtual jlong read(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + virtual ::java::net::Socket * socket() = 0; + virtual jint write(::java::nio::ByteBuffer *) = 0; + virtual jlong write(JArray< ::java::nio::ByteBuffer * > *, jint, jint) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_SocketChannel__ diff --git a/libjava/java/nio/channels/UnresolvedAddressException.h b/libjava/java/nio/channels/UnresolvedAddressException.h new file mode 100644 index 000000000..2a3eefdce --- /dev/null +++ b/libjava/java/nio/channels/UnresolvedAddressException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_UnresolvedAddressException__ +#define __java_nio_channels_UnresolvedAddressException__ + +#pragma interface + +#include <java/lang/IllegalArgumentException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class UnresolvedAddressException; + } + } + } +} + +class java::nio::channels::UnresolvedAddressException : public ::java::lang::IllegalArgumentException +{ + +public: + UnresolvedAddressException(); +private: + static const jlong serialVersionUID = 6136959093620794148LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_UnresolvedAddressException__ diff --git a/libjava/java/nio/channels/UnsupportedAddressTypeException.h b/libjava/java/nio/channels/UnsupportedAddressTypeException.h new file mode 100644 index 000000000..7f63dd76e --- /dev/null +++ b/libjava/java/nio/channels/UnsupportedAddressTypeException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_UnsupportedAddressTypeException__ +#define __java_nio_channels_UnsupportedAddressTypeException__ + +#pragma interface + +#include <java/lang/IllegalArgumentException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class UnsupportedAddressTypeException; + } + } + } +} + +class java::nio::channels::UnsupportedAddressTypeException : public ::java::lang::IllegalArgumentException +{ + +public: + UnsupportedAddressTypeException(); +private: + static const jlong serialVersionUID = -2964323842829700493LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_UnsupportedAddressTypeException__ diff --git a/libjava/java/nio/channels/VMChannels.h b/libjava/java/nio/channels/VMChannels.h new file mode 100644 index 000000000..3706d9d85 --- /dev/null +++ b/libjava/java/nio/channels/VMChannels.h @@ -0,0 +1,52 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_VMChannels__ +#define __java_nio_channels_VMChannels__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace channels + { + class FileChannelImpl; + } + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class ReadableByteChannel; + class VMChannels; + class WritableByteChannel; + } + } + } +} + +class java::nio::channels::VMChannels : public ::java::lang::Object +{ + + VMChannels(); +public: // actually package-private + static ::java::io::FileInputStream * newInputStream(::gnu::java::nio::channels::FileChannelImpl *); + static ::java::io::FileOutputStream * newOutputStream(::gnu::java::nio::channels::FileChannelImpl *); + static ::java::io::InputStream * newInputStream(::java::nio::channels::ReadableByteChannel *); + static ::java::io::OutputStream * newOutputStream(::java::nio::channels::WritableByteChannel *); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_VMChannels__ diff --git a/libjava/java/nio/channels/VMChannels.java b/libjava/java/nio/channels/VMChannels.java new file mode 100644 index 000000000..4f43a42ad --- /dev/null +++ b/libjava/java/nio/channels/VMChannels.java @@ -0,0 +1,85 @@ +/* VMChannels.java -- + Copyright (C) 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 java.nio.channels; + +import gnu.java.nio.ChannelInputStream; +import gnu.java.nio.ChannelOutputStream; +import gnu.java.nio.channels.FileChannelImpl; + +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.io.OutputStream; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationTargetException; + +final class VMChannels +{ + /** + * This class isn't intended to be instantiated. + */ + private VMChannels() + { + // Do nothing here. + } + + static native FileInputStream newInputStream(FileChannelImpl ch); + + static native FileOutputStream newOutputStream(FileChannelImpl ch); + + /** + * Constructs a stream that reads bytes from the given channel. + */ + static InputStream newInputStream(ReadableByteChannel ch) + { + if (ch instanceof FileChannelImpl) + return newInputStream((FileChannelImpl) ch); + return new ChannelInputStream(ch); + } + + /** + * Constructs a stream that writes bytes to the given channel. + */ + static OutputStream newOutputStream(WritableByteChannel ch) + { + if (ch instanceof FileChannelImpl) + return newOutputStream((FileChannelImpl) ch); + return new ChannelOutputStream(ch); + } +} diff --git a/libjava/java/nio/channels/WritableByteChannel.h b/libjava/java/nio/channels/WritableByteChannel.h new file mode 100644 index 000000000..ff413d27a --- /dev/null +++ b/libjava/java/nio/channels/WritableByteChannel.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_WritableByteChannel__ +#define __java_nio_channels_WritableByteChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + namespace channels + { + class WritableByteChannel; + } + } + } +} + +class java::nio::channels::WritableByteChannel : public ::java::lang::Object +{ + +public: + virtual jint write(::java::nio::ByteBuffer *) = 0; + virtual jboolean isOpen() = 0; + virtual void close() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_nio_channels_WritableByteChannel__ diff --git a/libjava/java/nio/channels/natVMChannels.cc b/libjava/java/nio/channels/natVMChannels.cc new file mode 100644 index 000000000..d40a51653 --- /dev/null +++ b/libjava/java/nio/channels/natVMChannels.cc @@ -0,0 +1,37 @@ +// natVMChannels.cc - Native part of VMChannels class. + +/* Copyright (C) 2004, 2006 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 <gcj/cni.h> + +#include <java/nio/channels/VMChannels.h> +#include <java/nio/channels/Channels.h> +#include <java/io/FileInputStream.h> +#include <java/io/FileOutputStream.h> +#include <gnu/java/nio/channels/FileChannelImpl.h> + +using java::nio::channels::VMChannels; +using java::io::FileInputStream; +using java::io::FileOutputStream; +using gnu::java::nio::channels::FileChannelImpl; + +FileInputStream* +VMChannels::newInputStream(FileChannelImpl* ch) +{ + // Needs to be native to bypass Java access protection. + return new FileInputStream (ch); +} + +FileOutputStream* +VMChannels::newOutputStream(FileChannelImpl* ch) +{ + // Needs to be native to bypass Java access protection. + return new FileOutputStream (ch); +} diff --git a/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.h b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.h new file mode 100644 index 000000000..f830a752b --- /dev/null +++ b/libjava/java/nio/channels/spi/AbstractInterruptibleChannel.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_spi_AbstractInterruptibleChannel__ +#define __java_nio_channels_spi_AbstractInterruptibleChannel__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + namespace spi + { + class AbstractInterruptibleChannel; + } + } + } + } +} + +class java::nio::channels::spi::AbstractInterruptibleChannel : public ::java::lang::Object +{ + +public: // actually protected + AbstractInterruptibleChannel(); + virtual void begin(); +public: + virtual void close(); +public: // actually protected + virtual void end(jboolean); + virtual void implCloseChannel() = 0; +public: + virtual jboolean isOpen(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::lang::Object)))) closed; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_spi_AbstractInterruptibleChannel__ diff --git a/libjava/java/nio/channels/spi/AbstractSelectableChannel.h b/libjava/java/nio/channels/spi/AbstractSelectableChannel.h new file mode 100644 index 000000000..f126f441e --- /dev/null +++ b/libjava/java/nio/channels/spi/AbstractSelectableChannel.h @@ -0,0 +1,64 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_spi_AbstractSelectableChannel__ +#define __java_nio_channels_spi_AbstractSelectableChannel__ + +#pragma interface + +#include <java/nio/channels/SelectableChannel.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class SelectableChannel; + class SelectionKey; + class Selector; + namespace spi + { + class AbstractSelectableChannel; + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::spi::AbstractSelectableChannel : public ::java::nio::channels::SelectableChannel +{ + +public: // actually protected + AbstractSelectableChannel(::java::nio::channels::spi::SelectorProvider *); +public: + virtual ::java::lang::Object * blockingLock(); + virtual ::java::nio::channels::SelectableChannel * configureBlocking(jboolean); +public: // actually protected + virtual void implCloseChannel(); + virtual void implCloseSelectableChannel() = 0; + virtual void implConfigureBlocking(jboolean) = 0; +public: + virtual jboolean isBlocking(); + virtual jboolean isRegistered(); + virtual ::java::nio::channels::SelectionKey * keyFor(::java::nio::channels::Selector *); + virtual ::java::nio::channels::spi::SelectorProvider * provider(); +private: + ::java::nio::channels::SelectionKey * locate(::java::nio::channels::Selector *); +public: + virtual ::java::nio::channels::SelectionKey * register$(::java::nio::channels::Selector *, jint, ::java::lang::Object *); +public: // actually package-private + virtual void addSelectionKey(::java::nio::channels::SelectionKey *); + virtual void removeSelectionKey(::java::nio::channels::SelectionKey *); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::channels::SelectableChannel)))) blocking; + ::java::lang::Object * LOCK; + ::java::nio::channels::spi::SelectorProvider * provider__; + ::java::util::LinkedList * keys; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_spi_AbstractSelectableChannel__ diff --git a/libjava/java/nio/channels/spi/AbstractSelectionKey.h b/libjava/java/nio/channels/spi/AbstractSelectionKey.h new file mode 100644 index 000000000..d64a73bfd --- /dev/null +++ b/libjava/java/nio/channels/spi/AbstractSelectionKey.h @@ -0,0 +1,41 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_spi_AbstractSelectionKey__ +#define __java_nio_channels_spi_AbstractSelectionKey__ + +#pragma interface + +#include <java/nio/channels/SelectionKey.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + namespace spi + { + class AbstractSelectionKey; + } + } + } + } +} + +class java::nio::channels::spi::AbstractSelectionKey : public ::java::nio::channels::SelectionKey +{ + +public: // actually protected + AbstractSelectionKey(); +public: + virtual void cancel(); + virtual jboolean isValid(); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::channels::SelectionKey)))) cancelled; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_spi_AbstractSelectionKey__ diff --git a/libjava/java/nio/channels/spi/AbstractSelector.h b/libjava/java/nio/channels/spi/AbstractSelector.h new file mode 100644 index 000000000..cf3d2b7c4 --- /dev/null +++ b/libjava/java/nio/channels/spi/AbstractSelector.h @@ -0,0 +1,60 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_spi_AbstractSelector__ +#define __java_nio_channels_spi_AbstractSelector__ + +#pragma interface + +#include <java/nio/channels/Selector.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class SelectionKey; + namespace spi + { + class AbstractSelectableChannel; + class AbstractSelectionKey; + class AbstractSelector; + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::spi::AbstractSelector : public ::java::nio::channels::Selector +{ + +public: // actually protected + AbstractSelector(::java::nio::channels::spi::SelectorProvider *); +public: + virtual void close(); + virtual jboolean isOpen(); +public: // actually protected + virtual void begin(); + virtual void end(); +public: + virtual ::java::nio::channels::spi::SelectorProvider * provider(); +public: // actually protected + virtual ::java::util::Set * cancelledKeys(); +public: // actually package-private + virtual void cancelKey(::java::nio::channels::spi::AbstractSelectionKey *); +public: // actually protected + virtual void implCloseSelector() = 0; + virtual ::java::nio::channels::SelectionKey * register$(::java::nio::channels::spi::AbstractSelectableChannel *, jint, ::java::lang::Object *) = 0; + virtual void deregister(::java::nio::channels::spi::AbstractSelectionKey *); +private: + jboolean __attribute__((aligned(__alignof__( ::java::nio::channels::Selector)))) closed; + ::java::nio::channels::spi::SelectorProvider * provider__; + ::java::util::HashSet * cancelledKeys__; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_spi_AbstractSelector__ diff --git a/libjava/java/nio/channels/spi/SelectorProvider.h b/libjava/java/nio/channels/spi/SelectorProvider.h new file mode 100644 index 000000000..a6b7052be --- /dev/null +++ b/libjava/java/nio/channels/spi/SelectorProvider.h @@ -0,0 +1,52 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_channels_spi_SelectorProvider__ +#define __java_nio_channels_spi_SelectorProvider__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class Channel; + class DatagramChannel; + class Pipe; + class ServerSocketChannel; + class SocketChannel; + namespace spi + { + class AbstractSelector; + class SelectorProvider; + } + } + } + } +} + +class java::nio::channels::spi::SelectorProvider : public ::java::lang::Object +{ + +public: // actually protected + SelectorProvider(); +public: + virtual ::java::nio::channels::DatagramChannel * openDatagramChannel() = 0; + virtual ::java::nio::channels::Pipe * openPipe() = 0; + virtual ::java::nio::channels::spi::AbstractSelector * openSelector() = 0; + virtual ::java::nio::channels::ServerSocketChannel * openServerSocketChannel() = 0; + virtual ::java::nio::channels::SocketChannel * openSocketChannel() = 0; + virtual ::java::nio::channels::Channel * inheritedChannel(); + static ::java::nio::channels::spi::SelectorProvider * provider(); +private: + static ::java::nio::channels::spi::SelectorProvider * systemDefaultProvider; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_channels_spi_SelectorProvider__ diff --git a/libjava/java/nio/charset/CharacterCodingException.h b/libjava/java/nio/charset/CharacterCodingException.h new file mode 100644 index 000000000..35935cd1f --- /dev/null +++ b/libjava/java/nio/charset/CharacterCodingException.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CharacterCodingException__ +#define __java_nio_charset_CharacterCodingException__ + +#pragma interface + +#include <java/io/IOException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CharacterCodingException; + } + } + } +} + +class java::nio::charset::CharacterCodingException : public ::java::io::IOException +{ + +public: + CharacterCodingException(); +private: + static const jlong serialVersionUID = 8421532232154627783LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CharacterCodingException__ diff --git a/libjava/java/nio/charset/Charset.h b/libjava/java/nio/charset/Charset.h new file mode 100644 index 000000000..dabf4671d --- /dev/null +++ b/libjava/java/nio/charset/Charset.h @@ -0,0 +1,80 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_Charset__ +#define __java_nio_charset_Charset__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CharsetDecoder; + class CharsetEncoder; + namespace spi + { + class CharsetProvider; + } + } + } + } +} + +class java::nio::charset::Charset : public ::java::lang::Object +{ + +public: // actually protected + Charset(::java::lang::String *, JArray< ::java::lang::String * > *); +private: + static void checkName(::java::lang::String *); +public: + static ::java::nio::charset::Charset * defaultCharset(); + static jboolean isSupported(::java::lang::String *); + static ::java::nio::charset::Charset * forName(::java::lang::String *); +private: + static ::java::nio::charset::Charset * charsetForName(::java::lang::String *); +public: + static ::java::util::SortedMap * availableCharsets(); +private: + static ::java::nio::charset::spi::CharsetProvider * provider(); + static JArray< ::java::nio::charset::spi::CharsetProvider * > * providers2(); +public: + virtual ::java::lang::String * name(); + virtual ::java::util::Set * aliases(); + virtual ::java::lang::String * displayName(); + virtual ::java::lang::String * displayName(::java::util::Locale *); + virtual jboolean isRegistered(); + virtual jboolean contains(::java::nio::charset::Charset *) = 0; + virtual ::java::nio::charset::CharsetDecoder * newDecoder() = 0; + virtual ::java::nio::charset::CharsetEncoder * newEncoder() = 0; + virtual jboolean canEncode(); + virtual ::java::nio::ByteBuffer * encode(::java::nio::CharBuffer *); + virtual ::java::nio::ByteBuffer * encode(::java::lang::String *); + virtual ::java::nio::CharBuffer * decode(::java::nio::ByteBuffer *); + virtual jint Charset$compareTo(::java::nio::charset::Charset *); + virtual jint hashCode(); + virtual jboolean equals(::java::lang::Object *); + virtual ::java::lang::String * toString(); + virtual jint compareTo(::java::lang::Object *); +private: + ::java::nio::charset::CharsetEncoder * __attribute__((aligned(__alignof__( ::java::lang::Object)))) cachedEncoder; + ::java::nio::charset::CharsetDecoder * cachedDecoder; + static JArray< ::java::nio::charset::spi::CharsetProvider * > * providers; + ::java::lang::String * canonicalName; + JArray< ::java::lang::String * > * aliases__; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_Charset__ diff --git a/libjava/java/nio/charset/Charset.java b/libjava/java/nio/charset/Charset.java new file mode 100644 index 000000000..04b381948 --- /dev/null +++ b/libjava/java/nio/charset/Charset.java @@ -0,0 +1,414 @@ +/* Charset.java -- + Copyright (C) 2002, 2004, 2005, 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 java.nio.charset; + +import gnu.classpath.ServiceFactory; +import gnu.classpath.SystemProperties; +import gnu.java.nio.charset.Provider; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.URL; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.spi.CharsetProvider; +import java.util.Collections; +import java.util.Enumeration; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashSet; +import java.util.Locale; +import java.util.Set; +import java.util.SortedMap; +import java.util.TreeMap; + +/** + * @author Jesse Rosenstock + * @since 1.4 + * @status updated to 1.5 + */ +public abstract class Charset implements Comparable<Charset> +{ + private CharsetEncoder cachedEncoder; + private CharsetDecoder cachedDecoder; + + /** + * Extra Charset providers. + */ + private static CharsetProvider[] providers; + + private final String canonicalName; + private final String[] aliases; + + protected Charset (String canonicalName, String[] aliases) + { + checkName (canonicalName); + if (aliases != null) + { + int n = aliases.length; + for (int i = 0; i < n; ++i) + checkName (aliases[i]); + } + + cachedEncoder = null; + cachedDecoder = null; + this.canonicalName = canonicalName; + this.aliases = aliases; + } + + /** + * @throws IllegalCharsetNameException if the name is illegal + */ + private static void checkName (String name) + { + int n = name.length (); + + if (n == 0) + throw new IllegalCharsetNameException (name); + + char ch = name.charAt (0); + if (!(('A' <= ch && ch <= 'Z') + || ('a' <= ch && ch <= 'z') + || ('0' <= ch && ch <= '9'))) + throw new IllegalCharsetNameException (name); + + for (int i = 1; i < n; ++i) + { + ch = name.charAt (i); + if (!(('A' <= ch && ch <= 'Z') + || ('a' <= ch && ch <= 'z') + || ('0' <= ch && ch <= '9') + || ch == '-' || ch == '.' || ch == ':' || ch == '_')) + throw new IllegalCharsetNameException (name); + } + } + + /** + * Returns the system default charset. + * + * This may be set by the user or VM with the file.encoding + * property. + * + * @since 1.5 + */ + public static Charset defaultCharset() + { + String encoding; + + try + { + encoding = SystemProperties.getProperty("file.encoding"); + } + catch(SecurityException e) + { + // Use fallback. + encoding = "ISO-8859-1"; + } + catch(IllegalArgumentException e) + { + // Use fallback. + encoding = "ISO-8859-1"; + } + + try + { + return forName(encoding); + } + catch(UnsupportedCharsetException e) + { + // Ignore. + } + catch(IllegalCharsetNameException e) + { + // Ignore. + } + catch(IllegalArgumentException e) + { + // Ignore. + } + + throw new IllegalStateException("Can't get default charset!"); + } + + public static boolean isSupported (String charsetName) + { + return charsetForName (charsetName) != null; + } + + /** + * Returns the Charset instance for the charset of the given name. + * + * @param charsetName + * @return the Charset instance for the indicated charset + * @throws UnsupportedCharsetException if this VM does not support + * the charset of the given name. + * @throws IllegalCharsetNameException if the given charset name is + * legal. + * @throws IllegalArgumentException if <code>charsetName</code> is null. + */ + public static Charset forName (String charsetName) + { + // Throws IllegalArgumentException as the JDK does. + if(charsetName == null) + throw new IllegalArgumentException("Charset name must not be null."); + + Charset cs = charsetForName (charsetName); + if (cs == null) + throw new UnsupportedCharsetException (charsetName); + return cs; + } + + /** + * Retrieves a charset for the given charset name. + * + * @return A charset object for the charset with the specified name, or + * <code>null</code> if no such charset exists. + * + * @throws IllegalCharsetNameException if the name is illegal + */ + private static Charset charsetForName(String charsetName) + { + checkName (charsetName); + // Try the default provider first + // (so we don't need to load external providers unless really necessary) + // if it is an exotic charset try loading the external providers. + Charset cs = provider().charsetForName(charsetName); + if (cs == null) + { + CharsetProvider[] providers = providers2(); + for (int i = 0; i < providers.length; i++) + { + cs = providers[i].charsetForName(charsetName); + if (cs != null) + break; + } + } + return cs; + } + + public static SortedMap<String, Charset> availableCharsets() + { + TreeMap<String, Charset> charsets + = new TreeMap(String.CASE_INSENSITIVE_ORDER); + for (Iterator<Charset> i = provider().charsets(); i.hasNext(); ) + { + Charset cs = i.next(); + charsets.put(cs.name(), cs); + } + + CharsetProvider[] providers = providers2(); + for (int j = 0; j < providers.length; j++) + { + for (Iterator<Charset> i = providers[j].charsets(); i.hasNext(); ) + { + Charset cs = (Charset) i.next(); + charsets.put(cs.name(), cs); + } + } + + return Collections.unmodifiableSortedMap(charsets); + } + + private static CharsetProvider provider() + { + try + { + String s = System.getProperty("charset.provider"); + if (s != null) + { + CharsetProvider p = + (CharsetProvider) ((Class.forName(s)).newInstance()); + return p; + } + } + catch (Exception e) + { + // Ignore. + } + + return Provider.provider(); + } + + /** + * We need to support multiple providers, reading them from + * java.nio.charset.spi.CharsetProvider in the resource directory + * META-INF/services. This returns the "extra" charset providers. + */ + private static CharsetProvider[] providers2() + { + if (providers == null) + { + try + { + Iterator i = ServiceFactory.lookupProviders(CharsetProvider.class); + LinkedHashSet set = new LinkedHashSet(); + while (i.hasNext()) + set.add(i.next()); + + providers = new CharsetProvider[set.size()]; + set.toArray(providers); + } + catch (Exception e) + { + throw new RuntimeException(e); + } + } + return providers; + } + + public final String name () + { + return canonicalName; + } + + public final Set<String> aliases () + { + if (aliases == null) + return Collections.<String>emptySet(); + + // should we cache the aliasSet instead? + int n = aliases.length; + HashSet<String> aliasSet = new HashSet<String> (n); + for (int i = 0; i < n; ++i) + aliasSet.add (aliases[i]); + return Collections.unmodifiableSet (aliasSet); + } + + public String displayName () + { + return canonicalName; + } + + public String displayName (Locale locale) + { + return canonicalName; + } + + public final boolean isRegistered () + { + return (!canonicalName.startsWith ("x-") + && !canonicalName.startsWith ("X-")); + } + + public abstract boolean contains (Charset cs); + + public abstract CharsetDecoder newDecoder (); + + public abstract CharsetEncoder newEncoder (); + + public boolean canEncode () + { + return true; + } + + // NB: This implementation serializes different threads calling + // Charset.encode(), a potential performance problem. It might + // be better to remove the cache, or use ThreadLocal to cache on + // a per-thread basis. + public final synchronized ByteBuffer encode (CharBuffer cb) + { + try + { + if (cachedEncoder == null) + { + cachedEncoder = newEncoder () + .onMalformedInput (CodingErrorAction.REPLACE) + .onUnmappableCharacter (CodingErrorAction.REPLACE); + } else + cachedEncoder.reset(); + return cachedEncoder.encode (cb); + } + catch (CharacterCodingException e) + { + throw new AssertionError (e); + } + } + + public final ByteBuffer encode (String str) + { + return encode (CharBuffer.wrap (str)); + } + + // NB: This implementation serializes different threads calling + // Charset.decode(), a potential performance problem. It might + // be better to remove the cache, or use ThreadLocal to cache on + // a per-thread basis. + public final synchronized CharBuffer decode (ByteBuffer bb) + { + try + { + if (cachedDecoder == null) + { + cachedDecoder = newDecoder () + .onMalformedInput (CodingErrorAction.REPLACE) + .onUnmappableCharacter (CodingErrorAction.REPLACE); + } else + cachedDecoder.reset(); + + return cachedDecoder.decode (bb); + } + catch (CharacterCodingException e) + { + throw new AssertionError (e); + } + } + + public final int compareTo (Charset other) + { + return canonicalName.compareToIgnoreCase (other.canonicalName); + } + + public final int hashCode () + { + return canonicalName.hashCode (); + } + + public final boolean equals (Object ob) + { + if (ob instanceof Charset) + return canonicalName.equalsIgnoreCase (((Charset) ob).canonicalName); + else + return false; + } + + public final String toString () + { + return canonicalName; + } +} diff --git a/libjava/java/nio/charset/CharsetDecoder.h b/libjava/java/nio/charset/CharsetDecoder.h new file mode 100644 index 000000000..fe75d48a5 --- /dev/null +++ b/libjava/java/nio/charset/CharsetDecoder.h @@ -0,0 +1,81 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CharsetDecoder__ +#define __java_nio_charset_CharsetDecoder__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CharsetDecoder; + class CoderResult; + class CodingErrorAction; + } + } + } +} + +class java::nio::charset::CharsetDecoder : public ::java::lang::Object +{ + + CharsetDecoder(::java::nio::charset::Charset *, jfloat, jfloat, ::java::lang::String *); +public: // actually protected + CharsetDecoder(::java::nio::charset::Charset *, jfloat, jfloat); +public: + virtual jfloat averageCharsPerByte(); + virtual ::java::nio::charset::Charset * charset(); + virtual ::java::nio::CharBuffer * decode(::java::nio::ByteBuffer *); + virtual ::java::nio::charset::CoderResult * decode(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *, jboolean); +public: // actually protected + virtual ::java::nio::charset::CoderResult * decodeLoop(::java::nio::ByteBuffer *, ::java::nio::CharBuffer *) = 0; +public: + virtual ::java::nio::charset::Charset * detectedCharset(); + virtual ::java::nio::charset::CoderResult * flush(::java::nio::CharBuffer *); +public: // actually protected + virtual ::java::nio::charset::CoderResult * implFlush(::java::nio::CharBuffer *); +public: + virtual ::java::nio::charset::CharsetDecoder * onMalformedInput(::java::nio::charset::CodingErrorAction *); +public: // actually protected + virtual void implOnMalformedInput(::java::nio::charset::CodingErrorAction *); + virtual void implOnUnmappableCharacter(::java::nio::charset::CodingErrorAction *); + virtual void implReplaceWith(::java::lang::String *); + virtual void implReset(); +public: + virtual jboolean isAutoDetecting(); + virtual jboolean isCharsetDetected(); + virtual ::java::nio::charset::CodingErrorAction * malformedInputAction(); + virtual jfloat maxCharsPerByte(); + virtual ::java::nio::charset::CharsetDecoder * onUnmappableCharacter(::java::nio::charset::CodingErrorAction *); + virtual ::java::lang::String * replacement(); + virtual ::java::nio::charset::CharsetDecoder * replaceWith(::java::lang::String *); + virtual ::java::nio::charset::CharsetDecoder * reset(); + virtual ::java::nio::charset::CodingErrorAction * unmappableCharacterAction(); +private: + static const jint STATE_RESET = 0; + static const jint STATE_CODING = 1; + static const jint STATE_END = 2; + static const jint STATE_FLUSHED = 3; + static ::java::lang::String * DEFAULT_REPLACEMENT; + ::java::nio::charset::Charset * __attribute__((aligned(__alignof__( ::java::lang::Object)))) charset__; + jfloat averageCharsPerByte__; + jfloat maxCharsPerByte__; + ::java::lang::String * replacement__; + jint state; + ::java::nio::charset::CodingErrorAction * malformedInputAction__; + ::java::nio::charset::CodingErrorAction * unmappableCharacterAction__; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CharsetDecoder__ diff --git a/libjava/java/nio/charset/CharsetEncoder.h b/libjava/java/nio/charset/CharsetEncoder.h new file mode 100644 index 000000000..5a64e44f7 --- /dev/null +++ b/libjava/java/nio/charset/CharsetEncoder.h @@ -0,0 +1,84 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CharsetEncoder__ +#define __java_nio_charset_CharsetEncoder__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class ByteBuffer; + class CharBuffer; + namespace charset + { + class Charset; + class CharsetEncoder; + class CoderResult; + class CodingErrorAction; + } + } + } +} + +class java::nio::charset::CharsetEncoder : public ::java::lang::Object +{ + +public: // actually protected + CharsetEncoder(::java::nio::charset::Charset *, jfloat, jfloat); + CharsetEncoder(::java::nio::charset::Charset *, jfloat, jfloat, JArray< jbyte > *); +public: + virtual jfloat averageBytesPerChar(); + virtual jboolean canEncode(jchar); + virtual jboolean canEncode(::java::lang::CharSequence *); +private: + jboolean canEncode(::java::nio::CharBuffer *); +public: + virtual ::java::nio::charset::Charset * charset(); + virtual ::java::nio::ByteBuffer * encode(::java::nio::CharBuffer *); + virtual ::java::nio::charset::CoderResult * encode(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *, jboolean); +public: // actually protected + virtual ::java::nio::charset::CoderResult * encodeLoop(::java::nio::CharBuffer *, ::java::nio::ByteBuffer *) = 0; +public: + virtual ::java::nio::charset::CoderResult * flush(::java::nio::ByteBuffer *); +public: // actually protected + virtual ::java::nio::charset::CoderResult * implFlush(::java::nio::ByteBuffer *); + virtual void implOnMalformedInput(::java::nio::charset::CodingErrorAction *); + virtual void implOnUnmappableCharacter(::java::nio::charset::CodingErrorAction *); + virtual void implReplaceWith(JArray< jbyte > *); + virtual void implReset(); +public: + virtual jboolean isLegalReplacement(JArray< jbyte > *); + virtual ::java::nio::charset::CodingErrorAction * malformedInputAction(); + virtual jfloat maxBytesPerChar(); + virtual ::java::nio::charset::CharsetEncoder * onMalformedInput(::java::nio::charset::CodingErrorAction *); + virtual ::java::nio::charset::CodingErrorAction * unmappableCharacterAction(); + virtual ::java::nio::charset::CharsetEncoder * onUnmappableCharacter(::java::nio::charset::CodingErrorAction *); + virtual JArray< jbyte > * replacement(); + virtual ::java::nio::charset::CharsetEncoder * replaceWith(JArray< jbyte > *); + virtual ::java::nio::charset::CharsetEncoder * reset(); +private: + static const jint STATE_RESET = 0; + static const jint STATE_CODING = 1; + static const jint STATE_END = 2; + static const jint STATE_FLUSHED = 3; + static JArray< jbyte > * DEFAULT_REPLACEMENT; + ::java::nio::charset::Charset * __attribute__((aligned(__alignof__( ::java::lang::Object)))) charset__; + jfloat averageBytesPerChar__; + jfloat maxBytesPerChar__; + JArray< jbyte > * replacement__; + jint state; + ::java::nio::charset::CodingErrorAction * malformedInputAction__; + ::java::nio::charset::CodingErrorAction * unmappableCharacterAction__; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CharsetEncoder__ diff --git a/libjava/java/nio/charset/CoderMalfunctionError.h b/libjava/java/nio/charset/CoderMalfunctionError.h new file mode 100644 index 000000000..b3ae83adf --- /dev/null +++ b/libjava/java/nio/charset/CoderMalfunctionError.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CoderMalfunctionError__ +#define __java_nio_charset_CoderMalfunctionError__ + +#pragma interface + +#include <java/lang/Error.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CoderMalfunctionError; + } + } + } +} + +class java::nio::charset::CoderMalfunctionError : public ::java::lang::Error +{ + +public: + CoderMalfunctionError(::java::lang::Exception *); +private: + static const jlong serialVersionUID = -1151412348057794301LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CoderMalfunctionError__ diff --git a/libjava/java/nio/charset/CoderResult$1.h b/libjava/java/nio/charset/CoderResult$1.h new file mode 100644 index 000000000..421777005 --- /dev/null +++ b/libjava/java/nio/charset/CoderResult$1.h @@ -0,0 +1,36 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CoderResult$1__ +#define __java_nio_charset_CoderResult$1__ + +#pragma interface + +#include <java/nio/charset/CoderResult$Cache.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CoderResult; + class CoderResult$1; + } + } + } +} + +class java::nio::charset::CoderResult$1 : public ::java::nio::charset::CoderResult$Cache +{ + +public: // actually package-private + CoderResult$1(); +public: // actually protected + virtual ::java::nio::charset::CoderResult * make(jint); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CoderResult$1__ diff --git a/libjava/java/nio/charset/CoderResult$2.h b/libjava/java/nio/charset/CoderResult$2.h new file mode 100644 index 000000000..60dcbdcb2 --- /dev/null +++ b/libjava/java/nio/charset/CoderResult$2.h @@ -0,0 +1,36 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CoderResult$2__ +#define __java_nio_charset_CoderResult$2__ + +#pragma interface + +#include <java/nio/charset/CoderResult$Cache.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CoderResult; + class CoderResult$2; + } + } + } +} + +class java::nio::charset::CoderResult$2 : public ::java::nio::charset::CoderResult$Cache +{ + +public: // actually package-private + CoderResult$2(); +public: // actually protected + virtual ::java::nio::charset::CoderResult * make(jint); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CoderResult$2__ diff --git a/libjava/java/nio/charset/CoderResult$Cache.h b/libjava/java/nio/charset/CoderResult$Cache.h new file mode 100644 index 000000000..38416bd9e --- /dev/null +++ b/libjava/java/nio/charset/CoderResult$Cache.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CoderResult$Cache__ +#define __java_nio_charset_CoderResult$Cache__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CoderResult; + class CoderResult$Cache; + } + } + } +} + +class java::nio::charset::CoderResult$Cache : public ::java::lang::Object +{ + +public: // actually package-private + CoderResult$Cache(); + virtual ::java::nio::charset::CoderResult * get(jint); +public: // actually protected + virtual ::java::nio::charset::CoderResult * make(jint) = 0; +private: + ::java::util::HashMap * __attribute__((aligned(__alignof__( ::java::lang::Object)))) cache; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CoderResult$Cache__ diff --git a/libjava/java/nio/charset/CoderResult.h b/libjava/java/nio/charset/CoderResult.h new file mode 100644 index 000000000..e2c84a61c --- /dev/null +++ b/libjava/java/nio/charset/CoderResult.h @@ -0,0 +1,61 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CoderResult__ +#define __java_nio_charset_CoderResult__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CoderResult; + class CoderResult$Cache; + } + } + } +} + +class java::nio::charset::CoderResult : public ::java::lang::Object +{ + +public: // actually package-private + CoderResult(jint, jint); +public: + virtual jboolean isError(); + virtual jboolean isMalformed(); + virtual jboolean isOverflow(); + virtual jboolean isUnderflow(); + virtual jboolean isUnmappable(); + virtual jint length(); + static ::java::nio::charset::CoderResult * malformedForLength(jint); + virtual void throwException(); + virtual ::java::lang::String * toString(); + static ::java::nio::charset::CoderResult * unmappableForLength(jint); +private: + static const jint TYPE_MALFORMED = 0; + static const jint TYPE_OVERFLOW = 1; + static const jint TYPE_UNDERFLOW = 2; + static const jint TYPE_UNMAPPABLE = 3; +public: + static ::java::nio::charset::CoderResult * OVERFLOW; + static ::java::nio::charset::CoderResult * UNDERFLOW; +private: + static JArray< ::java::lang::String * > * names; + static ::java::nio::charset::CoderResult$Cache * malformedCache; + static ::java::nio::charset::CoderResult$Cache * unmappableCache; + jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) type; + jint length__; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CoderResult__ diff --git a/libjava/java/nio/charset/CodingErrorAction.h b/libjava/java/nio/charset/CodingErrorAction.h new file mode 100644 index 000000000..c0bf2aa66 --- /dev/null +++ b/libjava/java/nio/charset/CodingErrorAction.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_CodingErrorAction__ +#define __java_nio_charset_CodingErrorAction__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class CodingErrorAction; + } + } + } +} + +class java::nio::charset::CodingErrorAction : public ::java::lang::Object +{ + + CodingErrorAction(::java::lang::String *); +public: + virtual ::java::lang::String * toString(); + static ::java::nio::charset::CodingErrorAction * IGNORE; + static ::java::nio::charset::CodingErrorAction * REPLACE; + static ::java::nio::charset::CodingErrorAction * REPORT; +private: + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_CodingErrorAction__ diff --git a/libjava/java/nio/charset/IllegalCharsetNameException.h b/libjava/java/nio/charset/IllegalCharsetNameException.h new file mode 100644 index 000000000..c4b42474f --- /dev/null +++ b/libjava/java/nio/charset/IllegalCharsetNameException.h @@ -0,0 +1,37 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_IllegalCharsetNameException__ +#define __java_nio_charset_IllegalCharsetNameException__ + +#pragma interface + +#include <java/lang/IllegalArgumentException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class IllegalCharsetNameException; + } + } + } +} + +class java::nio::charset::IllegalCharsetNameException : public ::java::lang::IllegalArgumentException +{ + +public: + IllegalCharsetNameException(::java::lang::String *); + virtual ::java::lang::String * getCharsetName(); +private: + static const jlong serialVersionUID = 1457525358470002989LL; + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::IllegalArgumentException)))) charsetName; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_IllegalCharsetNameException__ diff --git a/libjava/java/nio/charset/MalformedInputException.h b/libjava/java/nio/charset/MalformedInputException.h new file mode 100644 index 000000000..03a6d8d98 --- /dev/null +++ b/libjava/java/nio/charset/MalformedInputException.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_MalformedInputException__ +#define __java_nio_charset_MalformedInputException__ + +#pragma interface + +#include <java/nio/charset/CharacterCodingException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class MalformedInputException; + } + } + } +} + +class java::nio::charset::MalformedInputException : public ::java::nio::charset::CharacterCodingException +{ + +public: + MalformedInputException(jint); + virtual jint getInputLength(); + virtual ::java::lang::String * getMessage(); +private: + static const jlong serialVersionUID = -3438823399834806194LL; + jint __attribute__((aligned(__alignof__( ::java::nio::charset::CharacterCodingException)))) inputLength; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_MalformedInputException__ diff --git a/libjava/java/nio/charset/UnmappableCharacterException.h b/libjava/java/nio/charset/UnmappableCharacterException.h new file mode 100644 index 000000000..f0ced263f --- /dev/null +++ b/libjava/java/nio/charset/UnmappableCharacterException.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_UnmappableCharacterException__ +#define __java_nio_charset_UnmappableCharacterException__ + +#pragma interface + +#include <java/nio/charset/CharacterCodingException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class UnmappableCharacterException; + } + } + } +} + +class java::nio::charset::UnmappableCharacterException : public ::java::nio::charset::CharacterCodingException +{ + +public: + UnmappableCharacterException(jint); + virtual jint getInputLength(); + virtual ::java::lang::String * getMessage(); +private: + static const jlong serialVersionUID = -7026962371537706123LL; + jint __attribute__((aligned(__alignof__( ::java::nio::charset::CharacterCodingException)))) inputLength; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_UnmappableCharacterException__ diff --git a/libjava/java/nio/charset/UnsupportedCharsetException.h b/libjava/java/nio/charset/UnsupportedCharsetException.h new file mode 100644 index 000000000..7f09678fe --- /dev/null +++ b/libjava/java/nio/charset/UnsupportedCharsetException.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_UnsupportedCharsetException__ +#define __java_nio_charset_UnsupportedCharsetException__ + +#pragma interface + +#include <java/lang/IllegalArgumentException.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class UnsupportedCharsetException; + } + } + } +} + +class java::nio::charset::UnsupportedCharsetException : public ::java::lang::IllegalArgumentException +{ + +public: + UnsupportedCharsetException(::java::lang::String *); + virtual ::java::lang::String * getCharsetName(); +private: + static const jlong serialVersionUID = 1490765524727386367LL; +public: // actually package-private + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::IllegalArgumentException)))) charsetName; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_UnsupportedCharsetException__ diff --git a/libjava/java/nio/charset/spi/CharsetProvider.h b/libjava/java/nio/charset/spi/CharsetProvider.h new file mode 100644 index 000000000..b194e106b --- /dev/null +++ b/libjava/java/nio/charset/spi/CharsetProvider.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_nio_charset_spi_CharsetProvider__ +#define __java_nio_charset_spi_CharsetProvider__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + namespace spi + { + class CharsetProvider; + } + } + } + } +} + +class java::nio::charset::spi::CharsetProvider : public ::java::lang::Object +{ + +public: // actually protected + CharsetProvider(); +public: + virtual ::java::util::Iterator * charsets() = 0; + virtual ::java::nio::charset::Charset * charsetForName(::java::lang::String *) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_nio_charset_spi_CharsetProvider__ diff --git a/libjava/java/nio/charset/spi/CharsetProvider.java b/libjava/java/nio/charset/spi/CharsetProvider.java new file mode 100644 index 000000000..d56723c3f --- /dev/null +++ b/libjava/java/nio/charset/spi/CharsetProvider.java @@ -0,0 +1,96 @@ +/* CharsetProvider.java -- charset service provider interface + Copyright (C) 2002, 2006, 2007 Free Software Foundation + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package java.nio.charset.spi; + +import java.nio.charset.Charset; +import java.util.Iterator; + + +/** + * This class allows an implementor to provide additional character sets. The + * subclass must have a nullary constructor, and be attached to charset + * implementation classes. These extensions are loaded via the context class + * loader. To provide the charset extension, all files named + * <code>META-INF/services/java.nio.charset.spi.CharsetProvider</code> are + * read from the classpath. Each one should be a UTF-8 encoded list of + * fully-qualified names of concrete subclasses of this class; whitespace is + * ignored, and '#' starts comments. Duplicates are ignored. The + * implementations must be accessible to the classloader that requests them. + * + * @author Eric Blake (ebb9@email.byu.edu) + * @see Charset + * @since 1.4 + * @status updated to 1.4 + */ +public abstract class CharsetProvider +{ + /** + * Initialize a new charset provider. This performs a security check on + * RuntimePermission("charsetProvider"). + * + * @throws SecurityException if building a new set is not allowed + */ + protected CharsetProvider() + { + // We only do the security check for custom providers, not for the + // built in ones. + SecurityManager s = System.getSecurityManager(); + if (s != null && + ! (this instanceof gnu.java.nio.charset.Provider)) + // GCJ LOCAL - We have the iconv provider in standard.omit + // || this instanceof gnu.java.nio.charset.iconv.IconvProvider)) + s.checkPermission(new RuntimePermission("charsetProvider")); + } + + /** + * Returns an iterator over the charsets defined by this provider. + * + * @return the iterator + * @see Charset#availableCharsets() + */ + public abstract Iterator<Charset> charsets(); + + /** + * Returns the named charset, by canonical name or alias. + * + * @param name the name of the character + * + * @return the charset, or null if not supported + */ + public abstract Charset charsetForName(String name); +} // class CharsetProvider diff --git a/libjava/java/nio/natVMDirectByteBufferImpl.cc b/libjava/java/nio/natVMDirectByteBufferImpl.cc new file mode 100644 index 000000000..3119fdea3 --- /dev/null +++ b/libjava/java/nio/natVMDirectByteBufferImpl.cc @@ -0,0 +1,72 @@ +// natDirectByteBufferImpl.cc + +/* Copyright (C) 2003, 2004 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 <gcj/cni.h> +#include <jvm.h> + +#include <stdlib.h> + +#include <gnu/gcj/RawData.h> +#include <java/nio/VMDirectByteBuffer.h> + +using gnu::gcj::RawData; + +RawData* +java::nio::VMDirectByteBuffer::allocate (jint capacity) +{ + return reinterpret_cast<gnu::gcj::RawData*> (::malloc (capacity)); +} + +void +java::nio::VMDirectByteBuffer::free (gnu::gcj::RawData* address) +{ + ::free (reinterpret_cast<void*> (address)); +} + +jbyte +java::nio::VMDirectByteBuffer::get (RawData* address, jint index) +{ + jbyte* pointer = reinterpret_cast<jbyte*> (address) + index; + return *pointer; +} + +void +java::nio::VMDirectByteBuffer::get (RawData* address, jint index, + jbyteArray dst, jint offset, jint length) +{ + jbyte* src = reinterpret_cast<jbyte*> (address) + index; + memcpy (elements (dst) + offset, src, length); +} + +void +java::nio::VMDirectByteBuffer::put (gnu::gcj::RawData* address, + jint index, jbyte value) +{ + jbyte* pointer = reinterpret_cast<jbyte*> (address) + index; + *pointer = value; +} + +RawData* +java::nio::VMDirectByteBuffer::adjustAddress (RawData* address, jint offset) +{ + jbyte* start = reinterpret_cast<jbyte*> (address) + offset; + return reinterpret_cast<RawData*>(start); +} + +void +java::nio::VMDirectByteBuffer::shiftDown (RawData* address, jint dst_offset, + jint src_offset, jint count) +{ + jbyte* dst = reinterpret_cast<jbyte*> (address) + dst_offset; + jbyte* src = reinterpret_cast<jbyte*> (address) + src_offset; + ::memmove(dst, src, count); +} |