diff options
Diffstat (limited to 'libjava/java/io')
99 files changed, 5437 insertions, 1994 deletions
diff --git a/libjava/java/io/BufferedInputStream.h b/libjava/java/io/BufferedInputStream.h new file mode 100644 index 0000000..d2851da --- /dev/null +++ b/libjava/java/io/BufferedInputStream.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_BufferedInputStream__ +#define __java_io_BufferedInputStream__ + +#pragma interface + +#include <java/io/FilterInputStream.h> +#include <gcj/array.h> + + +class java::io::BufferedInputStream : public ::java::io::FilterInputStream +{ + +public: + BufferedInputStream(::java::io::InputStream *); + BufferedInputStream(::java::io::InputStream *, jint); + virtual jint available(); + virtual void close(); + virtual void mark(jint); + virtual jboolean markSupported(); + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void reset(); + virtual jlong skip(jlong); +public: // actually package-private + virtual jboolean refill(); +private: + static const jint DEFAULT_BUFFER_SIZE = 2048; +public: // actually protected + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::FilterInputStream)))) buf; + jint count; + jint pos; + jint markpos; + jint marklimit; +private: + jint bufferSize; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_BufferedInputStream__ diff --git a/libjava/java/io/BufferedOutputStream.h b/libjava/java/io/BufferedOutputStream.h new file mode 100644 index 0000000..ce34567 --- /dev/null +++ b/libjava/java/io/BufferedOutputStream.h @@ -0,0 +1,31 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_BufferedOutputStream__ +#define __java_io_BufferedOutputStream__ + +#pragma interface + +#include <java/io/FilterOutputStream.h> +#include <gcj/array.h> + + +class java::io::BufferedOutputStream : public ::java::io::FilterOutputStream +{ + +public: + BufferedOutputStream(::java::io::OutputStream *); + BufferedOutputStream(::java::io::OutputStream *, jint); + virtual void flush(); + virtual void write(jint); + virtual void write(JArray< jbyte > *, jint, jint); +private: + static const jint DEFAULT_BUFFER_SIZE = 512; +public: // actually protected + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::FilterOutputStream)))) buf; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_BufferedOutputStream__ diff --git a/libjava/java/io/BufferedReader.h b/libjava/java/io/BufferedReader.h new file mode 100644 index 0000000..66d7766 --- /dev/null +++ b/libjava/java/io/BufferedReader.h @@ -0,0 +1,49 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_BufferedReader__ +#define __java_io_BufferedReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + + +class java::io::BufferedReader : public ::java::io::Reader +{ + +public: + BufferedReader(::java::io::Reader *); + BufferedReader(::java::io::Reader *, jint); + virtual void close(); + virtual jboolean markSupported(); + virtual void mark(jint); + virtual void reset(); + virtual jboolean ready(); + virtual jint read(JArray< jchar > *, jint, jint); +private: + jint fill(); +public: + virtual jint read(); +private: + jint lineEnd(jint); +public: + virtual ::java::lang::String * readLine(); + virtual jlong skip(jlong); +private: + void checkStatus(); +public: // actually package-private + ::java::io::Reader * __attribute__((aligned(__alignof__( ::java::io::Reader)))) in; + JArray< jchar > * buffer; + jint pos; + jint limit; + jint markPos; + static const jint DEFAULT_BUFFER_SIZE = 8192; +private: + ::java::lang::StringBuffer * sbuf; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_BufferedReader__ diff --git a/libjava/java/io/BufferedWriter.h b/libjava/java/io/BufferedWriter.h new file mode 100644 index 0000000..68cfa09 --- /dev/null +++ b/libjava/java/io/BufferedWriter.h @@ -0,0 +1,36 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_BufferedWriter__ +#define __java_io_BufferedWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + + +class java::io::BufferedWriter : public ::java::io::Writer +{ + +public: + BufferedWriter(::java::io::Writer *); + BufferedWriter(::java::io::Writer *, jint); + virtual void close(); + virtual void flush(); + virtual void newLine(); + virtual void write(jint); + virtual void write(JArray< jchar > *, jint, jint); + virtual void write(::java::lang::String *, jint, jint); +private: + void localFlush(); + static const jint DEFAULT_BUFFER_SIZE = 8192; + ::java::io::Writer * __attribute__((aligned(__alignof__( ::java::io::Writer)))) out; +public: // actually package-private + JArray< jchar > * buffer; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_BufferedWriter__ diff --git a/libjava/java/io/ByteArrayInputStream.h b/libjava/java/io/ByteArrayInputStream.h new file mode 100644 index 0000000..85411b3 --- /dev/null +++ b/libjava/java/io/ByteArrayInputStream.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ByteArrayInputStream__ +#define __java_io_ByteArrayInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + + +class java::io::ByteArrayInputStream : public ::java::io::InputStream +{ + +public: + ByteArrayInputStream(JArray< jbyte > *); + ByteArrayInputStream(JArray< jbyte > *, jint, jint); + virtual jint available(); + virtual void mark(jint); + virtual jboolean markSupported(); + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void reset(); + virtual jlong skip(jlong); +public: // actually protected + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) buf; + jint pos; + jint mark__; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ByteArrayInputStream__ diff --git a/libjava/java/io/ByteArrayOutputStream.h b/libjava/java/io/ByteArrayOutputStream.h new file mode 100644 index 0000000..907c3d4 --- /dev/null +++ b/libjava/java/io/ByteArrayOutputStream.h @@ -0,0 +1,41 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ByteArrayOutputStream__ +#define __java_io_ByteArrayOutputStream__ + +#pragma interface + +#include <java/io/OutputStream.h> +#include <gcj/array.h> + + +class java::io::ByteArrayOutputStream : public ::java::io::OutputStream +{ + +public: + ByteArrayOutputStream(); + ByteArrayOutputStream(jint); + virtual void reset(); + virtual jint size(); + virtual JArray< jbyte > * toByteArray(); + virtual ::java::lang::String * toString(); + virtual ::java::lang::String * toString(::java::lang::String *); + virtual ::java::lang::String * toString(jint); +private: + void resize(jint); +public: + virtual void write(jint); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void writeTo(::java::io::OutputStream *); +public: // actually protected + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::OutputStream)))) buf; + jint count; +private: + static const jint DEFAULT_INITIAL_BUFFER_SIZE = 32; + static jint initial_buffer_size; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ByteArrayOutputStream__ diff --git a/libjava/java/io/CharArrayReader.h b/libjava/java/io/CharArrayReader.h new file mode 100644 index 0000000..f8b8f5d --- /dev/null +++ b/libjava/java/io/CharArrayReader.h @@ -0,0 +1,36 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_CharArrayReader__ +#define __java_io_CharArrayReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + + +class java::io::CharArrayReader : public ::java::io::Reader +{ + +public: + CharArrayReader(JArray< jchar > *); + CharArrayReader(JArray< jchar > *, jint, jint); + virtual void close(); + virtual void mark(jint); + virtual jboolean markSupported(); + virtual jint read(); + virtual jint read(JArray< jchar > *, jint, jint); + virtual jboolean ready(); + virtual void reset(); + virtual jlong skip(jlong); +public: // actually protected + JArray< jchar > * __attribute__((aligned(__alignof__( ::java::io::Reader)))) buf; + jint pos; + jint markedPos; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_CharArrayReader__ diff --git a/libjava/java/io/CharArrayWriter.h b/libjava/java/io/CharArrayWriter.h new file mode 100644 index 0000000..35f49d2 --- /dev/null +++ b/libjava/java/io/CharArrayWriter.h @@ -0,0 +1,50 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_CharArrayWriter__ +#define __java_io_CharArrayWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + + +class java::io::CharArrayWriter : public ::java::io::Writer +{ + +public: + CharArrayWriter(); + CharArrayWriter(jint); + virtual void close(); + virtual void flush(); + virtual void reset(); + virtual jint size(); + virtual JArray< jchar > * toCharArray(); + virtual ::java::lang::String * toString(); + virtual void write(jint); + virtual void write(JArray< jchar > *, jint, jint); + virtual void write(::java::lang::String *, jint, jint); + virtual void writeTo(::java::io::Writer *); + virtual ::java::io::CharArrayWriter * target$append(jchar); + virtual ::java::io::CharArrayWriter * target$append(::java::lang::CharSequence *); + virtual ::java::io::CharArrayWriter * target$append(::java::lang::CharSequence *, jint, jint); +private: + void resize(jint); +public: + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *); + virtual ::java::lang::Appendable * append(jchar); + virtual ::java::io::Writer * target$append(jchar); +private: + static const jint DEFAULT_INITIAL_BUFFER_SIZE = 32; +public: // actually protected + JArray< jchar > * __attribute__((aligned(__alignof__( ::java::io::Writer)))) buf; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_CharArrayWriter__ diff --git a/libjava/java/io/CharConversionException.h b/libjava/java/io/CharConversionException.h new file mode 100644 index 0000000..95034a8 --- /dev/null +++ b/libjava/java/io/CharConversionException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_CharConversionException__ +#define __java_io_CharConversionException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::CharConversionException : public ::java::io::IOException +{ + +public: + CharConversionException(); + CharConversionException(::java::lang::String *); +private: + static const jlong serialVersionUID = -8680016352018427031LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_CharConversionException__ diff --git a/libjava/java/io/Closeable.h b/libjava/java/io/Closeable.h new file mode 100644 index 0000000..4668f50 --- /dev/null +++ b/libjava/java/io/Closeable.h @@ -0,0 +1,19 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_Closeable__ +#define __java_io_Closeable__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::Closeable : public ::java::lang::Object +{ + +public: + virtual void close() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_Closeable__ diff --git a/libjava/java/io/DataInput.h b/libjava/java/io/DataInput.h new file mode 100644 index 0000000..9cb4952 --- /dev/null +++ b/libjava/java/io/DataInput.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_DataInput__ +#define __java_io_DataInput__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::DataInput : public ::java::lang::Object +{ + +public: + virtual jboolean readBoolean() = 0; + virtual jbyte readByte() = 0; + virtual jint readUnsignedByte() = 0; + virtual jchar readChar() = 0; + virtual jshort readShort() = 0; + virtual jint readUnsignedShort() = 0; + virtual jint readInt() = 0; + virtual jlong readLong() = 0; + virtual jfloat readFloat() = 0; + virtual jdouble readDouble() = 0; + virtual ::java::lang::String * readLine() = 0; + virtual ::java::lang::String * readUTF() = 0; + virtual void readFully(JArray< jbyte > *) = 0; + virtual void readFully(JArray< jbyte > *, jint, jint) = 0; + virtual jint skipBytes(jint) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_DataInput__ diff --git a/libjava/java/io/DataInputStream.h b/libjava/java/io/DataInputStream.h new file mode 100644 index 0000000..a7b8459 --- /dev/null +++ b/libjava/java/io/DataInputStream.h @@ -0,0 +1,51 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_DataInputStream__ +#define __java_io_DataInputStream__ + +#pragma interface + +#include <java/io/FilterInputStream.h> +#include <gcj/array.h> + + +class java::io::DataInputStream : public ::java::io::FilterInputStream +{ + +public: + DataInputStream(::java::io::InputStream *); + virtual jint read(JArray< jbyte > *); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual jboolean readBoolean(); + virtual jbyte readByte(); + virtual jchar readChar(); + virtual jdouble readDouble(); + virtual jfloat readFloat(); + virtual void readFully(JArray< jbyte > *); + virtual void readFully(JArray< jbyte > *, jint, jint); + virtual jint readInt(); + virtual ::java::lang::String * readLine(); + virtual jlong readLong(); + virtual jshort readShort(); + virtual jint readUnsignedByte(); + virtual jint readUnsignedShort(); + virtual ::java::lang::String * readUTF(); + static ::java::lang::String * readUTF(::java::io::DataInput *); + virtual jint skipBytes(jint); +public: // actually package-private + static jboolean convertToBoolean(jint); + static jbyte convertToByte(jint); + static jint convertToUnsignedByte(jint); + static jchar convertToChar(JArray< jbyte > *); + static jshort convertToShort(JArray< jbyte > *); + static jint convertToUnsignedShort(JArray< jbyte > *); + static jint convertToInt(JArray< jbyte > *); + static jlong convertToLong(JArray< jbyte > *); + static ::java::lang::String * convertFromUTF(JArray< jbyte > *); + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::FilterInputStream)))) buf; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_DataInputStream__ diff --git a/libjava/java/io/DataOutput.h b/libjava/java/io/DataOutput.h new file mode 100644 index 0000000..f18f5e4 --- /dev/null +++ b/libjava/java/io/DataOutput.h @@ -0,0 +1,34 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_DataOutput__ +#define __java_io_DataOutput__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::DataOutput : public ::java::lang::Object +{ + +public: + virtual void writeBoolean(jboolean) = 0; + virtual void writeByte(jint) = 0; + virtual void writeChar(jint) = 0; + virtual void writeShort(jint) = 0; + virtual void writeInt(jint) = 0; + virtual void writeLong(jlong) = 0; + virtual void writeFloat(jfloat) = 0; + virtual void writeDouble(jdouble) = 0; + virtual void writeBytes(::java::lang::String *) = 0; + virtual void writeChars(::java::lang::String *) = 0; + virtual void writeUTF(::java::lang::String *) = 0; + virtual void write(jint) = 0; + virtual void write(JArray< jbyte > *) = 0; + virtual void write(JArray< jbyte > *, jint, jint) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_DataOutput__ diff --git a/libjava/java/io/DataOutputStream.h b/libjava/java/io/DataOutputStream.h new file mode 100644 index 0000000..0d89dca --- /dev/null +++ b/libjava/java/io/DataOutputStream.h @@ -0,0 +1,44 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_DataOutputStream__ +#define __java_io_DataOutputStream__ + +#pragma interface + +#include <java/io/FilterOutputStream.h> +#include <gcj/array.h> + + +class java::io::DataOutputStream : public ::java::io::FilterOutputStream +{ + +public: + DataOutputStream(::java::io::OutputStream *); + virtual void flush(); + virtual jint size(); + virtual void write(jint); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void writeBoolean(jboolean); + virtual void writeByte(jint); + virtual void writeShort(jint); + virtual void writeChar(jint); + virtual void writeInt(jint); + virtual void writeLong(jlong); + virtual void writeFloat(jfloat); + virtual void writeDouble(jdouble); + virtual void writeBytes(::java::lang::String *); + virtual void writeChars(::java::lang::String *); +private: + jint getUTFlength(::java::lang::String *, jint, jint); +public: + virtual void writeUTF(::java::lang::String *); +public: // actually protected + jint __attribute__((aligned(__alignof__( ::java::io::FilterOutputStream)))) written; +private: + JArray< jbyte > * buf; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_DataOutputStream__ diff --git a/libjava/java/io/DeleteFileHelper$1.h b/libjava/java/io/DeleteFileHelper$1.h new file mode 100644 index 0000000..48f5671 --- /dev/null +++ b/libjava/java/io/DeleteFileHelper$1.h @@ -0,0 +1,21 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_DeleteFileHelper$1__ +#define __java_io_DeleteFileHelper$1__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::DeleteFileHelper$1 : public ::java::lang::Object +{ + +public: // actually package-private + DeleteFileHelper$1(); +public: + ::java::lang::Object * run(); + static ::java::lang::Class class$; +}; + +#endif // __java_io_DeleteFileHelper$1__ diff --git a/libjava/java/io/DeleteFileHelper.h b/libjava/java/io/DeleteFileHelper.h new file mode 100644 index 0000000..9b61c3a --- /dev/null +++ b/libjava/java/io/DeleteFileHelper.h @@ -0,0 +1,28 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_DeleteFileHelper__ +#define __java_io_DeleteFileHelper__ + +#pragma interface + +#include <java/lang/Thread.h> + +class java::io::DeleteFileHelper : public ::java::lang::Thread +{ + +public: // actually package-private + static void add(::java::io::File *); +private: + static void deleteFiles(); +public: // actually package-private + DeleteFileHelper(); +public: + void run(); +private: + static ::java::util::ArrayList * filesToDelete; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_DeleteFileHelper__ diff --git a/libjava/java/io/EOFException.h b/libjava/java/io/EOFException.h new file mode 100644 index 0000000..be4b255 --- /dev/null +++ b/libjava/java/io/EOFException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_EOFException__ +#define __java_io_EOFException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::EOFException : public ::java::io::IOException +{ + +public: + EOFException(); + EOFException(::java::lang::String *); +private: + static const jlong serialVersionUID = 6433858223774886977LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_EOFException__ diff --git a/libjava/java/io/Externalizable.h b/libjava/java/io/Externalizable.h new file mode 100644 index 0000000..b74cf08 --- /dev/null +++ b/libjava/java/io/Externalizable.h @@ -0,0 +1,20 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_Externalizable__ +#define __java_io_Externalizable__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::Externalizable : public ::java::lang::Object +{ + +public: + virtual void readExternal(::java::io::ObjectInput *) = 0; + virtual void writeExternal(::java::io::ObjectOutput *) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_Externalizable__ diff --git a/libjava/java/io/File.h b/libjava/java/io/File.h new file mode 100644 index 0000000..35ca3b7 --- /dev/null +++ b/libjava/java/io/File.h @@ -0,0 +1,150 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_File__ +#define __java_io_File__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace net + { + class URI; + class URL; + } + } +} + +class java::io::File : public ::java::lang::Object +{ + + jlong attr(jint); + jboolean _access(jint); + jboolean _stat(jint); + static void init_native(); +public: + virtual jboolean canRead(); + virtual jboolean canWrite(); +private: + jboolean performCreate(); +public: + virtual jboolean createNewFile(); +private: + jboolean performDelete(); +public: + virtual jboolean delete$(); + virtual jboolean equals(::java::lang::Object *); +private: + jboolean internalExists(); +public: + virtual jboolean exists(); + File(::java::lang::String *); +private: + ::java::lang::String * normalizePath(::java::lang::String *); +public: + File(::java::lang::String *, ::java::lang::String *); + File(::java::io::File *, ::java::lang::String *); + File(::java::net::URI *); + virtual ::java::lang::String * getAbsolutePath(); + virtual ::java::io::File * getAbsoluteFile(); + virtual ::java::lang::String * getCanonicalPath(); + virtual ::java::io::File * getCanonicalFile(); + virtual ::java::lang::String * getName(); + virtual ::java::lang::String * getParent(); + virtual ::java::io::File * getParentFile(); + virtual ::java::lang::String * getPath(); + virtual jint hashCode(); + virtual jboolean isAbsolute(); +private: + jboolean internalIsDirectory(); +public: + virtual jboolean isDirectory(); + virtual jboolean isFile(); + virtual jboolean isHidden(); + virtual jlong lastModified(); + virtual jlong length(); +private: + JArray< ::java::lang::Object * > * performList(::java::io::FilenameFilter *, ::java::io::FileFilter *, ::java::lang::Class *); +public: + virtual JArray< ::java::lang::String * > * list(::java::io::FilenameFilter *); + virtual JArray< ::java::lang::String * > * list(); + virtual JArray< ::java::io::File * > * listFiles(); + virtual JArray< ::java::io::File * > * listFiles(::java::io::FilenameFilter *); + virtual JArray< ::java::io::File * > * listFiles(::java::io::FileFilter *); + virtual ::java::lang::String * toString(); + virtual ::java::net::URI * toURI(); + virtual ::java::net::URL * toURL(); +private: + jboolean performMkdir(); +public: + virtual jboolean mkdir(); +private: + static jboolean mkdirs(::java::io::File *); +public: + virtual jboolean mkdirs(); +private: + static ::java::lang::String * nextValue(); +public: + static ::java::io::File * createTempFile(::java::lang::String *, ::java::lang::String *, ::java::io::File *); +private: + jboolean performSetReadOnly(); +public: + virtual jboolean setReadOnly(); +private: + static JArray< ::java::io::File * > * performListRoots(); +public: + static JArray< ::java::io::File * > * listRoots(); + static ::java::io::File * createTempFile(::java::lang::String *, ::java::lang::String *); + virtual jint compareTo(::java::io::File *); + virtual jint compareTo(::java::lang::Object *); +private: + jboolean performRenameTo(::java::io::File *); +public: + virtual jboolean renameTo(::java::io::File *); +private: + jboolean performSetLastModified(jlong); +public: + virtual jboolean setLastModified(jlong); +private: + void checkWrite(); + void checkRead(); +public: + virtual void deleteOnExit(); +private: + void writeObject(::java::io::ObjectOutputStream *); + void readObject(::java::io::ObjectInputStream *); + static const jlong serialVersionUID = 301077366599181567LL; + static const jint READ = 0; + static const jint WRITE = 1; + static const jint EXISTS = 2; + static const jint DIRECTORY = 0; + static const jint ISFILE = 1; + static const jint ISHIDDEN = 2; + static const jint MODIFIED = 0; + static const jint LENGTH = 1; +public: + static ::java::lang::String * separator; +private: + static ::java::lang::String * dupSeparator; +public: + static jchar separatorChar; + static ::java::lang::String * pathSeparator; + static jchar pathSeparatorChar; +public: // actually package-private + static ::java::lang::String * tmpdir; + static jint maxPathLen; + static jboolean caseSensitive; +private: + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) path; + static jlong counter; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_File__ diff --git a/libjava/java/io/FileDescriptor.h b/libjava/java/io/FileDescriptor.h new file mode 100644 index 0000000..a3863f3 --- /dev/null +++ b/libjava/java/io/FileDescriptor.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileDescriptor__ +#define __java_io_FileDescriptor__ + +#pragma interface + +#include <java/lang/Object.h> +extern "Java" +{ + namespace java + { + namespace nio + { + namespace channels + { + class ByteChannel; + } + } + } +} + +class java::io::FileDescriptor : public ::java::lang::Object +{ + +public: + FileDescriptor(); +public: // actually package-private + FileDescriptor(::java::nio::channels::ByteChannel *); +public: + void sync(); + jboolean valid(); + static ::java::io::FileDescriptor * in; + static ::java::io::FileDescriptor * out; + static ::java::io::FileDescriptor * err; +public: // actually package-private + ::java::nio::channels::ByteChannel * __attribute__((aligned(__alignof__( ::java::lang::Object)))) channel; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FileDescriptor__ diff --git a/libjava/java/io/FileDescriptor.java b/libjava/java/io/FileDescriptor.java new file mode 100644 index 0000000..d300c9c --- /dev/null +++ b/libjava/java/io/FileDescriptor.java @@ -0,0 +1,139 @@ +/* FileDescriptor.java -- Opaque file handle class + Copyright (C) 1998, 1999, 2000, 2001, 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.io; + +import gnu.java.nio.channels.FileChannelImpl; + +import java.nio.channels.ByteChannel; +import java.nio.channels.FileChannel; + +/** + * This class represents an opaque file handle as a Java class. It should + * be used only to pass to other methods that expect an object of this + * type. No system specific information can be obtained from this object. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Tom Tromey (tromey@cygnus.com) + * @date September 24, 1998 + */ +public final class FileDescriptor +{ + /** + * A <code>FileDescriptor</code> representing the system standard input + * stream. This will usually be accessed through the + * <code>System.in</code>variable. + */ + public static final FileDescriptor in + = new FileDescriptor (FileChannelImpl.in); + + /** + * A <code>FileDescriptor</code> representing the system standard output + * stream. This will usually be accessed through the + * <code>System.out</code>variable. + */ + public static final FileDescriptor out + = new FileDescriptor (FileChannelImpl.out); + + /** + * A <code>FileDescriptor</code> representing the system standard error + * stream. This will usually be accessed through the + * <code>System.err</code>variable. + */ + public static final FileDescriptor err + = new FileDescriptor (FileChannelImpl.err); + + final ByteChannel channel; + + /** + * This method is used to initialize an invalid FileDescriptor object. + */ + public FileDescriptor() + { + channel = null; + } + + /** + * This method is used to initialize a FileDescriptor object. + */ + FileDescriptor(ByteChannel channel) + { + this.channel = channel; + } + + + /** + * This method forces all data that has not yet been physically written to + * the underlying storage medium associated with this + * <code>FileDescriptor</code> + * to be written out. This method will not return until all data has + * been fully written to the underlying device. If the device does not + * support this functionality or if an error occurs, then an exception + * will be thrown. + */ + public void sync () throws SyncFailedException + { + if (channel instanceof FileChannel) + { + try + { + ((FileChannel) channel).force(true); + } + catch (IOException ex) + { + if (ex instanceof SyncFailedException) + throw (SyncFailedException) ex; + else + throw new SyncFailedException(ex.toString()); + } + } + } + + /** + * This methods tests whether or not this object represents a valid open + * native file handle. + * + * @return <code>true</code> if this object represents a valid + * native file handle, <code>false</code> otherwise + */ + public boolean valid () + { + return channel != null && channel.isOpen(); + } +} diff --git a/libjava/java/io/FileFilter.h b/libjava/java/io/FileFilter.h new file mode 100644 index 0000000..e90e437 --- /dev/null +++ b/libjava/java/io/FileFilter.h @@ -0,0 +1,19 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileFilter__ +#define __java_io_FileFilter__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::FileFilter : public ::java::lang::Object +{ + +public: + virtual jboolean accept(::java::io::File *) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_FileFilter__ diff --git a/libjava/java/io/FileInputStream.h b/libjava/java/io/FileInputStream.h new file mode 100644 index 0000000..01efe56 --- /dev/null +++ b/libjava/java/io/FileInputStream.h @@ -0,0 +1,67 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileInputStream__ +#define __java_io_FileInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace channels + { + class FileChannelImpl; + } + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class FileChannel; + } + } + } +} + +class java::io::FileInputStream : public ::java::io::InputStream +{ + +public: + FileInputStream(::java::lang::String *); + FileInputStream(::java::io::File *); + FileInputStream(::java::io::FileDescriptor *); +public: // actually package-private + FileInputStream(::gnu::java::nio::channels::FileChannelImpl *); +public: + virtual jint available(); + virtual void close(); +public: // actually protected + virtual void finalize(); +public: + virtual ::java::io::FileDescriptor * getFD(); + virtual jint read(); + virtual jint read(JArray< jbyte > *); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual jlong skip(jlong); + virtual ::java::nio::channels::FileChannel * getChannel(); +private: + ::java::io::FileDescriptor * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) fd; + ::gnu::java::nio::channels::FileChannelImpl * ch; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FileInputStream__ diff --git a/libjava/java/io/FileInputStream.java b/libjava/java/io/FileInputStream.java new file mode 100644 index 0000000..8ca38b0 --- /dev/null +++ b/libjava/java/io/FileInputStream.java @@ -0,0 +1,309 @@ +/* FileInputStream.java -- An input stream that reads from disk files. + Copyright (C) 1998, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.io; + +import gnu.java.nio.channels.FileChannelImpl; + +import java.nio.channels.FileChannel; + +/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 + * "The Java Language Specification", ISBN 0-201-63451-1 + * plus online API docs for JDK 1.2 beta from http://www.javasoft.com. + * Status: Believed complete and correct. + */ + +/** + * This class is a stream that reads its bytes from a file. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Warren Levy (warrenl@cygnus.com) + */ +public class FileInputStream extends InputStream +{ + /** + * This is the native file handle for the file this stream is reading from + */ + private FileDescriptor fd; + + private FileChannelImpl ch; + + /** + * This method initializes a <code>FileInputStream</code> to read from the + * specified named file. A security check is first made to determine + * whether or not access to this file is allowed. This is done by + * calling the <code>checkRead()</code> method of the + * <code>SecurityManager</code> + * (if one exists) with the name of this file. An exception is thrown + * if reading is not allowed. If the file does not exist, an exception + * is also thrown. + * + * @param name The name of the file this stream should read from + * + * @exception SecurityException If read access to the file is not allowed + * @exception FileNotFoundException If the file does not exist + * or if it is a directory + */ + public FileInputStream(String name) throws FileNotFoundException + { + this(new File(name)); + } + + /** + * This method initializes a <code>FileInputStream</code> to read from the + * specified <code>File</code> object. A security check is first + * made to determine + * whether or not access to this file is allowed. This is done by + * calling the <code>checkRead()</code> method of the + * <code>SecurityManager</code> + * (if one exists) with the name of this file. An exception is thrown + * if reading is not allowed. If the file does not exist, an exception + * is also thrown. + * + * @param file The <code>File</code> object this stream should read from + * + * @exception SecurityException If read access to the file is not allowed + * @exception FileNotFoundException If the file does not exist + * or if it is a directory. + */ + public FileInputStream(File file) throws FileNotFoundException + { + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkRead(file.getPath()); + + ch = FileChannelImpl.create(file, FileChannelImpl.READ); + } + + /** + * This method initializes a <code>FileInputStream</code> to read from the + * specified <code>FileDescriptor</code> object. A security + * check is first made to + * determine whether or not access to this file is allowed. This is done by + * calling the <code>checkRead()</code> method of the + * <code>SecurityManager</code> + * (if one exists) with the specified <code>FileDescriptor</code> + * An exception is + * thrown if reading is not allowed. + * + * @param fdObj The <code>FileDescriptor</code> object this stream + * should read from + * + * @exception SecurityException If read access to the file is not allowed + */ + public FileInputStream(FileDescriptor fdObj) + { + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkRead(fdObj); + + fd = fdObj; + ch = (FileChannelImpl) fdObj.channel; + } + + FileInputStream(FileChannelImpl ch) + { + this.ch = ch; + } + + /** + * This method returns the number of bytes that can be read from this + * stream before a read can block. A return of 0 indicates that blocking + * might (or might not) occur on the very next read attempt. + * <p> + * This method returns the number of unread bytes remaining in the file if + * the descriptor being read from is an actual file. If this method is + * reading from a ''special'' file such a the standard input, this method + * will return the appropriate value for the stream being read. + * <p> + * Be aware that reads on plain files that do not reside locally might + * possibly block even if this method says they should not. For example, + * a remote server might crash, preventing an NFS mounted file from being + * read. + * + * @return The number of bytes that can be read before blocking could occur + * + * @exception IOException If an error occurs + */ + public int available() throws IOException + { + return ch.available(); + } + + /** + * This method closes the stream. Any futher attempts to read from the + * stream will likely generate an IOException since the underlying file + * will be closed. + * + * @exception IOException If an error occurs. + */ + public void close() throws IOException + { + ch.close(); + } + + protected void finalize() throws IOException + { + // We don't actually need this, but we include it because it is + // mentioned in the JCL. + } + + /** + * This method returns a <code>FileDescriptor</code> object representing the + * underlying native file handle of the file this stream is reading + * from + * + * @return A <code>FileDescriptor</code> for this stream + * + * @exception IOException If an error occurs + */ + public final FileDescriptor getFD() throws IOException + { + synchronized (this) + { + if (fd == null) + fd = new FileDescriptor (ch); + return fd; + } + } + + /** + * This method reads an unsigned byte from the input stream and returns it + * as an int in the range of 0-255. This method also will return -1 if + * the end of the stream has been reached. + * <p> + * This method will block until the byte can be read. + * + * @return The byte read or -1 if end of stream + * + * @exception IOException If an error occurs + */ + public int read() throws IOException + { + return ch.read(); + } + + /** + * This method reads bytes from a stream and stores them into a caller + * supplied buffer. This method attempts to completely fill the buffer, + * but can return before doing so. The actual number of bytes read is + * returned as an int. A -1 is returned to indicate the end of the stream. + * <p> + * This method will block until some data can be read. + * <p> + * This method operates by calling an overloaded read method like so: + * <code>read(buf, 0, buf.length)</code> + * + * @param buf The buffer into which the bytes read will be stored. + * + * @return The number of bytes read or -1 if end of stream. + * + * @exception IOException If an error occurs. + */ + public int read(byte[] buf) throws IOException + { + return read(buf, 0, buf.length); + } + + /** + * This method read bytes from a stream and stores them into a caller + * supplied buffer. It starts storing the data at index + * <code>offset</code> into + * the buffer and attempts to read <code>len</code> bytes. This method can + * return before reading the number of bytes requested. The actual number + * of bytes read is returned as an int. A -1 is returned to indicate the + * end of the stream. + * <p> + * This method will block until some data can be read. + * + * @param buf The array into which the bytes read should be stored + * @param offset The offset into the array to start storing bytes + * @param len The requested number of bytes to read + * + * @return The actual number of bytes read, or -1 if end of stream. + * + * @exception IOException If an error occurs. + */ + public int read(byte[] buf, int offset, int len) throws IOException + { + if (offset < 0 + || len < 0 + || offset + len > buf.length) + throw new ArrayIndexOutOfBoundsException(); + + return ch.read(buf, offset, len); + } + + /** + * This method skips the specified number of bytes in the stream. It + * returns the actual number of bytes skipped, which may be less than the + * requested amount. + * <p> + * @param numBytes The requested number of bytes to skip + * + * @return The actual number of bytes skipped. + * + * @exception IOException If an error occurs + */ + public synchronized long skip (long numBytes) throws IOException + { + if (numBytes < 0) + throw new IllegalArgumentException ("Can't skip negative bytes: " + + numBytes); + + if (numBytes == 0) + return 0; + + long oldPos = ch.position (); + ch.position(oldPos + numBytes); + return ch.position() - oldPos; + } + + /** + * This method creates a java.nio.channels.FileChannel. + * Nio does not allow one to create a file channel directly. + * A file channel must be created by first creating an instance of + * Input/Output/RandomAccessFile and invoking the getChannel() method on it. + */ + public synchronized FileChannel getChannel () + { + return ch; + } + +} // class FileInputStream + diff --git a/libjava/java/io/FileNotFoundException.h b/libjava/java/io/FileNotFoundException.h new file mode 100644 index 0000000..794160d --- /dev/null +++ b/libjava/java/io/FileNotFoundException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileNotFoundException__ +#define __java_io_FileNotFoundException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::FileNotFoundException : public ::java::io::IOException +{ + +public: + FileNotFoundException(); + FileNotFoundException(::java::lang::String *); +private: + static const jlong serialVersionUID = -897856973823710492LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FileNotFoundException__ diff --git a/libjava/java/io/FileOutputStream.h b/libjava/java/io/FileOutputStream.h new file mode 100644 index 0000000..b2bf0d9 --- /dev/null +++ b/libjava/java/io/FileOutputStream.h @@ -0,0 +1,66 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileOutputStream__ +#define __java_io_FileOutputStream__ + +#pragma interface + +#include <java/io/OutputStream.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace channels + { + class FileChannelImpl; + } + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class FileChannel; + } + } + } +} + +class java::io::FileOutputStream : public ::java::io::OutputStream +{ + +public: + FileOutputStream(::java::lang::String *, jboolean); + FileOutputStream(::java::lang::String *); + FileOutputStream(::java::io::File *); + FileOutputStream(::java::io::File *, jboolean); + FileOutputStream(::java::io::FileDescriptor *); +public: // actually package-private + FileOutputStream(::gnu::java::nio::channels::FileChannelImpl *); +public: // actually protected + virtual void finalize(); +public: + virtual ::java::io::FileDescriptor * getFD(); + virtual void write(jint); + virtual void write(JArray< jbyte > *); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void close(); + virtual ::java::nio::channels::FileChannel * getChannel(); +private: + ::java::io::FileDescriptor * __attribute__((aligned(__alignof__( ::java::io::OutputStream)))) fd; + ::gnu::java::nio::channels::FileChannelImpl * ch; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FileOutputStream__ diff --git a/libjava/java/io/FileOutputStream.java b/libjava/java/io/FileOutputStream.java new file mode 100644 index 0000000..10ea6b5 --- /dev/null +++ b/libjava/java/io/FileOutputStream.java @@ -0,0 +1,296 @@ +/* FileOutputStream.java -- Writes to a file on disk. + Copyright (C) 1998, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.io; + +import gnu.java.nio.channels.FileChannelImpl; + +import java.nio.channels.FileChannel; + +/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 + * "The Java Language Specification", ISBN 0-201-63451-1 + * Status: Complete to version 1.1. + */ + +/** + * This classes allows a stream of data to be written to a disk file or + * any open <code>FileDescriptor</code>. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Tom Tromey (tromey@cygnus.com) + */ +public class FileOutputStream extends OutputStream +{ + private FileDescriptor fd; + + private FileChannelImpl ch; + + /** + * This method initializes a <code>FileOutputStream</code> object to write + * to the named file. The file is created if it does not exist, and + * the bytes written are written starting at the beginning of the file if + * the <code>append</code> argument is <code>false</code> or at the end + * of the file if the <code>append</code> argument is true. + * <p> + * Before opening a file, a security check is performed by calling the + * <code>checkWrite</code> method of the <code>SecurityManager</code> (if + * one exists) with the name of the file to be opened. An exception is + * thrown if writing is not allowed. + * + * @param path The name of the file this stream should write to + * @param append <code>true</code> to append bytes to the end of the file, + * or <code>false</code> to write bytes to the beginning + * + * @exception SecurityException If write access to the file is not allowed + * @exception FileNotFoundException If a non-security error occurs + */ + public FileOutputStream (String path, boolean append) + throws SecurityException, FileNotFoundException + { + this (new File(path), append); + } + + /** + * This method initializes a <code>FileOutputStream</code> object to write + * to the named file. The file is created if it does not exist, and + * the bytes written are written starting at the beginning of the file. + * <p> + * Before opening a file, a security check is performed by calling the + * <code>checkWrite</code> method of the <code>SecurityManager</code> (if + * one exists) with the name of the file to be opened. An exception is + * thrown if writing is not allowed. + * + * @param path The name of the file this stream should write to + * + * @exception SecurityException If write access to the file is not allowed + * @exception FileNotFoundException If a non-security error occurs + */ + public FileOutputStream (String path) + throws SecurityException, FileNotFoundException + { + this (path, false); + } + + /** + * This method initializes a <code>FileOutputStream</code> object to write + * to the specified <code>File</code> object. The file is created if it + * does not exist, and the bytes written are written starting at the + * beginning of the file. + * <p> + * Before opening a file, a security check is performed by calling the + * <code>checkWrite</code> method of the <code>SecurityManager</code> (if + * one exists) with the name of the file to be opened. An exception is + * thrown if writing is not allowed. + * + * @param file The <code>File</code> object this stream should write to + * + * @exception SecurityException If write access to the file is not allowed + * @exception FileNotFoundException If a non-security error occurs + */ + public FileOutputStream (File file) + throws SecurityException, FileNotFoundException + { + this (file, false); + } + + /** + * This method initializes a <code>FileOutputStream</code> object to write + * to the specified <code>File</code> object. The file is created if it + * does not exist, and the bytes written are written starting at the + * beginning of the file if the <code>append</code> parameter is + * <code>false</code>. Otherwise bytes are written at the end of the + * file. + * <p> + * Before opening a file, a security check is performed by calling the + * <code>checkWrite</code> method of the <code>SecurityManager</code> (if + * one exists) with the name of the file to be opened. An exception is + * thrown if writing is not allowed. + * + * @param file The <code>File</code> object this stream should write to + * @param append <code>true</code> to append bytes to the end of the file, + * or <code>false</code> to write bytes to the beginning + * + * @exception SecurityException If write access to the file is not allowed + * @exception FileNotFoundException If a non-security error occurs + */ + public FileOutputStream (File file, boolean append) + throws FileNotFoundException + { + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkWrite(file.getPath()); + + ch = FileChannelImpl.create(file, (append + ? FileChannelImpl.WRITE + | FileChannelImpl.APPEND + : FileChannelImpl.WRITE)); + } + + /** + * This method initializes a <code>FileOutputStream</code> object to write + * to the file represented by the specified <code>FileDescriptor</code> + * object. This method does not create any underlying disk file or + * reposition the file pointer of the given descriptor. It assumes that + * this descriptor is ready for writing as is. + * <p> + * Before opening a file, a security check is performed by calling the + * <code>checkWrite</code> method of the <code>SecurityManager</code> (if + * one exists) with the specified <code>FileDescriptor</code> as an argument. + * An exception is thrown if writing is not allowed. + * + * @param fdObj The <code>FileDescriptor</code> this stream should write to + * + * @exception SecurityException If write access to the file is not allowed + */ + public FileOutputStream (FileDescriptor fdObj) + throws SecurityException + { + // Hmm, no other exception but this one to throw, but if the descriptor + // isn't valid, we surely don't have "permission" to write to it. + if (!fdObj.valid()) + throw new SecurityException("Invalid FileDescriptor"); + + SecurityManager s = System.getSecurityManager(); + if (s != null) + s.checkWrite(fdObj); + + fd = fdObj; + ch = (FileChannelImpl) fdObj.channel; + } + + FileOutputStream(FileChannelImpl ch) + { + this.ch = ch; + } + + protected void finalize () throws IOException + { + // We don't actually need this, but we include it because it is + // mentioned in the JCL. + } + + /** + * This method returns a <code>FileDescriptor</code> object representing + * the file that is currently being written to + * + * @return A <code>FileDescriptor</code> object for this stream + * + * @exception IOException If an error occurs + */ + public final FileDescriptor getFD () throws IOException + { + synchronized (this) + { + if (fd == null) + fd = new FileDescriptor (ch); + return fd; + } + } + + /** + * This method writes a single byte of data to the file. + * + * @param b The byte of data to write, passed as an <code>int</code> + * + * @exception IOException If an error occurs + */ + public void write (int b) throws IOException + { + ch.write (b); + } + + /** + * This method writes all the bytes in the specified array to the + * file. + * + * @param buf The array of bytes to write to the file + * + * @exception IOException If an error occurs + */ + public void write (byte[] buf) + throws IOException + { + write (buf, 0, buf.length); + } + + /** + * This method writes <code>len</code> bytes from the byte array + * <code>buf</code> to the file starting at index <code>offset</code>. + * + * @param buf The array of bytes to write to the file + * @param offset The offset into the array to start writing bytes from + * @param len The number of bytes to write to the file + * + * @exception IOException If an error occurs + */ + public void write (byte[] buf, int offset, int len) + throws IOException + { + if (offset < 0 + || len < 0 + || offset + len > buf.length) + throw new ArrayIndexOutOfBoundsException (); + + ch.write (buf, offset, len); + } + + /** + * This method closes the underlying file. Any further attempts to + * write to this stream will likely generate an exception since the + * file is closed. + * + * @exception IOException If an error occurs + */ + public void close () throws IOException + { + ch.close(); + } + + /** + * This method creates a java.nio.channels.FileChannel. + * Nio does not allow one to create a file channel directly. + * A file channel must be created by first creating an instance of + * Input/Output/RandomAccessFile and invoking the getChannel() method on it. + */ + public synchronized FileChannel getChannel() + { + return ch; + } + +} // class FileOutputStream + diff --git a/libjava/java/io/FilePermission.h b/libjava/java/io/FilePermission.h new file mode 100644 index 0000000..bace152 --- /dev/null +++ b/libjava/java/io/FilePermission.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FilePermission__ +#define __java_io_FilePermission__ + +#pragma interface + +#include <java/security/Permission.h> +extern "Java" +{ + namespace java + { + namespace security + { + class Permission; + } + } +} + +class java::io::FilePermission : public ::java::security::Permission +{ + + void checkPerms(); +public: + FilePermission(::java::lang::String *, ::java::lang::String *); + ::java::lang::String * getActions(); + jint hashCode(); + jboolean equals(::java::lang::Object *); + jboolean implies(::java::security::Permission *); +private: + static const jlong serialVersionUID = 7930732926638008763LL; + static ::java::lang::String * ALL_FILES; + jboolean __attribute__((aligned(__alignof__( ::java::security::Permission)))) readPerm; + jboolean writePerm; + jboolean executePerm; + jboolean deletePerm; + ::java::lang::String * actionsString; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FilePermission__ diff --git a/libjava/java/io/FileReader.h b/libjava/java/io/FileReader.h new file mode 100644 index 0000000..4d1fba2 --- /dev/null +++ b/libjava/java/io/FileReader.h @@ -0,0 +1,21 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileReader__ +#define __java_io_FileReader__ + +#pragma interface + +#include <java/io/InputStreamReader.h> + +class java::io::FileReader : public ::java::io::InputStreamReader +{ + +public: + FileReader(::java::io::File *); + FileReader(::java::io::FileDescriptor *); + FileReader(::java::lang::String *); + static ::java::lang::Class class$; +}; + +#endif // __java_io_FileReader__ diff --git a/libjava/java/io/FileWriter.h b/libjava/java/io/FileWriter.h new file mode 100644 index 0000000..b75ea00 --- /dev/null +++ b/libjava/java/io/FileWriter.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FileWriter__ +#define __java_io_FileWriter__ + +#pragma interface + +#include <java/io/OutputStreamWriter.h> + +class java::io::FileWriter : public ::java::io::OutputStreamWriter +{ + +public: + FileWriter(::java::io::File *); + FileWriter(::java::io::File *, jboolean); + FileWriter(::java::io::FileDescriptor *); + FileWriter(::java::lang::String *); + FileWriter(::java::lang::String *, jboolean); + static ::java::lang::Class class$; +}; + +#endif // __java_io_FileWriter__ diff --git a/libjava/java/io/FilenameFilter.h b/libjava/java/io/FilenameFilter.h new file mode 100644 index 0000000..2337ed32 --- /dev/null +++ b/libjava/java/io/FilenameFilter.h @@ -0,0 +1,19 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FilenameFilter__ +#define __java_io_FilenameFilter__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::FilenameFilter : public ::java::lang::Object +{ + +public: + virtual jboolean accept(::java::io::File *, ::java::lang::String *) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_FilenameFilter__ diff --git a/libjava/java/io/FilterInputStream.h b/libjava/java/io/FilterInputStream.h new file mode 100644 index 0000000..1116639 --- /dev/null +++ b/libjava/java/io/FilterInputStream.h @@ -0,0 +1,34 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FilterInputStream__ +#define __java_io_FilterInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + + +class java::io::FilterInputStream : public ::java::io::InputStream +{ + +public: // actually protected + FilterInputStream(::java::io::InputStream *); +public: + virtual void mark(jint); + virtual jboolean markSupported(); + virtual void reset(); + virtual jint available(); + virtual jlong skip(jlong); + virtual jint read(); + virtual jint read(JArray< jbyte > *); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void close(); +public: // actually protected + ::java::io::InputStream * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) in; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FilterInputStream__ diff --git a/libjava/java/io/FilterOutputStream.h b/libjava/java/io/FilterOutputStream.h new file mode 100644 index 0000000..571b255 --- /dev/null +++ b/libjava/java/io/FilterOutputStream.h @@ -0,0 +1,29 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FilterOutputStream__ +#define __java_io_FilterOutputStream__ + +#pragma interface + +#include <java/io/OutputStream.h> +#include <gcj/array.h> + + +class java::io::FilterOutputStream : public ::java::io::OutputStream +{ + +public: + FilterOutputStream(::java::io::OutputStream *); + virtual void close(); + virtual void flush(); + virtual void write(jint); + virtual void write(JArray< jbyte > *); + virtual void write(JArray< jbyte > *, jint, jint); +public: // actually protected + ::java::io::OutputStream * __attribute__((aligned(__alignof__( ::java::io::OutputStream)))) out; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FilterOutputStream__ diff --git a/libjava/java/io/FilterReader.h b/libjava/java/io/FilterReader.h new file mode 100644 index 0000000..52a1995 --- /dev/null +++ b/libjava/java/io/FilterReader.h @@ -0,0 +1,33 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FilterReader__ +#define __java_io_FilterReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + + +class java::io::FilterReader : public ::java::io::Reader +{ + +public: // actually protected + FilterReader(::java::io::Reader *); +public: + virtual void mark(jint); + virtual jboolean markSupported(); + virtual void reset(); + virtual jboolean ready(); + virtual jlong skip(jlong); + virtual jint read(); + virtual jint read(JArray< jchar > *, jint, jint); + virtual void close(); +public: // actually protected + ::java::io::Reader * __attribute__((aligned(__alignof__( ::java::io::Reader)))) in; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FilterReader__ diff --git a/libjava/java/io/FilterWriter.h b/libjava/java/io/FilterWriter.h new file mode 100644 index 0000000..146f015 --- /dev/null +++ b/libjava/java/io/FilterWriter.h @@ -0,0 +1,30 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_FilterWriter__ +#define __java_io_FilterWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + + +class java::io::FilterWriter : public ::java::io::Writer +{ + +public: // actually protected + FilterWriter(::java::io::Writer *); +public: + virtual void close(); + virtual void flush(); + virtual void write(jint); + virtual void write(JArray< jchar > *, jint, jint); + virtual void write(::java::lang::String *, jint, jint); +public: // actually protected + ::java::io::Writer * __attribute__((aligned(__alignof__( ::java::io::Writer)))) out; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_FilterWriter__ diff --git a/libjava/java/io/Flushable.h b/libjava/java/io/Flushable.h new file mode 100644 index 0000000..2acd25d --- /dev/null +++ b/libjava/java/io/Flushable.h @@ -0,0 +1,19 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_Flushable__ +#define __java_io_Flushable__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::Flushable : public ::java::lang::Object +{ + +public: + virtual void flush() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_Flushable__ diff --git a/libjava/java/io/IOException.h b/libjava/java/io/IOException.h new file mode 100644 index 0000000..bdd92e0 --- /dev/null +++ b/libjava/java/io/IOException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_IOException__ +#define __java_io_IOException__ + +#pragma interface + +#include <java/lang/Exception.h> + +class java::io::IOException : public ::java::lang::Exception +{ + +public: + IOException(); + IOException(::java::lang::String *); +private: + static const jlong serialVersionUID = 7818375828146090155LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_IOException__ diff --git a/libjava/java/io/InputStream.h b/libjava/java/io/InputStream.h new file mode 100644 index 0000000..263af2c --- /dev/null +++ b/libjava/java/io/InputStream.h @@ -0,0 +1,30 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_InputStream__ +#define __java_io_InputStream__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::InputStream : public ::java::lang::Object +{ + +public: + InputStream(); + virtual jint available(); + virtual void close(); + virtual void mark(jint); + virtual jboolean markSupported(); + virtual jint read() = 0; + virtual jint read(JArray< jbyte > *); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void reset(); + virtual jlong skip(jlong); + static ::java::lang::Class class$; +}; + +#endif // __java_io_InputStream__ diff --git a/libjava/java/io/InputStreamReader.h b/libjava/java/io/InputStreamReader.h new file mode 100644 index 0000000..46050d5 --- /dev/null +++ b/libjava/java/io/InputStreamReader.h @@ -0,0 +1,65 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_InputStreamReader__ +#define __java_io_InputStreamReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + namespace convert + { + class BytesToUnicode; + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetDecoder; + } + } + } +} + +class java::io::InputStreamReader : public ::java::io::Reader +{ + +public: + InputStreamReader(::java::io::InputStream *); + InputStreamReader(::java::io::InputStream *, ::java::lang::String *); + InputStreamReader(::java::io::InputStream *, ::java::nio::charset::Charset *); + InputStreamReader(::java::io::InputStream *, ::java::nio::charset::CharsetDecoder *); +private: + InputStreamReader(::java::io::InputStream *, ::gnu::gcj::convert::BytesToUnicode *); +public: + virtual void close(); + virtual ::java::lang::String * getEncoding(); + virtual jboolean ready(); + virtual jint read(JArray< jchar > *, jint, jint); + virtual jint read(); +private: + jint refill(JArray< jchar > *, jint, jint); +public: // actually package-private + ::java::io::BufferedInputStream * __attribute__((aligned(__alignof__( ::java::io::Reader)))) in; + JArray< jchar > * work; + jint wpos; + jint wcount; + ::gnu::gcj::convert::BytesToUnicode * converter; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_InputStreamReader__ diff --git a/libjava/java/io/InterruptedIOException.h b/libjava/java/io/InterruptedIOException.h new file mode 100644 index 0000000..40922cd --- /dev/null +++ b/libjava/java/io/InterruptedIOException.h @@ -0,0 +1,26 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_InterruptedIOException__ +#define __java_io_InterruptedIOException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::InterruptedIOException : public ::java::io::IOException +{ + +public: + InterruptedIOException(); + InterruptedIOException(::java::lang::String *); +public: // actually package-private + InterruptedIOException(::java::lang::String *, jint); +private: + static const jlong serialVersionUID = 4020568460727500567LL; +public: + jint __attribute__((aligned(__alignof__( ::java::io::IOException)))) bytesTransferred; + static ::java::lang::Class class$; +}; + +#endif // __java_io_InterruptedIOException__ diff --git a/libjava/java/io/InvalidClassException.h b/libjava/java/io/InvalidClassException.h new file mode 100644 index 0000000..6216a9a --- /dev/null +++ b/libjava/java/io/InvalidClassException.h @@ -0,0 +1,25 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_InvalidClassException__ +#define __java_io_InvalidClassException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::InvalidClassException : public ::java::io::ObjectStreamException +{ + +public: + InvalidClassException(::java::lang::String *); + InvalidClassException(::java::lang::String *, ::java::lang::String *); + virtual ::java::lang::String * getMessage(); +private: + static const jlong serialVersionUID = -4333316296251054416LL; +public: + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::io::ObjectStreamException)))) classname; + static ::java::lang::Class class$; +}; + +#endif // __java_io_InvalidClassException__ diff --git a/libjava/java/io/InvalidObjectException.h b/libjava/java/io/InvalidObjectException.h new file mode 100644 index 0000000..550dd43 --- /dev/null +++ b/libjava/java/io/InvalidObjectException.h @@ -0,0 +1,22 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_InvalidObjectException__ +#define __java_io_InvalidObjectException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::InvalidObjectException : public ::java::io::ObjectStreamException +{ + +public: + InvalidObjectException(::java::lang::String *); +private: + static const jlong serialVersionUID = 3233174318281839583LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_InvalidObjectException__ diff --git a/libjava/java/io/LineNumberInputStream.h b/libjava/java/io/LineNumberInputStream.h new file mode 100644 index 0000000..676893d --- /dev/null +++ b/libjava/java/io/LineNumberInputStream.h @@ -0,0 +1,34 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_LineNumberInputStream__ +#define __java_io_LineNumberInputStream__ + +#pragma interface + +#include <java/io/FilterInputStream.h> +#include <gcj/array.h> + + +class java::io::LineNumberInputStream : public ::java::io::FilterInputStream +{ + +public: + LineNumberInputStream(::java::io::InputStream *); + virtual jint available(); + virtual jint getLineNumber(); + virtual void mark(jint); + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void reset(); + virtual void setLineNumber(jint); + virtual jlong skip(jlong); +private: + jint __attribute__((aligned(__alignof__( ::java::io::FilterInputStream)))) lineNumber; + jint markLineNumber; + jboolean justReadReturnChar; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_LineNumberInputStream__ diff --git a/libjava/java/io/LineNumberReader.h b/libjava/java/io/LineNumberReader.h new file mode 100644 index 0000000..33564c9 --- /dev/null +++ b/libjava/java/io/LineNumberReader.h @@ -0,0 +1,41 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_LineNumberReader__ +#define __java_io_LineNumberReader__ + +#pragma interface + +#include <java/io/BufferedReader.h> +#include <gcj/array.h> + + +class java::io::LineNumberReader : public ::java::io::BufferedReader +{ + +public: + LineNumberReader(::java::io::Reader *); + LineNumberReader(::java::io::Reader *, jint); + virtual jint getLineNumber(); + virtual void setLineNumber(jint); + virtual void mark(jint); + virtual void reset(); +private: + jint fill(); +public: + virtual jint read(); + virtual jint read(JArray< jchar > *, jint, jint); +private: + void skipRedundantLF(); +public: + virtual ::java::lang::String * readLine(); + virtual jlong skip(jlong); +private: + jint __attribute__((aligned(__alignof__( ::java::io::BufferedReader)))) lineNumber; + jboolean matchedNewLine; + jint savedLineNumber; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_LineNumberReader__ diff --git a/libjava/java/io/NotActiveException.h b/libjava/java/io/NotActiveException.h new file mode 100644 index 0000000..9020e4e --- /dev/null +++ b/libjava/java/io/NotActiveException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_NotActiveException__ +#define __java_io_NotActiveException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::NotActiveException : public ::java::io::ObjectStreamException +{ + +public: + NotActiveException(); + NotActiveException(::java::lang::String *); +private: + static const jlong serialVersionUID = -3893467273049808895LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_NotActiveException__ diff --git a/libjava/java/io/NotSerializableException.h b/libjava/java/io/NotSerializableException.h new file mode 100644 index 0000000..55699b4 --- /dev/null +++ b/libjava/java/io/NotSerializableException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_NotSerializableException__ +#define __java_io_NotSerializableException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::NotSerializableException : public ::java::io::ObjectStreamException +{ + +public: + NotSerializableException(); + NotSerializableException(::java::lang::String *); +private: + static const jlong serialVersionUID = 2906642554793891381LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_NotSerializableException__ diff --git a/libjava/java/io/ObjectInput.h b/libjava/java/io/ObjectInput.h new file mode 100644 index 0000000..7cfac20 --- /dev/null +++ b/libjava/java/io/ObjectInput.h @@ -0,0 +1,42 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInput__ +#define __java_io_ObjectInput__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::ObjectInput : public ::java::lang::Object +{ + +public: + virtual jint available() = 0; + virtual jint read() = 0; + virtual jint read(JArray< jbyte > *) = 0; + virtual jint read(JArray< jbyte > *, jint, jint) = 0; + virtual ::java::lang::Object * readObject() = 0; + virtual jlong skip(jlong) = 0; + virtual void close() = 0; + virtual jboolean readBoolean() = 0; + virtual jbyte readByte() = 0; + virtual jint readUnsignedByte() = 0; + virtual jchar readChar() = 0; + virtual jshort readShort() = 0; + virtual jint readUnsignedShort() = 0; + virtual jint readInt() = 0; + virtual jlong readLong() = 0; + virtual jfloat readFloat() = 0; + virtual jdouble readDouble() = 0; + virtual ::java::lang::String * readLine() = 0; + virtual ::java::lang::String * readUTF() = 0; + virtual void readFully(JArray< jbyte > *) = 0; + virtual void readFully(JArray< jbyte > *, jint, jint) = 0; + virtual jint skipBytes(jint) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_ObjectInput__ diff --git a/libjava/java/io/ObjectInputStream$1.h b/libjava/java/io/ObjectInputStream$1.h new file mode 100644 index 0000000..3a3241a --- /dev/null +++ b/libjava/java/io/ObjectInputStream$1.h @@ -0,0 +1,26 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInputStream$1__ +#define __java_io_ObjectInputStream$1__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectInputStream$1 : public ::java::lang::Object +{ + +public: // actually package-private + ObjectInputStream$1(::java::io::ObjectInputStream *, ::java::lang::Class *); +public: + ::java::lang::Object * run(); +public: // actually package-private + ::java::io::ObjectInputStream * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0; +private: + ::java::lang::Class * val$local_constructor_class; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectInputStream$1__ diff --git a/libjava/java/io/ObjectInputStream$2.h b/libjava/java/io/ObjectInputStream$2.h new file mode 100644 index 0000000..70fbf58 --- /dev/null +++ b/libjava/java/io/ObjectInputStream$2.h @@ -0,0 +1,42 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInputStream$2__ +#define __java_io_ObjectInputStream$2__ + +#pragma interface + +#include <java/io/ObjectInputStream$GetField.h> +#include <gcj/array.h> + + +class java::io::ObjectInputStream$2 : public ::java::io::ObjectInputStream$GetField +{ + +public: // actually package-private + ObjectInputStream$2(::java::io::ObjectInputStream *, ::java::io::ObjectStreamClass *, JArray< jbyte > *, JArray< ::java::lang::Object * > *); +public: + ::java::io::ObjectStreamClass * getObjectStreamClass(); + jboolean defaulted(::java::lang::String *); + jboolean get(::java::lang::String *, jboolean); + jchar get(::java::lang::String *, jchar); + jbyte get(::java::lang::String *, jbyte); + jshort get(::java::lang::String *, jshort); + jint get(::java::lang::String *, jint); + jlong get(::java::lang::String *, jlong); + jfloat get(::java::lang::String *, jfloat); + jdouble get(::java::lang::String *, jdouble); + ::java::lang::Object * get(::java::lang::String *, ::java::lang::Object *); +private: + ::java::io::ObjectStreamField * getField(::java::lang::String *, ::java::lang::Class *); +public: // actually package-private + ::java::io::ObjectInputStream * __attribute__((aligned(__alignof__( ::java::io::ObjectInputStream$GetField)))) this$0; +private: + ::java::io::ObjectStreamClass * val$clazz; + JArray< jbyte > * val$prim_field_data; + JArray< ::java::lang::Object * > * val$objs; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectInputStream$2__ diff --git a/libjava/java/io/ObjectInputStream$GetField.h b/libjava/java/io/ObjectInputStream$GetField.h new file mode 100644 index 0000000..d61509c --- /dev/null +++ b/libjava/java/io/ObjectInputStream$GetField.h @@ -0,0 +1,30 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInputStream$GetField__ +#define __java_io_ObjectInputStream$GetField__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectInputStream$GetField : public ::java::lang::Object +{ + +public: + ObjectInputStream$GetField(); + virtual ::java::io::ObjectStreamClass * getObjectStreamClass() = 0; + virtual jboolean defaulted(::java::lang::String *) = 0; + virtual jboolean get(::java::lang::String *, jboolean) = 0; + virtual jchar get(::java::lang::String *, jchar) = 0; + virtual jbyte get(::java::lang::String *, jbyte) = 0; + virtual jshort get(::java::lang::String *, jshort) = 0; + virtual jint get(::java::lang::String *, jint) = 0; + virtual jlong get(::java::lang::String *, jlong) = 0; + virtual jfloat get(::java::lang::String *, jfloat) = 0; + virtual jdouble get(::java::lang::String *, jdouble) = 0; + virtual ::java::lang::Object * get(::java::lang::String *, ::java::lang::Object *) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectInputStream$GetField__ diff --git a/libjava/java/io/ObjectInputStream$ValidatorAndPriority.h b/libjava/java/io/ObjectInputStream$ValidatorAndPriority.h new file mode 100644 index 0000000..02e6ae6 --- /dev/null +++ b/libjava/java/io/ObjectInputStream$ValidatorAndPriority.h @@ -0,0 +1,25 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInputStream$ValidatorAndPriority__ +#define __java_io_ObjectInputStream$ValidatorAndPriority__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectInputStream$ValidatorAndPriority : public ::java::lang::Object +{ + +public: // actually package-private + ObjectInputStream$ValidatorAndPriority(::java::io::ObjectInputValidation *, jint); +public: + jint compareTo(::java::lang::Object *); +public: // actually package-private + jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) priority; + ::java::io::ObjectInputValidation * validator; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectInputStream$ValidatorAndPriority__ diff --git a/libjava/java/io/ObjectInputStream.h b/libjava/java/io/ObjectInputStream.h new file mode 100644 index 0000000..b27764a --- /dev/null +++ b/libjava/java/io/ObjectInputStream.h @@ -0,0 +1,103 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInputStream__ +#define __java_io_ObjectInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + + +class java::io::ObjectInputStream : public ::java::io::InputStream +{ + +public: + ObjectInputStream(::java::io::InputStream *); + virtual ::java::lang::Object * readObject(); +private: + ::java::lang::Object * parseContent(jbyte); + void checkTypeConsistency(::java::lang::String *, JArray< ::java::io::ObjectStreamField * > *, JArray< ::java::io::ObjectStreamField * > *); +public: // actually protected + virtual ::java::io::ObjectStreamClass * readClassDescriptor(); +public: + virtual void defaultReadObject(); + virtual void registerValidation(::java::io::ObjectInputValidation *, jint); +public: // actually protected + virtual ::java::lang::Class * resolveClass(::java::io::ObjectStreamClass *); +private: + ::java::lang::ClassLoader * currentLoader(); + ::java::io::ObjectStreamClass * lookupClass(::java::lang::Class *); + JArray< ::java::io::ObjectStreamClass * > * hierarchy(::java::lang::Class *); +public: // actually protected + virtual ::java::lang::Object * resolveObject(::java::lang::Object *); + virtual ::java::lang::Class * resolveProxyClass(JArray< ::java::lang::String * > *); + virtual jboolean enableResolveObject(jboolean); + virtual void readStreamHeader(); +public: + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual jint available(); + virtual void close(); + virtual jboolean readBoolean(); + virtual jbyte readByte(); + virtual jint readUnsignedByte(); + virtual jshort readShort(); + virtual jint readUnsignedShort(); + virtual jchar readChar(); + virtual jint readInt(); + virtual jlong readLong(); + virtual jfloat readFloat(); + virtual jdouble readDouble(); + virtual void readFully(JArray< jbyte > *); + virtual void readFully(JArray< jbyte > *, jint, jint); + virtual jint skipBytes(jint); + virtual ::java::lang::String * readLine(); + virtual ::java::lang::String * readUTF(); + virtual ::java::io::ObjectInputStream$GetField * readFields(); +public: // actually protected + ObjectInputStream(); + virtual ::java::lang::Object * readObjectOverride(); +private: + jint assignNewHandle(::java::lang::Object *); + void rememberHandle(::java::lang::Object *, jint); + ::java::lang::Object * lookupHandle(jint); + ::java::lang::Object * processResolution(::java::io::ObjectStreamClass *, ::java::lang::Object *, jint); + void clearHandles(); + void readNextBlock(); + void readNextBlock(jbyte); + void readArrayElements(::java::lang::Object *, ::java::lang::Class *); + void readFields(::java::lang::Object *, ::java::io::ObjectStreamClass *); + jboolean setBlockDataMode(jboolean); + ::java::lang::Object * newObject(::java::lang::Class *, ::java::lang::reflect::Constructor *); + void invokeValidators(); + void callReadMethod(::java::lang::reflect::Method *, ::java::lang::Class *, ::java::lang::Object *); + void dumpElement(::java::lang::String *); + void dumpElementln(::java::lang::String *); + static const jint BUFFER_SIZE = 1024; + ::java::io::DataInputStream * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) realInputStream; + ::java::io::DataInputStream * dataInputStream; + ::java::io::DataInputStream * blockDataInput; + jint blockDataPosition; + jint blockDataBytes; + JArray< jbyte > * blockData; + jboolean useSubclassMethod; + jint nextOID; + jboolean resolveEnabled; + ::java::util::Vector * objectLookupTable; + ::java::lang::Object * currentObject; + ::java::io::ObjectStreamClass * currentObjectStreamClass; + ::java::util::TreeSet * currentObjectValidators; + jboolean readDataFromBlock; + jboolean fieldsAlreadyRead; + ::java::util::Hashtable * classLookupTable; + ::java::io::ObjectInputStream$GetField * prereadFields; + static jboolean dump; + jint depth; + static const jboolean DEBUG = 0; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectInputStream__ diff --git a/libjava/java/io/ObjectInputStream.java b/libjava/java/io/ObjectInputStream.java deleted file mode 100644 index 54661a9..0000000 --- a/libjava/java/io/ObjectInputStream.java +++ /dev/null @@ -1,1979 +0,0 @@ -/* ObjectInputStream.java -- Class used to read serialized objects - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 - Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package java.io; - -import gnu.classpath.Configuration; -import gnu.java.io.ObjectIdentityWrapper; - -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.lang.reflect.Proxy; -import java.security.AccessController; -import java.security.PrivilegedAction; -import java.util.Arrays; -import java.util.Hashtable; -import java.util.Vector; - -public class ObjectInputStream extends InputStream - implements ObjectInput, ObjectStreamConstants -{ - /** - * Creates a new <code>ObjectInputStream</code> that will do all of - * its reading from <code>in</code>. This method also checks - * the stream by reading the header information (stream magic number - * and stream version). - * - * @exception IOException Reading stream header from underlying - * stream cannot be completed. - * - * @exception StreamCorruptedException An invalid stream magic - * number or stream version was read from the stream. - * - * @see #readStreamHeader() - */ - public ObjectInputStream(InputStream in) - throws IOException, StreamCorruptedException - { - if (Configuration.DEBUG) - { - String val = System.getProperty("gcj.dumpobjects"); - if (dump == false && val != null && !val.equals("")) - { - dump = true; - System.out.println ("Serialization debugging enabled"); - } - else if (dump == true && (val == null || val.equals(""))) - { - dump = false; - System.out.println ("Serialization debugging disabled"); - } - } - - this.resolveEnabled = false; - this.isDeserializing = false; - this.blockDataPosition = 0; - this.blockDataBytes = 0; - this.blockData = new byte[BUFFER_SIZE]; - this.blockDataInput = new DataInputStream(this); - this.realInputStream = new DataInputStream(in); - this.nextOID = baseWireHandle; - this.objectLookupTable = new Hashtable(); - this.validators = new Vector(); - this.classLookupTable = new Hashtable(); - setBlockDataMode(true); - readStreamHeader(); - } - - - /** - * Returns the next deserialized object read from the underlying stream. - * - * This method can be overriden by a class by implementing - * <code>private void readObject (ObjectInputStream)</code>. - * - * If an exception is thrown from this method, the stream is left in - * an undefined state. This method can also throw Errors and - * RuntimeExceptions if caused by existing readResolve() user code. - * - * @return The object read from the underlying stream. - * - * @exception ClassNotFoundException The class that an object being - * read in belongs to cannot be found. - * - * @exception IOException Exception from underlying - * <code>InputStream</code>. - */ - public final Object readObject() throws ClassNotFoundException, IOException - { - if (this.useSubclassMethod) - return readObjectOverride(); - - boolean was_deserializing; - - Object ret_val; - was_deserializing = this.isDeserializing; - - boolean is_consumed = false; - boolean old_mode = setBlockDataMode(false); - - this.isDeserializing = true; - - byte marker = this.realInputStream.readByte(); - - depth += 2; - - if(dump) dumpElement("MARKER: 0x" + Integer.toHexString(marker) + " "); - - try - { - switch (marker) - { - case TC_ENDBLOCKDATA: - { - ret_val = null; - is_consumed = true; - break; - } - - case TC_BLOCKDATA: - case TC_BLOCKDATALONG: - { - if (marker == TC_BLOCKDATALONG) - { if(dump) dumpElementln("BLOCKDATALONG"); } - else - { if(dump) dumpElementln("BLOCKDATA"); } - readNextBlock(marker); - throw new StreamCorruptedException("Unexpected blockData"); - } - - case TC_NULL: - { - if(dump) dumpElementln("NULL"); - ret_val = null; - break; - } - - case TC_REFERENCE: - { - if(dump) dumpElement("REFERENCE "); - Integer oid = new Integer(this.realInputStream.readInt()); - if(dump) dumpElementln(Integer.toHexString(oid.intValue())); - ret_val = ((ObjectIdentityWrapper) - this.objectLookupTable.get(oid)).object; - break; - } - - case TC_CLASS: - { - if(dump) dumpElementln("CLASS"); - ObjectStreamClass osc = (ObjectStreamClass)readObject(); - Class clazz = osc.forClass(); - assignNewHandle(clazz); - ret_val = clazz; - break; - } - - case TC_PROXYCLASSDESC: - { - if(dump) dumpElementln("PROXYCLASS"); - int n_intf = this.realInputStream.readInt(); - String[] intfs = new String[n_intf]; - for (int i = 0; i < n_intf; i++) - { - intfs[i] = this.realInputStream.readUTF(); - } - - boolean oldmode = setBlockDataMode(true); - Class cl = resolveProxyClass(intfs); - setBlockDataMode(oldmode); - - ObjectStreamClass osc = lookupClass(cl); - if (osc.firstNonSerializableParentConstructor == null) - { - osc.realClassIsSerializable = true; - osc.fields = osc.fieldMapping = new ObjectStreamField[0]; - try - { - osc.firstNonSerializableParentConstructor = - Object.class.getConstructor(new Class[0]); - } - catch (NoSuchMethodException x) - { - throw (InternalError) - new InternalError("Object ctor missing").initCause(x); - } - } - assignNewHandle(osc); - - if (!is_consumed) - { - byte b = this.realInputStream.readByte(); - if (b != TC_ENDBLOCKDATA) - throw new IOException("Data annotated to class was not consumed." + b); - } - else - is_consumed = false; - ObjectStreamClass superosc = (ObjectStreamClass)readObject(); - osc.setSuperclass(superosc); - ret_val = osc; - break; - } - - case TC_CLASSDESC: - { - ObjectStreamClass osc = readClassDescriptor(); - - if (!is_consumed) - { - byte b = this.realInputStream.readByte(); - if (b != TC_ENDBLOCKDATA) - throw new IOException("Data annotated to class was not consumed." + b); - } - else - is_consumed = false; - - osc.setSuperclass ((ObjectStreamClass)readObject()); - ret_val = osc; - break; - } - - case TC_STRING: - case TC_LONGSTRING: - { - if(dump) dumpElement("STRING="); - String s = this.realInputStream.readUTF(); - if(dump) dumpElementln(s); - ret_val = processResolution(null, s, assignNewHandle(s)); - break; - } - - case TC_ARRAY: - { - if(dump) dumpElementln("ARRAY"); - ObjectStreamClass osc = (ObjectStreamClass)readObject(); - Class componentType = osc.forClass().getComponentType(); - if(dump) dumpElement("ARRAY LENGTH="); - int length = this.realInputStream.readInt(); - if(dump) dumpElementln (length + "; COMPONENT TYPE=" + componentType); - Object array = Array.newInstance(componentType, length); - int handle = assignNewHandle(array); - readArrayElements(array, componentType); - if(dump) - for (int i = 0, len = Array.getLength(array); i < len; i++) - dumpElementln(" ELEMENT[" + i + "]=" + Array.get(array, i)); - ret_val = processResolution(null, array, handle); - break; - } - - case TC_OBJECT: - { - if(dump) dumpElementln("OBJECT"); - ObjectStreamClass osc = (ObjectStreamClass)readObject(); - Class clazz = osc.forClass(); - - if (!osc.realClassIsSerializable) - throw new NotSerializableException - (clazz + " is not Serializable, and thus cannot be deserialized."); - - if (osc.realClassIsExternalizable) - { - Externalizable obj = osc.newInstance(); - - int handle = assignNewHandle(obj); - - boolean read_from_blocks = ((osc.getFlags() & SC_BLOCK_DATA) != 0); - - boolean oldmode = this.readDataFromBlock; - if (read_from_blocks) - setBlockDataMode(true); - - obj.readExternal(this); - - if (read_from_blocks) - { - setBlockDataMode(oldmode); - if (!oldmode) - if (this.realInputStream.readByte() != TC_ENDBLOCKDATA) - throw new IOException("No end of block data seen for class with readExternal (ObjectInputStream) method."); - } - - ret_val = processResolution(osc, obj, handle); - break; - } // end if (osc.realClassIsExternalizable) - - Object obj = newObject(clazz, osc.firstNonSerializableParentConstructor); - - int handle = assignNewHandle(obj); - Object prevObject = this.currentObject; - ObjectStreamClass prevObjectStreamClass = this.currentObjectStreamClass; - - this.currentObject = obj; - ObjectStreamClass[] hierarchy = - inputGetObjectStreamClasses(clazz); - - for (int i = 0; i < hierarchy.length; i++) - { - this.currentObjectStreamClass = hierarchy[i]; - - if(dump) dumpElementln("Reading fields of " + this.currentObjectStreamClass.getName ()); - - // XXX: should initialize fields in classes in the hierarchy - // that aren't in the stream - // should skip over classes in the stream that aren't in the - // real classes hierarchy - - Method readObjectMethod = this.currentObjectStreamClass.readObjectMethod; - if (readObjectMethod != null) - { - fieldsAlreadyRead = false; - boolean oldmode = setBlockDataMode(true); - callReadMethod(readObjectMethod, this.currentObjectStreamClass.forClass(), obj); - setBlockDataMode(oldmode); - } - else - { - readFields(obj, currentObjectStreamClass); - } - - if (this.currentObjectStreamClass.hasWriteMethod()) - { - if(dump) dumpElement("ENDBLOCKDATA? "); - try - { - // FIXME: XXX: This try block is to - // catch EOF which is thrown for some - // objects. That indicates a bug in - // the logic. - - if (this.realInputStream.readByte() != TC_ENDBLOCKDATA) - throw new IOException - ("No end of block data seen for class with readObject (ObjectInputStream) method."); - if(dump) dumpElementln("yes"); - } -// catch (EOFException e) -// { -// if(dump) dumpElementln("no, got EOFException"); -// } - catch (IOException e) - { - if(dump) dumpElementln("no, got IOException"); - } - } - } - - this.currentObject = prevObject; - this.currentObjectStreamClass = prevObjectStreamClass; - ret_val = processResolution(osc, obj, handle); - - break; - } - - case TC_RESET: - if(dump) dumpElementln("RESET"); - clearHandles(); - ret_val = readObject(); - break; - - case TC_EXCEPTION: - { - if(dump) dumpElement("EXCEPTION="); - Exception e = (Exception)readObject(); - if(dump) dumpElementln(e.toString()); - clearHandles(); - throw new WriteAbortedException("Exception thrown during writing of stream", e); - } - - default: - throw new IOException("Unknown marker on stream: " + marker); - } - } - finally - { - setBlockDataMode(old_mode); - - this.isDeserializing = was_deserializing; - - depth -= 2; - - if (! was_deserializing) - { - if (validators.size() > 0) - invokeValidators(); - } - } - - return ret_val; - } - - /** - * This method makes a partial check of types for the fields - * contained given in arguments. It checks primitive types of - * fields1 against non primitive types of fields2. This method - * assumes the two lists has already been sorted according to - * the Java specification. - * - * @param name Name of the class owning the given fields. - * @param fields1 First list to check. - * @param fields2 Second list to check. - * @throws InvalidClassException if a field in fields1, which has a primitive type, is a present - * in the non primitive part in fields2. - */ - private void checkTypeConsistency(String name, ObjectStreamField[] fields1, ObjectStreamField[] fields2) - throws InvalidClassException - { - int nonPrimitive = 0; - - for (nonPrimitive = 0; - nonPrimitive < fields1.length - && fields1[nonPrimitive].isPrimitive(); nonPrimitive++) - { - } - - if (nonPrimitive == fields1.length) - return; - - int i = 0; - ObjectStreamField f1; - ObjectStreamField f2; - - while (i < fields2.length - && nonPrimitive < fields1.length) - { - f1 = fields1[nonPrimitive]; - f2 = fields2[i]; - - if (!f2.isPrimitive()) - break; - - int compVal = f1.getName().compareTo (f2.getName()); - - if (compVal < 0) - { - nonPrimitive++; - } - else if (compVal > 0) - { - i++; - } - else - { - throw new InvalidClassException - ("invalid field type for " + f2.getName() + - " in class " + name); - } - } - } - - /** - * This method reads a class descriptor from the real input stream - * and use these data to create a new instance of ObjectStreamClass. - * Fields are sorted and ordered for the real read which occurs for - * each instance of the described class. Be aware that if you call that - * method you must ensure that the stream is synchronized, in the other - * case it may be completely desynchronized. - * - * @return A new instance of ObjectStreamClass containing the freshly - * created descriptor. - * @throws ClassNotFoundException if the required class to build the - * descriptor has not been found in the system. - * @throws IOException An input/output error occured. - * @throws InvalidClassException If there was a compatibility problem - * between the class present in the system and the serialized class. - */ - protected ObjectStreamClass readClassDescriptor() - throws ClassNotFoundException, IOException - { - if(dump) dumpElement("CLASSDESC NAME="); - String name = this.realInputStream.readUTF(); - if(dump) dumpElement(name + "; UID="); - long uid = this.realInputStream.readLong (); - if(dump) dumpElement(Long.toHexString(uid) + "; FLAGS="); - byte flags = this.realInputStream.readByte (); - if(dump) dumpElement(Integer.toHexString(flags) + "; FIELD COUNT="); - short field_count = this.realInputStream.readShort(); - if(dump) dumpElementln(Short.toString(field_count)); - ObjectStreamField[] fields = new ObjectStreamField[field_count]; - ObjectStreamClass osc = new ObjectStreamClass(name, uid, - flags, fields); - assignNewHandle(osc); - - if (callersClassLoader == null) - callersClassLoader = currentLoader(); - - for (int i = 0; i < field_count; i++) - { - if(dump) dumpElement(" TYPE CODE="); - char type_code = (char)this.realInputStream.readByte(); - if(dump) dumpElement(type_code + "; FIELD NAME="); - String field_name = this.realInputStream.readUTF(); - if(dump) dumpElementln(field_name); - String class_name; - - // If the type code is an array or an object we must - // decode a String here. In the other case we convert - // the type code and pass it to ObjectStreamField. - // Type codes are decoded by gnu.java.lang.reflect.TypeSignature. - if (type_code == 'L' || type_code == '[') - class_name = (String)readObject(); - else - class_name = String.valueOf(type_code); - - fields[i] = - new ObjectStreamField(field_name, class_name, callersClassLoader); - } - - /* Now that fields have been read we may resolve the class - * (and read annotation if needed). */ - Class clazz; - try - { - clazz = resolveClass(osc); - } - catch (ClassNotFoundException cnfe) - { - // Maybe it was an primitive class? - if (name.equals("void")) - clazz = Void.TYPE; - else if (name.equals("boolean")) - clazz = Boolean.TYPE; - else if (name.equals("byte")) - clazz = Byte.TYPE; - else if (name.equals("short")) - clazz = Short.TYPE; - else if (name.equals("char")) - clazz = Character.TYPE; - else if (name.equals("int")) - clazz = Integer.TYPE; - else if (name.equals("long")) - clazz = Long.TYPE; - else if (name.equals("float")) - clazz = Float.TYPE; - else if (name.equals("double")) - clazz = Double.TYPE; - else - throw cnfe; - } - - boolean oldmode = setBlockDataMode(true); - osc.setClass(clazz, lookupClass(clazz.getSuperclass())); - classLookupTable.put(clazz, osc); - setBlockDataMode(oldmode); - - // find the first non-serializable, non-abstract - // class in clazz's inheritance hierarchy - Class first_nonserial = clazz.getSuperclass(); - // Maybe it is a primitive class, those don't have a super class, - // or Object itself. Otherwise we can keep getting the superclass - // till we hit the Object class, or some other non-serializable class. - - if (first_nonserial == null) - first_nonserial = clazz; - else - while (Serializable.class.isAssignableFrom(first_nonserial) - || Modifier.isAbstract(first_nonserial.getModifiers())) - first_nonserial = first_nonserial.getSuperclass(); - - final Class local_constructor_class = first_nonserial; - - osc.firstNonSerializableParentConstructor = - (Constructor)AccessController.doPrivileged(new PrivilegedAction() - { - public Object run() - { - try - { - Constructor c = local_constructor_class. - getDeclaredConstructor(new Class[0]); - if (Modifier.isPrivate(c.getModifiers())) - return null; - return c; - } - catch (NoSuchMethodException e) - { - // error will be reported later, in newObject() - return null; - } - } - }); - - osc.realClassIsSerializable = Serializable.class.isAssignableFrom(clazz); - osc.realClassIsExternalizable = Externalizable.class.isAssignableFrom(clazz); - - ObjectStreamField[] stream_fields = osc.fields; - ObjectStreamField[] real_fields = ObjectStreamClass.lookupForClassObject(clazz).fields; - ObjectStreamField[] fieldmapping = new ObjectStreamField[2 * Math.max(stream_fields.length, real_fields.length)]; - - int stream_idx = 0; - int real_idx = 0; - int map_idx = 0; - - /* - * Check that there is no type inconsistencies between the lists. - * A special checking must be done for the two groups: primitive types and - * not primitive types. - */ - checkTypeConsistency(name, real_fields, stream_fields); - checkTypeConsistency(name, stream_fields, real_fields); - - - while (stream_idx < stream_fields.length - || real_idx < real_fields.length) - { - ObjectStreamField stream_field = null; - ObjectStreamField real_field = null; - - if (stream_idx == stream_fields.length) - { - real_field = real_fields[real_idx++]; - } - else if (real_idx == real_fields.length) - { - stream_field = stream_fields[stream_idx++]; - } - else - { - int comp_val = - real_fields[real_idx].compareTo (stream_fields[stream_idx]); - - if (comp_val < 0) - { - real_field = real_fields[real_idx++]; - } - else if (comp_val > 0) - { - stream_field = stream_fields[stream_idx++]; - } - else - { - stream_field = stream_fields[stream_idx++]; - real_field = real_fields[real_idx++]; - if (stream_field.getType() != real_field.getType()) - throw new InvalidClassException - ("invalid field type for " + real_field.getName() + - " in class " + name); - } - } - - /* If some of stream_fields does not correspond to any of real_fields, - * or the opposite, then fieldmapping will go short. - */ - if (map_idx == fieldmapping.length) - { - ObjectStreamField[] newfieldmapping = - new ObjectStreamField[fieldmapping.length + 2]; - System.arraycopy(fieldmapping, 0, - newfieldmapping, 0, fieldmapping.length); - fieldmapping = newfieldmapping; - } - fieldmapping[map_idx++] = stream_field; - fieldmapping[map_idx++] = real_field; - } - osc.fieldMapping = fieldmapping; - - return osc; - } - - /** - * Reads the current objects non-transient, non-static fields from - * the current class from the underlying output stream. - * - * This method is intended to be called from within a object's - * <code>private void readObject (ObjectInputStream)</code> - * method. - * - * @exception ClassNotFoundException The class that an object being - * read in belongs to cannot be found. - * - * @exception NotActiveException This method was called from a - * context other than from the current object's and current class's - * <code>private void readObject (ObjectInputStream)</code> - * method. - * - * @exception IOException Exception from underlying - * <code>OutputStream</code>. - */ - public void defaultReadObject() - throws ClassNotFoundException, IOException, NotActiveException - { - if (this.currentObject == null || this.currentObjectStreamClass == null) - throw new NotActiveException("defaultReadObject called by non-active" - + " class and/or object"); - - if (fieldsAlreadyRead) - throw new NotActiveException("defaultReadObject called but fields " - + "already read from stream (by " - + "defaultReadObject or readFields)"); - - boolean oldmode = setBlockDataMode(false); - readFields(this.currentObject, this.currentObjectStreamClass); - setBlockDataMode(oldmode); - - fieldsAlreadyRead = true; - } - - - /** - * Registers a <code>ObjectInputValidation</code> to be carried out - * on the object graph currently being deserialized before it is - * returned to the original caller of <code>readObject ()</code>. - * The order of validation for multiple - * <code>ObjectInputValidation</code>s can be controled using - * <code>priority</code>. Validators with higher priorities are - * called first. - * - * @see java.io.ObjectInputValidation - * - * @exception InvalidObjectException <code>validator</code> is - * <code>null</code> - * - * @exception NotActiveException an attempt was made to add a - * validator outside of the <code>readObject</code> method of the - * object currently being deserialized - */ - public void registerValidation(ObjectInputValidation validator, - int priority) - throws InvalidObjectException, NotActiveException - { - if (this.currentObject == null || this.currentObjectStreamClass == null) - throw new NotActiveException("registerValidation called by non-active " - + "class and/or object"); - - if (validator == null) - throw new InvalidObjectException("attempt to add a null " - + "ObjectInputValidation object"); - - this.validators.addElement(new ValidatorAndPriority (validator, - priority)); - } - - - /** - * Called when a class is being deserialized. This is a hook to - * allow subclasses to read in information written by the - * <code>annotateClass (Class)</code> method of an - * <code>ObjectOutputStream</code>. - * - * This implementation looks up the active call stack for a - * <code>ClassLoader</code>; if a <code>ClassLoader</code> is found, - * it is used to load the class associated with <code>osc</code>, - * otherwise, the default system <code>ClassLoader</code> is used. - * - * @exception IOException Exception from underlying - * <code>OutputStream</code>. - * - * @see java.io.ObjectOutputStream#annotateClass (java.lang.Class) - */ - protected Class resolveClass(ObjectStreamClass osc) - throws ClassNotFoundException, IOException - { - if (callersClassLoader == null) - { - callersClassLoader = currentLoader (); - if (Configuration.DEBUG && dump) - { - dumpElementln ("CallersClassLoader = " + callersClassLoader); - } - } - - return Class.forName(osc.getName(), true, callersClassLoader); - } - - /** - * Returns the most recent user defined ClassLoader on the execution stack - * or null if none is found. - */ - // GCJ LOCAL: native method. - private native ClassLoader currentLoader(); - - /** - * Lookup a class stored in the local hashtable. If it is not - * use the global lookup function in ObjectStreamClass to build - * the ObjectStreamClass. This method is requested according to - * the behaviour detected in the JDK by Kaffe's team. - * - * @param clazz Class to lookup in the hash table or for which - * we must build a descriptor. - * @return A valid instance of ObjectStreamClass corresponding - * to the specified class. - */ - private ObjectStreamClass lookupClass(Class clazz) - { - if (clazz == null) - return null; - - ObjectStreamClass oclazz; - oclazz = (ObjectStreamClass)classLookupTable.get(clazz); - if (oclazz == null) - return ObjectStreamClass.lookup(clazz); - else - return oclazz; - } - - /** - * Reconstruct class hierarchy the same way - * {@link java.io.ObjectStreamClass.getObjectStreamClasses(java.lang.Class)} does - * but using lookupClass instead of ObjectStreamClass.lookup. This - * dup is necessary localize the lookup table. Hopefully some future - * rewritings will be able to prevent this. - * - * @param clazz This is the class for which we want the hierarchy. - * - * @return An array of valid {@link java.io.ObjectStreamClass} instances which - * represent the class hierarchy for clazz. - */ - private ObjectStreamClass[] inputGetObjectStreamClasses(Class clazz) - { - ObjectStreamClass osc = lookupClass(clazz); - - if (osc == null) - return new ObjectStreamClass[0]; - else - { - Vector oscs = new Vector(); - - while (osc != null) - { - oscs.addElement(osc); - osc = osc.getSuper(); - } - - int count = oscs.size(); - ObjectStreamClass[] sorted_oscs = new ObjectStreamClass[count]; - - for (int i = count - 1; i >= 0; i--) - sorted_oscs[count - i - 1] = (ObjectStreamClass) oscs.elementAt(i); - - return sorted_oscs; - } - } - - /** - * Allows subclasses to resolve objects that are read from the - * stream with other objects to be returned in their place. This - * method is called the first time each object is encountered. - * - * This method must be enabled before it will be called in the - * serialization process. - * - * @exception IOException Exception from underlying - * <code>OutputStream</code>. - * - * @see #enableResolveObject(boolean) - */ - protected Object resolveObject(Object obj) throws IOException - { - return obj; - } - - - protected Class resolveProxyClass(String[] intfs) - throws IOException, ClassNotFoundException - { - ClassLoader cl = currentLoader(); - - Class[] clss = new Class[intfs.length]; - if(cl == null) - { - for (int i = 0; i < intfs.length; i++) - clss[i] = Class.forName(intfs[i]); - cl = ClassLoader.getSystemClassLoader(); - } - else - for (int i = 0; i < intfs.length; i++) - clss[i] = cl.loadClass(intfs[i]); - try - { - return Proxy.getProxyClass(cl, clss); - } - catch (IllegalArgumentException e) - { - throw new ClassNotFoundException(null, e); - } - } - - /** - * If <code>enable</code> is <code>true</code> and this object is - * trusted, then <code>resolveObject (Object)</code> will be called - * in subsequent calls to <code>readObject (Object)</code>. - * Otherwise, <code>resolveObject (Object)</code> will not be called. - * - * @exception SecurityException This class is not trusted. - */ - protected boolean enableResolveObject (boolean enable) - throws SecurityException - { - if (enable) - { - SecurityManager sm = System.getSecurityManager(); - if (sm != null) - sm.checkPermission(new SerializablePermission("enableSubstitution")); - } - - boolean old_val = this.resolveEnabled; - this.resolveEnabled = enable; - return old_val; - } - - /** - * Reads stream magic and stream version information from the - * underlying stream. - * - * @exception IOException Exception from underlying stream. - * - * @exception StreamCorruptedException An invalid stream magic - * number or stream version was read from the stream. - */ - protected void readStreamHeader() - throws IOException, StreamCorruptedException - { - if(dump) dumpElement("STREAM MAGIC "); - if (this.realInputStream.readShort() != STREAM_MAGIC) - throw new StreamCorruptedException("Invalid stream magic number"); - - if(dump) dumpElementln("STREAM VERSION "); - if (this.realInputStream.readShort() != STREAM_VERSION) - throw new StreamCorruptedException("Invalid stream version number"); - } - - public int read() throws IOException - { - if (this.readDataFromBlock) - { - if (this.blockDataPosition >= this.blockDataBytes) - readNextBlock(); - return (this.blockData[this.blockDataPosition++] & 0xff); - } - else - return this.realInputStream.read(); - } - - public int read(byte[] data, int offset, int length) throws IOException - { - if (this.readDataFromBlock) - { - if (this.blockDataPosition + length > this.blockDataBytes) - { - int remain = this.blockDataBytes - this.blockDataPosition; - if (remain != 0) - { - System.arraycopy(this.blockData, this.blockDataPosition, - data, offset, remain); - offset += remain; - length -= remain; - } - readNextBlock (); - } - - System.arraycopy(this.blockData, this.blockDataPosition, - data, offset, length); - this.blockDataPosition += length; - - return length; - } - else - return this.realInputStream.read(data, offset, length); - } - - public int available() throws IOException - { - if (this.readDataFromBlock) - { - if (this.blockDataPosition >= this.blockDataBytes) - readNextBlock (); - - return this.blockDataBytes - this.blockDataPosition; - } - else - return this.realInputStream.available(); - } - - public void close() throws IOException - { - this.realInputStream.close(); - } - - public boolean readBoolean() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode (true); - boolean value = this.dataInputStream.readBoolean (); - if (switchmode) - setBlockDataMode (oldmode); - return value; - } - - public byte readByte() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - byte value = this.dataInputStream.readByte(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public int readUnsignedByte() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 1) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - int value = this.dataInputStream.readUnsignedByte(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public short readShort() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - short value = this.dataInputStream.readShort(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public int readUnsignedShort() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - int value = this.dataInputStream.readUnsignedShort(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public char readChar() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 2) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - char value = this.dataInputStream.readChar(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public int readInt() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 4) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - int value = this.dataInputStream.readInt(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public long readLong() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 8) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - long value = this.dataInputStream.readLong(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public float readFloat() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 4) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - float value = this.dataInputStream.readFloat(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public double readDouble() throws IOException - { - boolean switchmode = true; - boolean oldmode = this.readDataFromBlock; - if (!oldmode || this.blockDataBytes - this.blockDataPosition >= 8) - switchmode = false; - if (switchmode) - oldmode = setBlockDataMode(true); - double value = this.dataInputStream.readDouble(); - if (switchmode) - setBlockDataMode(oldmode); - return value; - } - - public void readFully(byte data[]) throws IOException - { - this.dataInputStream.readFully(data); - } - - public void readFully(byte data[], int offset, int size) - throws IOException - { - this.dataInputStream.readFully(data, offset, size); - } - - public int skipBytes(int len) throws IOException - { - return this.dataInputStream.skipBytes(len); - } - - /** - * @deprecated - * @see java.io.DataInputStream#readLine () - */ - public String readLine() throws IOException - { - return this.dataInputStream.readLine(); - } - - public String readUTF() throws IOException - { - return this.dataInputStream.readUTF(); - } - - /** - * This class allows a class to specify exactly which fields should - * be read, and what values should be read for these fields. - * - * XXX: finish up comments - */ - public abstract static class GetField - { - public abstract ObjectStreamClass getObjectStreamClass(); - - public abstract boolean defaulted(String name) - throws IOException, IllegalArgumentException; - - public abstract boolean get(String name, boolean defvalue) - throws IOException, IllegalArgumentException; - - public abstract char get(String name, char defvalue) - throws IOException, IllegalArgumentException; - - public abstract byte get(String name, byte defvalue) - throws IOException, IllegalArgumentException; - - public abstract short get(String name, short defvalue) - throws IOException, IllegalArgumentException; - - public abstract int get(String name, int defvalue) - throws IOException, IllegalArgumentException; - - public abstract long get(String name, long defvalue) - throws IOException, IllegalArgumentException; - - public abstract float get(String name, float defvalue) - throws IOException, IllegalArgumentException; - - public abstract double get(String name, double defvalue) - throws IOException, IllegalArgumentException; - - public abstract Object get(String name, Object defvalue) - throws IOException, IllegalArgumentException; - } - - /** - * This method should be called by a method called 'readObject' in the - * deserializing class (if present). It cannot (and should not)be called - * outside of it. Its goal is to read all fields in the real input stream - * and keep them accessible through the {@link #GetField} class. Calling - * this method will not alter the deserializing object. - * - * @return A valid freshly created 'GetField' instance to get access to - * the deserialized stream. - * @throws IOException An input/output exception occured. - * @throws ClassNotFoundException - * @throws NotActiveException - */ - public GetField readFields() - throws IOException, ClassNotFoundException, NotActiveException - { - if (this.currentObject == null || this.currentObjectStreamClass == null) - throw new NotActiveException("readFields called by non-active class and/or object"); - - if (prereadFields != null) - return prereadFields; - - if (fieldsAlreadyRead) - throw new NotActiveException("readFields called but fields already read from" - + " stream (by defaultReadObject or readFields)"); - - final ObjectStreamClass clazz = this.currentObjectStreamClass; - final byte[] prim_field_data = new byte[clazz.primFieldSize]; - final Object[] objs = new Object[clazz.objectFieldCount]; - - // Apparently Block data is not used with GetField as per - // empirical evidence against JDK 1.2. Also see Mauve test - // java.io.ObjectInputOutput.Test.GetPutField. - boolean oldmode = setBlockDataMode(false); - readFully(prim_field_data); - for (int i = 0; i < objs.length; ++ i) - objs[i] = readObject(); - setBlockDataMode(oldmode); - - prereadFields = new GetField() - { - public ObjectStreamClass getObjectStreamClass() - { - return clazz; - } - - public boolean defaulted(String name) - throws IOException, IllegalArgumentException - { - ObjectStreamField f = clazz.getField(name); - - /* First if we have a serialized field use the descriptor */ - if (f != null) - { - /* It is in serialPersistentFields but setClass tells us - * it should not be set. This value is defaulted. - */ - if (f.isPersistent() && !f.isToSet()) - return true; - - return false; - } - - /* This is not a serialized field. There should be - * a default value only if the field really exists. - */ - try - { - return (clazz.forClass().getDeclaredField (name) != null); - } - catch (NoSuchFieldException e) - { - throw new IllegalArgumentException(e.getMessage()); - } - } - - public boolean get(String name, boolean defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Boolean.TYPE); - - if (field == null) - return defvalue; - - return prim_field_data[field.getOffset()] == 0 ? false : true; - } - - public char get(String name, char defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Character.TYPE); - - if (field == null) - return defvalue; - - int off = field.getOffset(); - - return (char)(((prim_field_data[off++] & 0xFF) << 8) - | (prim_field_data[off] & 0xFF)); - } - - public byte get(String name, byte defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Byte.TYPE); - - if (field == null) - return defvalue; - - return prim_field_data[field.getOffset()]; - } - - public short get(String name, short defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Short.TYPE); - - if (field == null) - return defvalue; - - int off = field.getOffset(); - - return (short)(((prim_field_data[off++] & 0xFF) << 8) - | (prim_field_data[off] & 0xFF)); - } - - public int get(String name, int defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Integer.TYPE); - - if (field == null) - return defvalue; - - int off = field.getOffset(); - - return ((prim_field_data[off++] & 0xFF) << 24) - | ((prim_field_data[off++] & 0xFF) << 16) - | ((prim_field_data[off++] & 0xFF) << 8) - | (prim_field_data[off] & 0xFF); - } - - public long get(String name, long defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Long.TYPE); - - if (field == null) - return defvalue; - - int off = field.getOffset(); - - return (long)(((prim_field_data[off++] & 0xFFL) << 56) - | ((prim_field_data[off++] & 0xFFL) << 48) - | ((prim_field_data[off++] & 0xFFL) << 40) - | ((prim_field_data[off++] & 0xFFL) << 32) - | ((prim_field_data[off++] & 0xFF) << 24) - | ((prim_field_data[off++] & 0xFF) << 16) - | ((prim_field_data[off++] & 0xFF) << 8) - | (prim_field_data[off] & 0xFF)); - } - - public float get(String name, float defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Float.TYPE); - - if (field == null) - return defvalue; - - int off = field.getOffset(); - - return Float.intBitsToFloat(((prim_field_data[off++] & 0xFF) << 24) - | ((prim_field_data[off++] & 0xFF) << 16) - | ((prim_field_data[off++] & 0xFF) << 8) - | (prim_field_data[off] & 0xFF)); - } - - public double get(String name, double defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = getField(name, Double.TYPE); - - if (field == null) - return defvalue; - - int off = field.getOffset(); - - return Double.longBitsToDouble - ( (long) (((prim_field_data[off++] & 0xFFL) << 56) - | ((prim_field_data[off++] & 0xFFL) << 48) - | ((prim_field_data[off++] & 0xFFL) << 40) - | ((prim_field_data[off++] & 0xFFL) << 32) - | ((prim_field_data[off++] & 0xFF) << 24) - | ((prim_field_data[off++] & 0xFF) << 16) - | ((prim_field_data[off++] & 0xFF) << 8) - | (prim_field_data[off] & 0xFF))); - } - - public Object get(String name, Object defvalue) - throws IOException, IllegalArgumentException - { - ObjectStreamField field = - getField(name, defvalue == null ? null : defvalue.getClass ()); - - if (field == null) - return defvalue; - - return objs[field.getOffset()]; - } - - private ObjectStreamField getField(String name, Class type) - throws IllegalArgumentException - { - ObjectStreamField field = clazz.getField(name); - boolean illegal = false; - - try - { - try - { - Class field_type = field.getType(); - - if (type == field_type || - (type == null && !field_type.isPrimitive())) - { - /* See defaulted */ - return field; - } - - illegal = true; - throw new IllegalArgumentException - ("Field requested is of type " - + field_type.getName() - + ", but requested type was " - + (type == null ? "Object" : type.getName())); - } - catch (NullPointerException _) - { - /* Here we catch NullPointerException, because it may - only come from the call 'field.getType()'. If field - is null, we have to return null and classpath ethic - say we must try to avoid 'if (xxx == null)'. - */ - } - catch (IllegalArgumentException e) - { - throw e; - } - - return null; - } - finally - { - /* If this is an unassigned field we should return - * the default value. - */ - if (!illegal && field != null && !field.isToSet() && field.isPersistent()) - return null; - - /* We do not want to modify transient fields. They should - * be left to 0. - */ - try - { - Field f = clazz.forClass().getDeclaredField(name); - if (Modifier.isTransient(f.getModifiers())) - throw new IllegalArgumentException - ("no such field (non transient) " + name); - if (field == null && f.getType() != type) - throw new IllegalArgumentException - ("Invalid requested type for field " + name); - } - catch (NoSuchFieldException e) - { - if (field == null) - throw new IllegalArgumentException(e.getMessage()); - } - - } - } - }; - - fieldsAlreadyRead = true; - return prereadFields; - } - - /** - * Protected constructor that allows subclasses to override - * deserialization. This constructor should be called by subclasses - * that wish to override <code>readObject (Object)</code>. This - * method does a security check <i>NOTE: currently not - * implemented</i>, then sets a flag that informs - * <code>readObject (Object)</code> to call the subclasses - * <code>readObjectOverride (Object)</code> method. - * - * @see #readObjectOverride() - */ - protected ObjectInputStream() - throws IOException, SecurityException - { - SecurityManager sec_man = System.getSecurityManager(); - if (sec_man != null) - sec_man.checkPermission(SUBCLASS_IMPLEMENTATION_PERMISSION); - this.useSubclassMethod = true; - } - - /** - * This method allows subclasses to override the default - * de serialization mechanism provided by - * <code>ObjectInputStream</code>. To make this method be used for - * writing objects, subclasses must invoke the 0-argument - * constructor on this class from their constructor. - * - * @see #ObjectInputStream() - */ - protected Object readObjectOverride() - throws ClassNotFoundException, IOException, OptionalDataException - { - throw new IOException("Subclass of ObjectInputStream must implement readObjectOverride"); - } - - /** - * Assigns the next available handle to <code>obj</code>. - * - * @param obj The object for which we want a new handle. - * @return A valid handle for the specified object. - */ - private int assignNewHandle(Object obj) - { - this.objectLookupTable.put(new Integer(this.nextOID), - new ObjectIdentityWrapper(obj)); - return this.nextOID++; - } - - private Object processResolution(ObjectStreamClass osc, Object obj, int handle) - throws IOException - { - if (osc != null && obj instanceof Serializable) - { - try - { - Method m = osc.readResolveMethod; - if(m != null) - { - obj = m.invoke(obj, new Object[] {}); - } - } - catch (IllegalAccessException ignore) - { - } - catch (InvocationTargetException exception) - { - Throwable cause = exception.getCause(); - if (cause instanceof ObjectStreamException) - throw (ObjectStreamException) cause; - else if (cause instanceof RuntimeException) - throw (RuntimeException) cause; - else if (cause instanceof Error) - throw (Error) cause; - } - } - - if (this.resolveEnabled) - obj = resolveObject(obj); - - this.objectLookupTable.put(new Integer(handle), - new ObjectIdentityWrapper(obj)); - - return obj; - } - - private void clearHandles() - { - this.objectLookupTable.clear(); - this.nextOID = baseWireHandle; - } - - private void readNextBlock() throws IOException - { - readNextBlock(this.realInputStream.readByte()); - } - - private void readNextBlock(byte marker) throws IOException - { - if (marker == TC_BLOCKDATA) - { - if(dump) dumpElement("BLOCK DATA SIZE="); - this.blockDataBytes = this.realInputStream.readUnsignedByte(); - if(dump) dumpElementln (Integer.toString(this.blockDataBytes)); - } - else if (marker == TC_BLOCKDATALONG) - { - if(dump) dumpElement("BLOCK DATA LONG SIZE="); - this.blockDataBytes = this.realInputStream.readInt(); - if(dump) dumpElementln (Integer.toString(this.blockDataBytes)); - } - else - { - throw new EOFException("Attempt to read primitive data, but no data block is active."); - } - - if (this.blockData.length < this.blockDataBytes) - this.blockData = new byte[this.blockDataBytes]; - - this.realInputStream.readFully (this.blockData, 0, this.blockDataBytes); - this.blockDataPosition = 0; - } - - private void readArrayElements (Object array, Class clazz) - throws ClassNotFoundException, IOException - { - if (clazz.isPrimitive()) - { - if (clazz == Boolean.TYPE) - { - boolean[] cast_array = (boolean[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readBoolean(); - return; - } - if (clazz == Byte.TYPE) - { - byte[] cast_array = (byte[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readByte(); - return; - } - if (clazz == Character.TYPE) - { - char[] cast_array = (char[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readChar(); - return; - } - if (clazz == Double.TYPE) - { - double[] cast_array = (double[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readDouble(); - return; - } - if (clazz == Float.TYPE) - { - float[] cast_array = (float[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readFloat(); - return; - } - if (clazz == Integer.TYPE) - { - int[] cast_array = (int[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readInt(); - return; - } - if (clazz == Long.TYPE) - { - long[] cast_array = (long[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readLong(); - return; - } - if (clazz == Short.TYPE) - { - short[] cast_array = (short[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = this.realInputStream.readShort(); - return; - } - } - else - { - Object[] cast_array = (Object[])array; - for (int i=0; i < cast_array.length; i++) - cast_array[i] = readObject(); - } - } - - private void readFields (Object obj, ObjectStreamClass stream_osc) - throws ClassNotFoundException, IOException - { - ObjectStreamField[] fields = stream_osc.fieldMapping; - - for (int i = 0; i < fields.length; i += 2) - { - ObjectStreamField stream_field = fields[i]; - ObjectStreamField real_field = fields[i + 1]; - boolean read_value = (stream_field != null && stream_field.getOffset() >= 0 && stream_field.isToSet()); - boolean set_value = (real_field != null && real_field.isToSet()); - String field_name; - char type; - - if (stream_field != null) - { - field_name = stream_field.getName(); - type = stream_field.getTypeCode(); - } - else - { - field_name = real_field.getName(); - type = real_field.getTypeCode(); - } - - switch(type) - { - case 'Z': - { - boolean value = - read_value ? this.realInputStream.readBoolean() : false; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setBooleanField(obj, value); - break; - } - case 'B': - { - byte value = - read_value ? this.realInputStream.readByte() : 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setByteField(obj, value); - break; - } - case 'C': - { - char value = - read_value ? this.realInputStream.readChar(): 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setCharField(obj, value); - break; - } - case 'D': - { - double value = - read_value ? this.realInputStream.readDouble() : 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setDoubleField(obj, value); - break; - } - case 'F': - { - float value = - read_value ? this.realInputStream.readFloat() : 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setFloatField(obj, value); - break; - } - case 'I': - { - int value = - read_value ? this.realInputStream.readInt() : 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setIntField(obj, value); - break; - } - case 'J': - { - long value = - read_value ? this.realInputStream.readLong() : 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setLongField(obj, value); - break; - } - case 'S': - { - short value = - read_value ? this.realInputStream.readShort() : 0; - if (dump && read_value && set_value) - dumpElementln(" " + field_name + ": " + value); - if (set_value) - real_field.setShortField(obj, value); - break; - } - case 'L': - case '[': - { - Object value = - read_value ? readObject() : null; - if (set_value) - real_field.setObjectField(obj, value); - break; - } - default: - throw new InternalError("Invalid type code: " + type); - } - } - } - - // Toggles writing primitive data to block-data buffer. - private boolean setBlockDataMode (boolean on) - { - boolean oldmode = this.readDataFromBlock; - this.readDataFromBlock = on; - - if (on) - this.dataInputStream = this.blockDataInput; - else - this.dataInputStream = this.realInputStream; - return oldmode; - } - - // returns a new instance of REAL_CLASS that has been constructed - // only to the level of CONSTRUCTOR_CLASS (a super class of REAL_CLASS) - private Object newObject (Class real_class, Constructor constructor) - throws ClassNotFoundException, IOException - { - if (constructor == null) - throw new InvalidClassException("Missing accessible no-arg base class constructor for " + real_class.getName()); - try - { - return allocateObject(real_class, constructor.getDeclaringClass(), constructor); - } - catch (InstantiationException e) - { - throw new ClassNotFoundException - ("Instance of " + real_class + " could not be created"); - } - } - - // runs all registered ObjectInputValidations in prioritized order - // on OBJ - private void invokeValidators() throws InvalidObjectException - { - Object[] validators = new Object[this.validators.size()]; - this.validators.copyInto (validators); - Arrays.sort (validators); - - try - { - for (int i=0; i < validators.length; i++) - ((ObjectInputValidation)validators[i]).validateObject(); - } - finally - { - this.validators.removeAllElements(); - } - } - - private void callReadMethod (Method readObject, Class klass, Object obj) - throws ClassNotFoundException, IOException - { - try - { - readObject.invoke(obj, new Object[] { this }); - } - catch (InvocationTargetException x) - { - /* Rethrow if possible. */ - Throwable exception = x.getTargetException(); - if (exception instanceof RuntimeException) - throw (RuntimeException) exception; - if (exception instanceof IOException) - throw (IOException) exception; - if (exception instanceof ClassNotFoundException) - throw (ClassNotFoundException) exception; - - throw new IOException("Exception thrown from readObject() on " + - klass + ": " + exception.getClass().getName()); - } - catch (Exception x) - { - throw new IOException("Failure invoking readObject() on " + - klass + ": " + x.getClass().getName()); - } - - // Invalidate fields which has been read through readFields. - prereadFields = null; - } - - private native Object allocateObject(Class clazz, Class constr_clazz, Constructor constructor) - throws InstantiationException; - - private static final int BUFFER_SIZE = 1024; - - private DataInputStream realInputStream; - private DataInputStream dataInputStream; - private DataInputStream blockDataInput; - private int blockDataPosition; - private int blockDataBytes; - private byte[] blockData; - private boolean useSubclassMethod; - private int nextOID; - private boolean resolveEnabled; - private Hashtable objectLookupTable; - private Object currentObject; - private ObjectStreamClass currentObjectStreamClass; - private boolean readDataFromBlock; - private boolean isDeserializing; - private boolean fieldsAlreadyRead; - private Vector validators; - private Hashtable classLookupTable; - private GetField prereadFields; - - private ClassLoader callersClassLoader; - private static boolean dump; - - // The nesting depth for debugging output - private int depth = 0; - - private void dumpElement (String msg) - { - System.out.print(msg); - } - - private void dumpElementln (String msg) - { - System.out.println(msg); - for (int i = 0; i < depth; i++) - System.out.print (" "); - System.out.print (Thread.currentThread() + ": "); - } - - static - { - if (Configuration.INIT_LOAD_LIBRARY) - { - System.loadLibrary ("javaio"); - } - } - - // used to keep a prioritized list of object validators - private static final class ValidatorAndPriority implements Comparable - { - int priority; - ObjectInputValidation validator; - - ValidatorAndPriority (ObjectInputValidation validator, int priority) - { - this.priority = priority; - this.validator = validator; - } - - public int compareTo (Object o) - { - ValidatorAndPriority vap = (ValidatorAndPriority)o; - return this.priority - vap.priority; - } - } -} - diff --git a/libjava/java/io/ObjectInputValidation.h b/libjava/java/io/ObjectInputValidation.h new file mode 100644 index 0000000..6b0df7d --- /dev/null +++ b/libjava/java/io/ObjectInputValidation.h @@ -0,0 +1,19 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectInputValidation__ +#define __java_io_ObjectInputValidation__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectInputValidation : public ::java::lang::Object +{ + +public: + virtual void validateObject() = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_ObjectInputValidation__ diff --git a/libjava/java/io/ObjectOutput.h b/libjava/java/io/ObjectOutput.h new file mode 100644 index 0000000..ec45c01 --- /dev/null +++ b/libjava/java/io/ObjectOutput.h @@ -0,0 +1,37 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectOutput__ +#define __java_io_ObjectOutput__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::ObjectOutput : public ::java::lang::Object +{ + +public: + virtual void write(jint) = 0; + virtual void write(JArray< jbyte > *) = 0; + virtual void write(JArray< jbyte > *, jint, jint) = 0; + virtual void writeObject(::java::lang::Object *) = 0; + virtual void flush() = 0; + virtual void close() = 0; + virtual void writeBoolean(jboolean) = 0; + virtual void writeByte(jint) = 0; + virtual void writeChar(jint) = 0; + virtual void writeShort(jint) = 0; + virtual void writeInt(jint) = 0; + virtual void writeLong(jlong) = 0; + virtual void writeFloat(jfloat) = 0; + virtual void writeDouble(jdouble) = 0; + virtual void writeBytes(::java::lang::String *) = 0; + virtual void writeChars(::java::lang::String *) = 0; + virtual void writeUTF(::java::lang::String *) = 0; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_ObjectOutput__ diff --git a/libjava/java/io/ObjectOutputStream$1.h b/libjava/java/io/ObjectOutputStream$1.h new file mode 100644 index 0000000..5890abf --- /dev/null +++ b/libjava/java/io/ObjectOutputStream$1.h @@ -0,0 +1,41 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectOutputStream$1__ +#define __java_io_ObjectOutputStream$1__ + +#pragma interface + +#include <java/io/ObjectOutputStream$PutField.h> +#include <gcj/array.h> + + +class java::io::ObjectOutputStream$1 : public ::java::io::ObjectOutputStream$PutField +{ + +public: // actually package-private + ObjectOutputStream$1(::java::io::ObjectOutputStream *); +private: + ::java::io::ObjectStreamField * getField(::java::lang::String *); +public: + void put(::java::lang::String *, jboolean); + void put(::java::lang::String *, jbyte); + void put(::java::lang::String *, jchar); + void put(::java::lang::String *, jdouble); + void put(::java::lang::String *, jfloat); + void put(::java::lang::String *, jint); + void put(::java::lang::String *, jlong); + void put(::java::lang::String *, jshort); + void put(::java::lang::String *, ::java::lang::Object *); + void write(::java::io::ObjectOutput *); +private: + void checkType(::java::io::ObjectStreamField *, jchar); + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::ObjectOutputStream$PutField)))) prim_field_data; + JArray< ::java::lang::Object * > * objs; +public: // actually package-private + ::java::io::ObjectOutputStream * this$0; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectOutputStream$1__ diff --git a/libjava/java/io/ObjectOutputStream$PutField.h b/libjava/java/io/ObjectOutputStream$PutField.h new file mode 100644 index 0000000..790bb0e --- /dev/null +++ b/libjava/java/io/ObjectOutputStream$PutField.h @@ -0,0 +1,29 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectOutputStream$PutField__ +#define __java_io_ObjectOutputStream$PutField__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectOutputStream$PutField : public ::java::lang::Object +{ + +public: + ObjectOutputStream$PutField(); + virtual void put(::java::lang::String *, jboolean) = 0; + virtual void put(::java::lang::String *, jbyte) = 0; + virtual void put(::java::lang::String *, jchar) = 0; + virtual void put(::java::lang::String *, jdouble) = 0; + virtual void put(::java::lang::String *, jfloat) = 0; + virtual void put(::java::lang::String *, jint) = 0; + virtual void put(::java::lang::String *, jlong) = 0; + virtual void put(::java::lang::String *, jshort) = 0; + virtual void put(::java::lang::String *, ::java::lang::Object *) = 0; + virtual void write(::java::io::ObjectOutput *) = 0; + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectOutputStream$PutField__ diff --git a/libjava/java/io/ObjectOutputStream.h b/libjava/java/io/ObjectOutputStream.h new file mode 100644 index 0000000..273f04b --- /dev/null +++ b/libjava/java/io/ObjectOutputStream.h @@ -0,0 +1,122 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectOutputStream__ +#define __java_io_ObjectOutputStream__ + +#pragma interface + +#include <java/io/OutputStream.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace io + { + class ObjectIdentityMap2Int; + } + namespace security + { + namespace action + { + class SetAccessibleAction; + } + } + } + } +} + +class java::io::ObjectOutputStream : public ::java::io::OutputStream +{ + +public: + ObjectOutputStream(::java::io::OutputStream *); + virtual void writeObject(::java::lang::Object *); +public: // actually protected + virtual void writeClassDescriptor(::java::io::ObjectStreamClass *); +public: + virtual void defaultWriteObject(); +private: + void markFieldsWritten(); +public: + virtual void reset(); +private: + void reset(jboolean); +public: + virtual void useProtocolVersion(jint); +public: // actually protected + virtual void annotateClass(::java::lang::Class *); + virtual void annotateProxyClass(::java::lang::Class *); + virtual ::java::lang::Object * replaceObject(::java::lang::Object *); + virtual jboolean enableReplaceObject(jboolean); + virtual void writeStreamHeader(); + ObjectOutputStream(); + virtual void writeObjectOverride(::java::lang::Object *); +public: + virtual void write(jint); + virtual void write(JArray< jbyte > *); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void flush(); +public: // actually protected + virtual void drain(); +public: + virtual void close(); + virtual void writeBoolean(jboolean); + virtual void writeByte(jint); + virtual void writeShort(jint); + virtual void writeChar(jint); + virtual void writeInt(jint); + virtual void writeLong(jlong); + virtual void writeFloat(jfloat); + virtual void writeDouble(jdouble); + virtual void writeBytes(::java::lang::String *); + virtual void writeChars(::java::lang::String *); + virtual void writeUTF(::java::lang::String *); + virtual ::java::io::ObjectOutputStream$PutField * putFields(); + virtual void writeFields(); +private: + void writeBlockDataHeader(jint); + jint findHandle(::java::lang::Object *); + jint assignNewHandle(::java::lang::Object *); + void clearHandles(); + void writeArraySizeAndElements(::java::lang::Object *, ::java::lang::Class *); + void writeFields(::java::lang::Object *, ::java::io::ObjectStreamClass *); + void writeFields(::java::lang::Object *, JArray< ::java::io::ObjectStreamField * > *); +public: // actually package-private + virtual jboolean setBlockDataMode(jboolean); +private: + void callWriteMethod(::java::lang::Object *, ::java::io::ObjectStreamClass *); + void dumpElementln(::java::lang::String *); + static const jint BUFFER_SIZE = 1024; + static jint defaultProtocolVersion; + ::java::io::DataOutputStream * __attribute__((aligned(__alignof__( ::java::io::OutputStream)))) dataOutput; + jboolean writeDataAsBlocks; + ::java::io::DataOutputStream * realOutput; + ::java::io::DataOutputStream * blockDataOutput; + JArray< jbyte > * blockData; + jint blockDataCount; + ::java::lang::Object * currentObject; +public: // actually package-private + ::java::io::ObjectStreamClass * currentObjectStreamClass; +private: + ::java::io::ObjectOutputStream$PutField * currentPutField; + jboolean fieldsAlreadyWritten; + jboolean replacementEnabled; + jboolean isSerializing; + jint nextOID; + ::gnu::java::io::ObjectIdentityMap2Int * OIDLookupTable; + jint protocolVersion; + jboolean useSubclassMethod; + ::gnu::java::security::action::SetAccessibleAction * setAccessible; + jint depth; + jboolean dump; + static const jboolean DEBUG = 0; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectOutputStream__ diff --git a/libjava/java/io/ObjectStreamClass$1.h b/libjava/java/io/ObjectStreamClass$1.h new file mode 100644 index 0000000..c57bb25 --- /dev/null +++ b/libjava/java/io/ObjectStreamClass$1.h @@ -0,0 +1,24 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamClass$1__ +#define __java_io_ObjectStreamClass$1__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamClass$1 : public ::java::lang::Object +{ + +public: // actually package-private + ObjectStreamClass$1(::java::io::ObjectStreamClass *); +public: + jint compare(::java::lang::Object *, ::java::lang::Object *); +public: // actually package-private + ::java::io::ObjectStreamClass * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamClass$1__ diff --git a/libjava/java/io/ObjectStreamClass$2.h b/libjava/java/io/ObjectStreamClass$2.h new file mode 100644 index 0000000..2152ca0 --- /dev/null +++ b/libjava/java/io/ObjectStreamClass$2.h @@ -0,0 +1,26 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamClass$2__ +#define __java_io_ObjectStreamClass$2__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamClass$2 : public ::java::lang::Object +{ + +public: // actually package-private + ObjectStreamClass$2(::java::io::ObjectStreamClass *, ::java::lang::reflect::Constructor *); +public: + ::java::lang::Object * run(); +public: // actually package-private + ::java::io::ObjectStreamClass * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0; +private: + ::java::lang::reflect::Constructor * val$c; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamClass$2__ diff --git a/libjava/java/io/ObjectStreamClass$InterfaceComparator.h b/libjava/java/io/ObjectStreamClass$InterfaceComparator.h new file mode 100644 index 0000000..7faddc7 --- /dev/null +++ b/libjava/java/io/ObjectStreamClass$InterfaceComparator.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamClass$InterfaceComparator__ +#define __java_io_ObjectStreamClass$InterfaceComparator__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamClass$InterfaceComparator : public ::java::lang::Object +{ + + ObjectStreamClass$InterfaceComparator(); +public: + jint compare(::java::lang::Object *, ::java::lang::Object *); +public: // actually package-private + ObjectStreamClass$InterfaceComparator(::java::io::ObjectStreamClass$InterfaceComparator *); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamClass$InterfaceComparator__ diff --git a/libjava/java/io/ObjectStreamClass$MemberComparator.h b/libjava/java/io/ObjectStreamClass$MemberComparator.h new file mode 100644 index 0000000..81a8ca4 --- /dev/null +++ b/libjava/java/io/ObjectStreamClass$MemberComparator.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamClass$MemberComparator__ +#define __java_io_ObjectStreamClass$MemberComparator__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamClass$MemberComparator : public ::java::lang::Object +{ + + ObjectStreamClass$MemberComparator(); +public: + jint compare(::java::lang::Object *, ::java::lang::Object *); +public: // actually package-private + ObjectStreamClass$MemberComparator(::java::io::ObjectStreamClass$MemberComparator *); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamClass$MemberComparator__ diff --git a/libjava/java/io/ObjectStreamClass.h b/libjava/java/io/ObjectStreamClass.h new file mode 100644 index 0000000..7638f7b --- /dev/null +++ b/libjava/java/io/ObjectStreamClass.h @@ -0,0 +1,113 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamClass__ +#define __java_io_ObjectStreamClass__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace io + { + class NullOutputStream; + } + } + } +} + +class java::io::ObjectStreamClass : public ::java::lang::Object +{ + +public: + static ::java::io::ObjectStreamClass * lookup(::java::lang::Class *); +public: // actually package-private + static ::java::io::ObjectStreamClass * lookupForClassObject(::java::lang::Class *); +public: + virtual ::java::lang::String * getName(); + virtual ::java::lang::Class * forClass(); + virtual jlong getSerialVersionUID(); + virtual JArray< ::java::io::ObjectStreamField * > * getFields(); + virtual ::java::io::ObjectStreamField * getField(::java::lang::String *); + virtual ::java::lang::String * toString(); +public: // actually package-private + virtual jboolean hasWriteMethod(); + virtual jboolean isSerializable(); + virtual jboolean isExternalizable(); + virtual jboolean isEnum(); + virtual ::java::io::ObjectStreamClass * getSuper(); + virtual JArray< ::java::io::ObjectStreamClass * > * hierarchy(); + virtual jint getFlags(); + ObjectStreamClass(::java::lang::String *, jlong, jbyte, JArray< ::java::io::ObjectStreamField * > *); + virtual void setClass(::java::lang::Class *, ::java::io::ObjectStreamClass *); + virtual void setSuperclass(::java::io::ObjectStreamClass *); + virtual void calculateOffsets(); +private: + ::java::lang::reflect::Method * findMethod(JArray< ::java::lang::reflect::Method * > *, ::java::lang::String *, JArray< ::java::lang::Class * > *, ::java::lang::Class *, jboolean); + static jboolean inSamePackage(::java::lang::Class *, ::java::lang::Class *); + static ::java::lang::reflect::Method * findAccessibleMethod(::java::lang::String *, ::java::lang::Class *); + static jboolean loadedByBootOrApplicationClassLoader(::java::lang::Class *); + void cacheMethods(); + ObjectStreamClass(::java::lang::Class *); + void setFlags(::java::lang::Class *); + void setFields(::java::lang::Class *); + jlong getClassUID(::java::lang::Class *); +public: // actually package-private + virtual jlong getClassUIDFromField(::java::lang::Class *); + virtual jlong calculateClassUID(::java::lang::Class *); +private: + JArray< ::java::io::ObjectStreamField * > * getSerialPersistentFields(::java::lang::Class *); +public: // actually package-private + virtual ::java::io::Externalizable * newInstance(); + static JArray< ::java::io::ObjectStreamField * > * INVALID_FIELDS; +private: + JArray< ::java::io::ObjectStreamClass * > * __attribute__((aligned(__alignof__( ::java::lang::Object)))) hierarchy__; +public: // actually package-private + static JArray< ::java::lang::Class * > * noArgs; + static ::java::util::Hashtable * methodCache; + static JArray< ::java::lang::Class * > * readObjectSignature; + static JArray< ::java::lang::Class * > * writeObjectSignature; + static ::java::util::Hashtable * uidCache; +public: + static JArray< ::java::io::ObjectStreamField * > * NO_FIELDS; +private: + static ::java::util::Hashtable * classLookupTable; + static ::gnu::java::io::NullOutputStream * nullOutputStream; + static ::java::util::Comparator * interfaceComparator; + static ::java::util::Comparator * memberComparator; + static JArray< ::java::lang::Class * > * writeMethodArgTypes; + ::java::io::ObjectStreamClass * superClass; + ::java::lang::Class * clazz; + ::java::lang::String * name; + jlong uid; + jbyte flags; +public: // actually package-private + JArray< ::java::io::ObjectStreamField * > * fields; + jint primFieldSize; + jint objectFieldCount; + ::java::lang::reflect::Method * readObjectMethod; + ::java::lang::reflect::Method * readResolveMethod; + ::java::lang::reflect::Method * writeReplaceMethod; + ::java::lang::reflect::Method * writeObjectMethod; + jboolean realClassIsSerializable; + jboolean realClassIsExternalizable; + JArray< ::java::io::ObjectStreamField * > * fieldMapping; + ::java::lang::reflect::Constructor * firstNonSerializableParentConstructor; +private: + ::java::lang::reflect::Constructor * constructor; +public: // actually package-private + jboolean isProxyClass; +private: + static const jlong serialVersionUID = -6120832682080437368LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamClass__ diff --git a/libjava/java/io/ObjectStreamConstants.h b/libjava/java/io/ObjectStreamConstants.h new file mode 100644 index 0000000..f4e9508 --- /dev/null +++ b/libjava/java/io/ObjectStreamConstants.h @@ -0,0 +1,47 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamConstants__ +#define __java_io_ObjectStreamConstants__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamConstants : public ::java::lang::Object +{ + +public: + static const jint PROTOCOL_VERSION_1 = 1; + static const jint PROTOCOL_VERSION_2 = 2; + static const jshort STREAM_MAGIC = -21267; + static const jshort STREAM_VERSION = 5; + static const jbyte TC_NULL = 112; + static const jbyte TC_REFERENCE = 113; + static const jbyte TC_CLASSDESC = 114; + static const jbyte TC_OBJECT = 115; + static const jbyte TC_STRING = 116; + static const jbyte TC_ARRAY = 117; + static const jbyte TC_CLASS = 118; + static const jbyte TC_BLOCKDATA = 119; + static const jbyte TC_ENDBLOCKDATA = 120; + static const jbyte TC_RESET = 121; + static const jbyte TC_BLOCKDATALONG = 122; + static const jbyte TC_EXCEPTION = 123; + static const jbyte TC_LONGSTRING = 124; + static const jbyte TC_PROXYCLASSDESC = 125; + static const jbyte TC_ENUM = 126; + static const jbyte TC_BASE = 112; + static const jbyte TC_MAX = 126; + static const jint baseWireHandle = 8257536; + static const jbyte SC_WRITE_METHOD = 1; + static const jbyte SC_SERIALIZABLE = 2; + static const jbyte SC_EXTERNALIZABLE = 4; + static const jbyte SC_BLOCK_DATA = 8; + static const jbyte SC_ENUM = 16; + static ::java::io::SerializablePermission * SUBSTITUTION_PERMISSION; + static ::java::io::SerializablePermission * SUBCLASS_IMPLEMENTATION_PERMISSION; + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_ObjectStreamConstants__ diff --git a/libjava/java/io/ObjectStreamException.h b/libjava/java/io/ObjectStreamException.h new file mode 100644 index 0000000..4ce5833 --- /dev/null +++ b/libjava/java/io/ObjectStreamException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamException__ +#define __java_io_ObjectStreamException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::ObjectStreamException : public ::java::io::IOException +{ + +public: // actually protected + ObjectStreamException(); + ObjectStreamException(::java::lang::String *); +private: + static const jlong serialVersionUID = 7260898174833392607LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamException__ diff --git a/libjava/java/io/ObjectStreamField$1.h b/libjava/java/io/ObjectStreamField$1.h new file mode 100644 index 0000000..e17f3c1 --- /dev/null +++ b/libjava/java/io/ObjectStreamField$1.h @@ -0,0 +1,26 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamField$1__ +#define __java_io_ObjectStreamField$1__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamField$1 : public ::java::lang::Object +{ + +public: // actually package-private + ObjectStreamField$1(::java::io::ObjectStreamField *, ::java::lang::reflect::Field *); +public: + ::java::lang::Object * run(); +public: // actually package-private + ::java::io::ObjectStreamField * __attribute__((aligned(__alignof__( ::java::lang::Object)))) this$0; +private: + ::java::lang::reflect::Field * val$f; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamField$1__ diff --git a/libjava/java/io/ObjectStreamField.h b/libjava/java/io/ObjectStreamField.h new file mode 100644 index 0000000..5b3116f --- /dev/null +++ b/libjava/java/io/ObjectStreamField.h @@ -0,0 +1,67 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_ObjectStreamField__ +#define __java_io_ObjectStreamField__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::ObjectStreamField : public ::java::lang::Object +{ + +public: // actually package-private + ObjectStreamField(::java::lang::reflect::Field *); +public: + ObjectStreamField(::java::lang::String *, ::java::lang::Class *); + ObjectStreamField(::java::lang::String *, ::java::lang::Class *, jboolean); +public: // actually package-private + ObjectStreamField(::java::lang::String *, ::java::lang::String *); + virtual void resolveType(::java::lang::ClassLoader *); +public: + virtual ::java::lang::String * getName(); + virtual ::java::lang::Class * getType(); + virtual jchar getTypeCode(); + virtual ::java::lang::String * getTypeString(); + virtual jint getOffset(); +public: // actually protected + virtual void setOffset(jint); +public: + virtual jboolean isUnshared(); + virtual jboolean isPrimitive(); + virtual jint compareTo(::java::lang::Object *); +public: // actually package-private + virtual void setPersistent(jboolean); + virtual jboolean isPersistent(); + virtual void setToSet(jboolean); + virtual jboolean isToSet(); + virtual void lookupField(::java::lang::Class *); + virtual void checkFieldType(); +public: + virtual ::java::lang::String * toString(); +public: // actually package-private + virtual void setBooleanField(::java::lang::Object *, jboolean); + virtual void setByteField(::java::lang::Object *, jbyte); + virtual void setCharField(::java::lang::Object *, jchar); + virtual void setShortField(::java::lang::Object *, jshort); + virtual void setIntField(::java::lang::Object *, jint); + virtual void setLongField(::java::lang::Object *, jlong); + virtual void setFloatField(::java::lang::Object *, jfloat); + virtual void setDoubleField(::java::lang::Object *, jdouble); + virtual void setObjectField(::java::lang::Object *, ::java::lang::Object *); +private: + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::lang::Object)))) name; + ::java::lang::Class * type; + ::java::lang::String * typename$; + jint offset; + jboolean unshared; + jboolean persistent; + jboolean toset; +public: // actually package-private + ::java::lang::reflect::Field * field; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_ObjectStreamField__ diff --git a/libjava/java/io/OptionalDataException.h b/libjava/java/io/OptionalDataException.h new file mode 100644 index 0000000..b12a839 --- /dev/null +++ b/libjava/java/io/OptionalDataException.h @@ -0,0 +1,24 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_OptionalDataException__ +#define __java_io_OptionalDataException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::OptionalDataException : public ::java::io::ObjectStreamException +{ + +public: // actually package-private + OptionalDataException(jboolean, jint); +private: + static const jlong serialVersionUID = -8011121865681257820LL; +public: + jboolean __attribute__((aligned(__alignof__( ::java::io::ObjectStreamException)))) eof; + jint length; + static ::java::lang::Class class$; +}; + +#endif // __java_io_OptionalDataException__ diff --git a/libjava/java/io/OutputStream.h b/libjava/java/io/OutputStream.h new file mode 100644 index 0000000..28f1585 --- /dev/null +++ b/libjava/java/io/OutputStream.h @@ -0,0 +1,26 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_OutputStream__ +#define __java_io_OutputStream__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::OutputStream : public ::java::lang::Object +{ + +public: + OutputStream(); + virtual void write(jint) = 0; + virtual void write(JArray< jbyte > *); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void flush(); + virtual void close(); + static ::java::lang::Class class$; +}; + +#endif // __java_io_OutputStream__ diff --git a/libjava/java/io/OutputStreamWriter.h b/libjava/java/io/OutputStreamWriter.h new file mode 100644 index 0000000..8ad6c8e --- /dev/null +++ b/libjava/java/io/OutputStreamWriter.h @@ -0,0 +1,65 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_OutputStreamWriter__ +#define __java_io_OutputStreamWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + namespace convert + { + class UnicodeToBytes; + } + } + } + namespace java + { + namespace nio + { + namespace charset + { + class Charset; + class CharsetEncoder; + } + } + } +} + +class java::io::OutputStreamWriter : public ::java::io::Writer +{ + + OutputStreamWriter(::java::io::OutputStream *, ::gnu::gcj::convert::UnicodeToBytes *); +public: + OutputStreamWriter(::java::io::OutputStream *, ::java::lang::String *); + OutputStreamWriter(::java::io::OutputStream *); + OutputStreamWriter(::java::io::OutputStream *, ::java::nio::charset::Charset *); + OutputStreamWriter(::java::io::OutputStream *, ::java::nio::charset::CharsetEncoder *); + virtual void close(); + virtual ::java::lang::String * getEncoding(); + virtual void flush(); + virtual void write(JArray< jchar > *, jint, jint); +private: + void writeChars(JArray< jchar > *, jint, jint); +public: + virtual void write(::java::lang::String *, jint, jint); + virtual void write(jint); +public: // actually package-private + ::java::io::BufferedOutputStream * __attribute__((aligned(__alignof__( ::java::io::Writer)))) out; + ::gnu::gcj::convert::UnicodeToBytes * converter; +private: + JArray< jchar > * work; + jint wcount; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_OutputStreamWriter__ diff --git a/libjava/java/io/PipedInputStream.h b/libjava/java/io/PipedInputStream.h new file mode 100644 index 0000000..9531667 --- /dev/null +++ b/libjava/java/io/PipedInputStream.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PipedInputStream__ +#define __java_io_PipedInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + + +class java::io::PipedInputStream : public ::java::io::InputStream +{ + +public: + PipedInputStream(); + PipedInputStream(::java::io::PipedOutputStream *); + virtual void connect(::java::io::PipedOutputStream *); +public: // actually protected + virtual void receive(jint); +public: // actually package-private + virtual void receive(JArray< jbyte > *, jint, jint); +public: + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual jint available(); + virtual void close(); +public: // actually package-private + ::java::io::PipedOutputStream * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) source; + jboolean closed; +public: // actually protected + static const jint PIPE_SIZE = 1024; + JArray< jbyte > * buffer; + jint in; + jint out; +private: + JArray< jbyte > * read_buf; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PipedInputStream__ diff --git a/libjava/java/io/PipedOutputStream.h b/libjava/java/io/PipedOutputStream.h new file mode 100644 index 0000000..79e069e --- /dev/null +++ b/libjava/java/io/PipedOutputStream.h @@ -0,0 +1,31 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PipedOutputStream__ +#define __java_io_PipedOutputStream__ + +#pragma interface + +#include <java/io/OutputStream.h> +#include <gcj/array.h> + + +class java::io::PipedOutputStream : public ::java::io::OutputStream +{ + +public: + PipedOutputStream(); + PipedOutputStream(::java::io::PipedInputStream *); + virtual void connect(::java::io::PipedInputStream *); + virtual void write(jint); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void flush(); + virtual void close(); +public: // actually package-private + ::java::io::PipedInputStream * __attribute__((aligned(__alignof__( ::java::io::OutputStream)))) sink; + jboolean closed; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PipedOutputStream__ diff --git a/libjava/java/io/PipedReader.h b/libjava/java/io/PipedReader.h new file mode 100644 index 0000000..1eac2f7 --- /dev/null +++ b/libjava/java/io/PipedReader.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PipedReader__ +#define __java_io_PipedReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + + +class java::io::PipedReader : public ::java::io::Reader +{ + +public: + PipedReader(); + PipedReader(::java::io::PipedWriter *); + virtual void connect(::java::io::PipedWriter *); +public: // actually package-private + virtual void receive(JArray< jchar > *, jint, jint); +public: + virtual jint read(); + virtual jint read(JArray< jchar > *, jint, jint); + virtual jboolean ready(); + virtual void close(); +public: // actually package-private + ::java::io::PipedWriter * __attribute__((aligned(__alignof__( ::java::io::Reader)))) source; + jboolean closed; + static const jint PIPE_SIZE = 2048; + JArray< jchar > * buffer; + jint in; + jint out; + JArray< jchar > * read_buf; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PipedReader__ diff --git a/libjava/java/io/PipedWriter.h b/libjava/java/io/PipedWriter.h new file mode 100644 index 0000000..d1aac55 --- /dev/null +++ b/libjava/java/io/PipedWriter.h @@ -0,0 +1,32 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PipedWriter__ +#define __java_io_PipedWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + + +class java::io::PipedWriter : public ::java::io::Writer +{ + +public: + PipedWriter(); + PipedWriter(::java::io::PipedReader *); + virtual void connect(::java::io::PipedReader *); + virtual void write(jint); + virtual void write(JArray< jchar > *, jint, jint); + virtual void flush(); + virtual void close(); +public: // actually package-private + ::java::io::PipedReader * __attribute__((aligned(__alignof__( ::java::io::Writer)))) sink; + jboolean closed; + JArray< jchar > * read_buf; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PipedWriter__ diff --git a/libjava/java/io/PrintStream.h b/libjava/java/io/PrintStream.h new file mode 100644 index 0000000..3740fc7 --- /dev/null +++ b/libjava/java/io/PrintStream.h @@ -0,0 +1,89 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PrintStream__ +#define __java_io_PrintStream__ + +#pragma interface + +#include <java/io/FilterOutputStream.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace gcj + { + namespace convert + { + class UnicodeToBytes; + } + } + } +} + +class java::io::PrintStream : public ::java::io::FilterOutputStream +{ + +public: + PrintStream(::java::io::OutputStream *); + PrintStream(::java::io::OutputStream *, jboolean); + PrintStream(::java::io::OutputStream *, jboolean, ::java::lang::String *); + virtual jboolean checkError(); +public: // actually protected + virtual void setError(); +public: + virtual void close(); + virtual void flush(); +private: + void print(::java::lang::String *, jboolean); + void print(JArray< jchar > *, jint, jint, jboolean); + void writeChars(JArray< jchar > *, jint, jint); + void writeChars(::java::lang::String *, jint, jint); +public: + virtual void print(jboolean); + virtual void print(jint); + virtual void print(jlong); + virtual void print(jfloat); + virtual void print(jdouble); + virtual void print(::java::lang::Object *); + virtual void print(::java::lang::String *); + virtual void print(jchar); + virtual void print(JArray< jchar > *); + virtual void println(); + virtual void println(jboolean); + virtual void println(jint); + virtual void println(jlong); + virtual void println(jfloat); + virtual void println(jdouble); + virtual void println(::java::lang::Object *); + virtual void println(::java::lang::String *); + virtual void println(jchar); + virtual void println(JArray< jchar > *); + virtual void write(jint); + virtual void write(JArray< jbyte > *, jint, jint); + virtual ::java::io::PrintStream * target$append(jchar); + virtual ::java::io::PrintStream * target$append(::java::lang::CharSequence *); + virtual ::java::io::PrintStream * target$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::io::PrintStream * printf(::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::io::PrintStream * printf(::java::util::Locale *, ::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::io::PrintStream * format(::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::io::PrintStream * format(::java::util::Locale *, ::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *); + virtual ::java::lang::Appendable * append(jchar); +private: + static JArray< jchar > * line_separator; +public: // actually package-private + ::gnu::gcj::convert::UnicodeToBytes * __attribute__((aligned(__alignof__( ::java::io::FilterOutputStream)))) converter; + JArray< jchar > * work; + JArray< jbyte > * work_bytes; +private: + jboolean error_occurred; + jboolean auto_flush; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PrintStream__ diff --git a/libjava/java/io/PrintStream.java b/libjava/java/io/PrintStream.java index dc26eda..d3f386d 100644 --- a/libjava/java/io/PrintStream.java +++ b/libjava/java/io/PrintStream.java @@ -38,6 +38,9 @@ exception statement from your version. */ package java.io; +import java.util.Formatter; +import java.util.Locale; + import gnu.gcj.convert.UnicodeToBytes; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 @@ -58,7 +61,7 @@ import gnu.gcj.convert.UnicodeToBytes; * @author Aaron M. Renn (arenn@urbanophile.com) * @author Tom Tromey (tromey@cygnus.com) */ -public class PrintStream extends FilterOutputStream +public class PrintStream extends FilterOutputStream implements Appendable { /* Notice the implementation is quite similar to OutputStreamWriter. * This leads to some minor duplication, because neither inherits @@ -562,5 +565,52 @@ public class PrintStream extends FilterOutputStream setError (); } } + + /** @since 1.5 */ + public PrintStream append(char c) + { + print(c); + return this; + } + + /** @since 1.5 */ + public PrintStream append(CharSequence cs) + { + print(cs == null ? "null" : cs.toString()); + return this; + } + + /** @since 1.5 */ + public PrintStream append(CharSequence cs, int start, int end) + { + print(cs == null ? "null" : cs.subSequence(start, end).toString()); + return this; + } + + /** @since 1.5 */ + public PrintStream printf(String format, Object... args) + { + return format(format, args); + } + + /** @since 1.5 */ + public PrintStream printf(Locale locale, String format, Object... args) + { + return format(locale, format, args); + } + + /** @since 1.5 */ + public PrintStream format(String format, Object... args) + { + return format(Locale.getDefault(), format, args); + } + + /** @since 1.5 */ + public PrintStream format(Locale locale, String format, Object... args) + { + Formatter f = new Formatter(this, locale); + f.format(format, args); + return this; + } } // class PrintStream diff --git a/libjava/java/io/PrintWriter.h b/libjava/java/io/PrintWriter.h new file mode 100644 index 0000000..2cbbd04 --- /dev/null +++ b/libjava/java/io/PrintWriter.h @@ -0,0 +1,80 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PrintWriter__ +#define __java_io_PrintWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + + +class java::io::PrintWriter : public ::java::io::Writer +{ + +public: + PrintWriter(::java::io::Writer *); + PrintWriter(::java::io::Writer *, jboolean); + PrintWriter(::java::io::OutputStream *); + PrintWriter(::java::io::OutputStream *, jboolean); + PrintWriter(::java::lang::String *); + PrintWriter(::java::lang::String *, ::java::lang::String *); + PrintWriter(::java::io::File *); + PrintWriter(::java::io::File *, ::java::lang::String *); +public: // actually protected + virtual void setError(); +public: + virtual jboolean checkError(); + virtual void flush(); + virtual void close(); + virtual void print(::java::lang::String *); + virtual void print(jchar); + virtual void print(JArray< jchar > *); + virtual void print(jboolean); + virtual void print(jint); + virtual void print(jlong); + virtual void print(jfloat); + virtual void print(jdouble); + virtual void print(::java::lang::Object *); + virtual void println(); + virtual void println(jboolean); + virtual void println(jint); + virtual void println(jlong); + virtual void println(jfloat); + virtual void println(jdouble); + virtual void println(::java::lang::Object *); + virtual void println(::java::lang::String *); + virtual void println(jchar); + virtual void println(JArray< jchar > *); + virtual void write(jint); + virtual void write(JArray< jchar > *, jint, jint); + virtual void write(::java::lang::String *, jint, jint); + virtual void write(JArray< jchar > *); + virtual void write(::java::lang::String *); + virtual ::java::io::PrintWriter * target$append(jchar); + virtual ::java::io::PrintWriter * target$append(::java::lang::CharSequence *); + virtual ::java::io::PrintWriter * target$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::io::PrintWriter * printf(::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::io::PrintWriter * printf(::java::util::Locale *, ::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::io::PrintWriter * format(::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::io::PrintWriter * format(::java::util::Locale *, ::java::lang::String *, JArray< ::java::lang::Object * > *); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *); + virtual ::java::lang::Appendable * append(jchar); + virtual ::java::io::Writer * target$append(jchar); +private: + jboolean __attribute__((aligned(__alignof__( ::java::io::Writer)))) autoflush; + jboolean error; + jboolean closed; +public: // actually protected + ::java::io::Writer * out; +private: + static JArray< jchar > * line_separator; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PrintWriter__ diff --git a/libjava/java/io/PushbackInputStream.h b/libjava/java/io/PushbackInputStream.h new file mode 100644 index 0000000..032bfce --- /dev/null +++ b/libjava/java/io/PushbackInputStream.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PushbackInputStream__ +#define __java_io_PushbackInputStream__ + +#pragma interface + +#include <java/io/FilterInputStream.h> +#include <gcj/array.h> + + +class java::io::PushbackInputStream : public ::java::io::FilterInputStream +{ + +public: + PushbackInputStream(::java::io::InputStream *); + PushbackInputStream(::java::io::InputStream *, jint); + virtual jint available(); + virtual void close(); + virtual jboolean markSupported(); + virtual void reset(); + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void unread(jint); + virtual void unread(JArray< jbyte > *); + virtual void unread(JArray< jbyte > *, jint, jint); + virtual jlong skip(jlong); +private: + static const jint DEFAULT_BUFFER_SIZE = 1; +public: // actually protected + JArray< jbyte > * __attribute__((aligned(__alignof__( ::java::io::FilterInputStream)))) buf; + jint pos; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PushbackInputStream__ diff --git a/libjava/java/io/PushbackReader.h b/libjava/java/io/PushbackReader.h new file mode 100644 index 0000000..8d1c2ee --- /dev/null +++ b/libjava/java/io/PushbackReader.h @@ -0,0 +1,38 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_PushbackReader__ +#define __java_io_PushbackReader__ + +#pragma interface + +#include <java/io/FilterReader.h> +#include <gcj/array.h> + + +class java::io::PushbackReader : public ::java::io::FilterReader +{ + +public: + PushbackReader(::java::io::Reader *); + PushbackReader(::java::io::Reader *, jint); + virtual void close(); + virtual void mark(jint); + virtual jboolean markSupported(); + virtual void reset(); + virtual jboolean ready(); + virtual jlong skip(jlong); + virtual jint read(); + virtual jint read(JArray< jchar > *, jint, jint); + virtual void unread(jint); + virtual void unread(JArray< jchar > *); + virtual void unread(JArray< jchar > *, jint, jint); +private: + static const jint DEFAULT_BUFFER_SIZE = 1; + JArray< jchar > * __attribute__((aligned(__alignof__( ::java::io::FilterReader)))) buf; + jint pos; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_PushbackReader__ diff --git a/libjava/java/io/RandomAccessFile.h b/libjava/java/io/RandomAccessFile.h new file mode 100644 index 0000000..6b6076d --- /dev/null +++ b/libjava/java/io/RandomAccessFile.h @@ -0,0 +1,93 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_RandomAccessFile__ +#define __java_io_RandomAccessFile__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace gnu + { + namespace java + { + namespace nio + { + namespace channels + { + class FileChannelImpl; + } + } + } + } + namespace java + { + namespace nio + { + namespace channels + { + class FileChannel; + } + } + } +} + +class java::io::RandomAccessFile : public ::java::lang::Object +{ + +public: + RandomAccessFile(::java::io::File *, ::java::lang::String *); + RandomAccessFile(::java::lang::String *, ::java::lang::String *); + virtual void close(); + virtual ::java::io::FileDescriptor * getFD(); + virtual jlong getFilePointer(); + virtual void setLength(jlong); + virtual jlong length(); + virtual jint read(); + virtual jint read(JArray< jbyte > *); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual jboolean readBoolean(); + virtual jbyte readByte(); + virtual jchar readChar(); + virtual jdouble readDouble(); + virtual jfloat readFloat(); + virtual void readFully(JArray< jbyte > *); + virtual void readFully(JArray< jbyte > *, jint, jint); + virtual jint readInt(); + virtual ::java::lang::String * readLine(); + virtual jlong readLong(); + virtual jshort readShort(); + virtual jint readUnsignedByte(); + virtual jint readUnsignedShort(); + virtual ::java::lang::String * readUTF(); + virtual void seek(jlong); + virtual jint skipBytes(jint); + virtual void write(jint); + virtual void write(JArray< jbyte > *); + virtual void write(JArray< jbyte > *, jint, jint); + virtual void writeBoolean(jboolean); + virtual void writeByte(jint); + virtual void writeShort(jint); + virtual void writeChar(jint); + virtual void writeInt(jint); + virtual void writeLong(jlong); + virtual void writeFloat(jfloat); + virtual void writeDouble(jdouble); + virtual void writeBytes(::java::lang::String *); + virtual void writeChars(::java::lang::String *); + virtual void writeUTF(::java::lang::String *); + virtual ::java::nio::channels::FileChannel * getChannel(); +private: + ::gnu::java::nio::channels::FileChannelImpl * __attribute__((aligned(__alignof__( ::java::lang::Object)))) ch; + ::java::io::FileDescriptor * fd; + ::java::io::DataOutputStream * out; + ::java::io::DataInputStream * in; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_RandomAccessFile__ diff --git a/libjava/java/io/RandomAccessFile.java b/libjava/java/io/RandomAccessFile.java new file mode 100644 index 0000000..d719a1e --- /dev/null +++ b/libjava/java/io/RandomAccessFile.java @@ -0,0 +1,1036 @@ +/* RandomAccessFile.java -- Class supporting random file I/O + Copyright (C) 1998, 1999, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.io; + +import gnu.java.nio.channels.FileChannelImpl; + +import java.nio.channels.FileChannel; + +/* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 + * "The Java Language Specification", ISBN 0-201-63451-1 + * Status: Believe complete and correct to 1.1. + */ + +/** + * This class allows reading and writing of files at random locations. + * Most Java I/O classes are either pure sequential input or output. This + * class fulfills the need to be able to read the bytes of a file in an + * arbitrary order. In addition, this class implements the + * <code>DataInput</code> and <code>DataOutput</code> interfaces to allow + * the reading and writing of Java primitives. + * + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Tom Tromey (tromey@cygnus.com) + */ +public class RandomAccessFile implements DataOutput, DataInput, Closeable +{ + + // The underlying file. + private FileChannelImpl ch; + private FileDescriptor fd; + // The corresponding input and output streams. + private DataOutputStream out; + private DataInputStream in; + + + /** + * This method initializes a new instance of <code>RandomAccessFile</code> + * to read from the specified <code>File</code> object with the specified + * access mode. The access mode is either "r" for read only access or "rw" + * for read-write access. + * <p> + * Note that a <code>SecurityManager</code> check is made prior to + * opening the file to determine whether or not this file is allowed to + * be read or written. + * + * @param file The <code>File</code> object to read and/or write. + * @param mode "r" for read only or "rw" for read-write access to the file + * + * @exception IllegalArgumentException If <code>mode</code> has an + * illegal value + * @exception SecurityException If the requested access to the file + * is not allowed + * @exception FileNotFoundException If the file is a directory, or + * any other error occurs + */ + public RandomAccessFile (File file, String mode) + throws FileNotFoundException + { + int fdmode; + if (mode.equals("r")) + fdmode = FileChannelImpl.READ; + else if (mode.equals("rw")) + fdmode = FileChannelImpl.READ | FileChannelImpl.WRITE; + else if (mode.equals("rws")) + { + fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE + | FileChannelImpl.SYNC); + } + else if (mode.equals("rwd")) + { + fdmode = (FileChannelImpl.READ | FileChannelImpl.WRITE + | FileChannelImpl.DSYNC); + } + else + throw new IllegalArgumentException ("invalid mode: " + mode); + + final String fileName = file.getPath(); + + // The obligatory SecurityManager stuff + SecurityManager s = System.getSecurityManager(); + if (s != null) + { + s.checkRead(fileName); + + if ((fdmode & FileChannelImpl.WRITE) != 0) + s.checkWrite(fileName); + } + + ch = FileChannelImpl.create(file, fdmode); + fd = new FileDescriptor(ch); + if ((fdmode & FileChannelImpl.WRITE) != 0) + out = new DataOutputStream (new FileOutputStream (fd)); + else + out = null; + in = new DataInputStream (new FileInputStream (fd)); + } + + /** + * This method initializes a new instance of <code>RandomAccessFile</code> + * to read from the specified file name with the specified access mode. + * The access mode is either "r" for read only access, "rw" for read + * write access, "rws" for synchronized read/write access of both + * content and metadata, or "rwd" for read/write access + * where only content is required to be synchronous. + * <p> + * Note that a <code>SecurityManager</code> check is made prior to + * opening the file to determine whether or not this file is allowed to + * be read or written. + * + * @param fileName The name of the file to read and/or write + * @param mode "r", "rw", "rws", or "rwd" + * + * @exception IllegalArgumentException If <code>mode</code> has an + * illegal value + * @exception SecurityException If the requested access to the file + * is not allowed + * @exception FileNotFoundException If the file is a directory or + * any other error occurs + */ + public RandomAccessFile (String fileName, String mode) + throws FileNotFoundException + { + this (new File(fileName), mode); + } + + /** + * This method closes the file and frees up all file related system + * resources. Since most operating systems put a limit on how many files + * may be opened at any given time, it is a good idea to close all files + * when no longer needed to avoid hitting this limit + */ + public void close () throws IOException + { + ch.close(); + } + + /** + * This method returns a <code>FileDescriptor</code> object that + * represents the native file handle for this file. + * + * @return The <code>FileDescriptor</code> object for this file + * + * @exception IOException If an error occurs + */ + public final FileDescriptor getFD () throws IOException + { + synchronized (this) + { + if (fd == null) + fd = new FileDescriptor (ch); + return fd; + } + } + + /** + * This method returns the current offset in the file at which the next + * read or write will occur + * + * @return The current file position + * + * @exception IOException If an error occurs + */ + public long getFilePointer () throws IOException + { + return ch.position(); + } + + /** + * This method sets the length of the file to the specified length. + * If the currently length of the file is longer than the specified + * length, then the file is truncated to the specified length (the + * file position is set to the end of file in this case). If the + * current length of the file is shorter than the specified length, + * the file is extended with bytes of an undefined value (the file + * position is unchanged in this case). + * <p> + * The file must be open for write access for this operation to succeed. + * + * @param newLen The new length of the file + * + * @exception IOException If an error occurs + */ + public void setLength (long newLen) throws IOException + { + // FIXME: Extending a file should probably be done by one method call. + + // FileChannel.truncate() can only shrink a file. + // To expand it we need to seek forward and write at least one byte. + if (newLen < length()) + ch.truncate (newLen); + else if (newLen > length()) + { + long pos = getFilePointer(); + seek(newLen - 1); + write(0); + seek(pos); + } + } + + /** + * This method returns the length of the file in bytes + * + * @return The length of the file + * + * @exception IOException If an error occurs + */ + public long length () throws IOException + { + return ch.size(); + } + + /** + * This method reads a single byte of data from the file and returns it + * as an integer. + * + * @return The byte read as an int, or -1 if the end of the file was reached. + * + * @exception IOException If an error occurs + */ + public int read () throws IOException + { + return in.read(); + } + + /** + * This method reads bytes from the file into the specified array. The + * bytes are stored starting at the beginning of the array and up to + * <code>buf.length</code> bytes can be read. + * + * @param buffer The buffer to read bytes from the file into + * + * @return The actual number of bytes read or -1 if end of file + * + * @exception IOException If an error occurs + */ + public int read (byte[] buffer) throws IOException + { + return in.read (buffer); + } + + /** + * This methods reads up to <code>len</code> bytes from the file into the + * specified array starting at position <code>offset</code> into the array. + * + * @param buffer The array to read the bytes into + * @param offset The index into the array to start storing bytes + * @param len The requested number of bytes to read + * + * @return The actual number of bytes read, or -1 if end of file + * + * @exception IOException If an error occurs + */ + public int read (byte[] buffer, int offset, int len) throws IOException + { + return in.read (buffer, offset, len); + } + + /** + * This method reads a Java boolean value from an input stream. It does + * so by reading a single byte of data. If that byte is zero, then the + * value returned is <code>false</code> If the byte is non-zero, then + * the value returned is <code>true</code> + * <p> + * This method can read a <code>boolean</code> written by an object + * implementing the + * <code>writeBoolean()</code> method in the <code>DataOutput</code> + * interface. + * + * @return The <code>boolean</code> value read + * + * @exception EOFException If end of file is reached before reading the + * boolean + * @exception IOException If any other error occurs + */ + public final boolean readBoolean () throws IOException + { + return in.readBoolean (); + } + + /** + * This method reads a Java byte value from an input stream. The value + * is in the range of -128 to 127. + * <p> + * This method can read a <code>byte</code> written by an object + * implementing the + * <code>writeByte()</code> method in the <code>DataOutput</code> interface. + * + * @return The <code>byte</code> value read + * + * @exception EOFException If end of file is reached before reading the byte + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final byte readByte () throws IOException + { + return in.readByte (); + } + + /** + * This method reads a Java <code>char</code> value from an input stream. + * It operates by reading two bytes from the stream and converting them to + * a single 16-bit Java <code>char</code> The two bytes are stored most + * significant byte first (i.e., "big endian") regardless of the native + * host byte ordering. + * <p> + * As an example, if <code>byte1</code> and <code>byte2</code> represent + * the first + * and second byte read from the stream respectively, they will be + * transformed to a <code>char</code> in the following manner: + * <p> + * <code>(char)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF)</code> + * <p> + * This method can read a <code>char</code> written by an object + * implementing the + * <code>writeChar()</code> method in the <code>DataOutput</code> interface. + * + * @return The <code>char</code> value read + * + * @exception EOFException If end of file is reached before reading the char + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final char readChar () throws IOException + { + return in.readChar(); + } + + /** + * This method reads a Java double value from an input stream. It operates + * by first reading a <code>logn</code> value from the stream by calling the + * <code>readLong()</code> method in this interface, then + * converts that <code>long</code> + * to a <code>double</code> using the <code>longBitsToDouble</code> + * method in the class <code>java.lang.Double</code> + * <p> + * This method can read a <code>double</code> written by an object + * implementing the + * <code>writeDouble()</code> method in the <code>DataOutput</code> + * interface. + * + * @return The <code>double</code> value read + * + * @exception EOFException If end of file is reached before reading + * the double + * @exception IOException If any other error occurs + * + * @see java.lang.Double + * @see DataOutput + */ + public final double readDouble () throws IOException + { + return in.readDouble (); + } + + /** + * This method reads a Java float value from an input stream. It operates + * by first reading an <code>int</code> value from the stream by calling the + * <code>readInt()</code> method in this interface, then converts + * that <code>int</code> + * to a <code>float</code> using the <code>intBitsToFloat</code> method in + * the class <code>java.lang.Float</code> + * <p> + * This method can read a <code>float</code> written by an object + * implementing the + * <code>writeFloat()</code> method in the <code>DataOutput</code> interface. + * + * @return The <code>float</code> value read + * + * @exception EOFException If end of file is reached before reading the float + * @exception IOException If any other error occurs + * + * @see java.lang.Float + * @see DataOutput + */ + public final float readFloat () throws IOException + { + return in.readFloat(); + } + + /** + * This method reads raw bytes into the passed array until the array is + * full. Note that this method blocks until the data is available and + * throws an exception if there is not enough data left in the stream to + * fill the buffer + * + * @param buffer The buffer into which to read the data + * + * @exception EOFException If end of file is reached before filling the + * buffer + * @exception IOException If any other error occurs + */ + public final void readFully (byte[] buffer) throws IOException + { + in.readFully(buffer); + } + + /** + * This method reads raw bytes into the passed array <code>buf</code> + * starting + * <code>offset</code> bytes into the buffer. The number of bytes read + * will be + * exactly <code>len</code> Note that this method blocks until the data is + * available and throws an exception if there is not enough data left in + * the stream to read <code>len</code> bytes. + * + * @param buffer The buffer into which to read the data + * @param offset The offset into the buffer to start storing data + * @param count The number of bytes to read into the buffer + * + * @exception EOFException If end of file is reached before filling + * the buffer + * @exception IOException If any other error occurs + */ + public final void readFully (byte[] buffer, int offset, int count) + throws IOException + { + in.readFully (buffer, offset, count); + } + + /** + * This method reads a Java <code>int</code> value from an input stream + * It operates by reading four bytes from the stream and converting them to + * a single Java <code>int</code> The bytes are stored most + * significant byte first (i.e., "big endian") regardless of the native + * host byte ordering. + * <p> + * As an example, if <code>byte1</code> through <code>byte4</code> + * represent the first + * four bytes read from the stream, they will be + * transformed to an <code>int</code> in the following manner: + * <p> + * <code>(int)(((byte1 & 0xFF) << 24) + ((byte2 & 0xFF) << 16) + + * ((byte3 & 0xFF) << 8) + (byte4 & 0xFF)))</code> + * <p> + * The value returned is in the range of 0 to 65535. + * <p> + * This method can read an <code>int</code> written by an object + * implementing the + * <code>writeInt()</code> method in the <code>DataOutput</code> interface. + * + * @return The <code>int</code> value read + * + * @exception EOFException If end of file is reached before reading the int + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final int readInt () throws IOException + { + return in.readInt(); + } + + /** + * This method reads the next line of text data from an input stream. + * It operates by reading bytes and converting those bytes to + * <code>char</code> + * values by treating the byte read as the low eight bits of the + * <code>char</code> + * and using <code>0</code> as the high eight bits. Because of this, it does + * not support the full 16-bit Unicode character set. + * <p> + * The reading of bytes ends when either the end of file or a line terminator + * is encountered. The bytes read are then returned as a <code>String</code> + * A line terminator is a byte sequence consisting of either + * <code>\r</code> <code>\n</code> or <code>\r\n</code> These + * termination charaters are + * discarded and are not returned as part of the string. + * <p> + * This method can read data that was written by an object implementing the + * <code>writeLine()</code> method in <code>DataOutput</code> + * + * @return The line read as a <code>String</code> + * + * @exception IOException If an error occurs + * + * @see DataOutput + */ + public final String readLine () throws IOException + { + return in.readLine (); + } + + /** + * This method reads a Java long value from an input stream + * It operates by reading eight bytes from the stream and converting them to + * a single Java <code>long</code> The bytes are stored most + * significant byte first (i.e., "big endian") regardless of the native + * host byte ordering. + * <p> + * As an example, if <code>byte1</code> through <code>byte8</code> + * represent the first + * eight bytes read from the stream, they will be + * transformed to an <code>long</code> in the following manner: + * <p> + * <code> + * (long)((((long)byte1 & 0xFF) << 56) + (((long)byte2 & 0xFF) << 48) + + * (((long)byte3 & 0xFF) << 40) + (((long)byte4 & 0xFF) << 32) + + * (((long)byte5 & 0xFF) << 24) + (((long)byte6 & 0xFF) << 16) + + * (((long)byte7 & 0xFF) << 8) + ((long)byte9 & 0xFF)))</code> + * <p> + * The value returned is in the range of 0 to 65535. + * <p> + * This method can read an <code>long</code> written by an object + * implementing the + * <code>writeLong()</code> method in the <code>DataOutput</code> interface. + * + * @return The <code>long</code> value read + * + * @exception EOFException If end of file is reached before reading the long + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final long readLong () throws IOException + { + return in.readLong(); + } + + /** + * This method reads a signed 16-bit value into a Java in from the stream. + * It operates by reading two bytes from the stream and converting them to + * a single 16-bit Java <code>short</code> The two bytes are stored most + * significant byte first (i.e., "big endian") regardless of the native + * host byte ordering. + * <p> + * As an example, if <code>byte1</code> and <code>byte2</code> + * represent the first + * and second byte read from the stream respectively, they will be + * transformed to a <code>short</code> in the following manner: + * <p> + * <code>(short)(((byte1 & 0xFF) << 8) | (byte2 & 0xFF)</code> + * <p> + * The value returned is in the range of -32768 to 32767. + * <p> + * This method can read a <code>short</code> written by an object + * implementing the + * <code>writeShort()</code> method in the <code>DataOutput</code> interface. + * + * @return The <code>short</code> value read + * + * @exception EOFException If end of file is reached before reading the value + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final short readShort () throws IOException + { + return in.readShort(); + } + + /** + * This method reads 8 unsigned bits into a Java <code>int</code> value + * from the + * stream. The value returned is in the range of 0 to 255. + * <p> + * This method can read an unsigned byte written by an object implementing + * the <code>writeUnsignedByte()</code> method in the + * <code>DataOutput</code> interface. + * + * @return The unsigned bytes value read as a Java <code>int</code> + * + * @exception EOFException If end of file is reached before reading the value + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final int readUnsignedByte () throws IOException + { + return in.readUnsignedByte(); + } + + /** + * This method reads 16 unsigned bits into a Java int value from the stream. + * It operates by reading two bytes from the stream and converting them to + * a single Java <code>int</code> The two bytes are stored most + * significant byte first (i.e., "big endian") regardless of the native + * host byte ordering. + * <p> + * As an example, if <code>byte1</code> and <code>byte2</code> + * represent the first + * and second byte read from the stream respectively, they will be + * transformed to an <code>int</code> in the following manner: + * <p> + * <code>(int)(((byte1 & 0xFF) << 8) + (byte2 & 0xFF))</code> + * <p> + * The value returned is in the range of 0 to 65535. + * <p> + * This method can read an unsigned short written by an object implementing + * the <code>writeUnsignedShort()</code> method in the + * <code>DataOutput</code> interface. + * + * @return The unsigned short value read as a Java <code>int</code> + * + * @exception EOFException If end of file is reached before reading the value + * @exception IOException If any other error occurs + */ + public final int readUnsignedShort () throws IOException + { + return in.readUnsignedShort(); + } + + /** + * This method reads a <code>String</code> from an input stream that + * is encoded in + * a modified UTF-8 format. This format has a leading two byte sequence + * that contains the remaining number of bytes to read. This two byte + * sequence is read using the <code>readUnsignedShort()</code> method of this + * interface. + * <p> + * After the number of remaining bytes have been determined, these bytes + * are read an transformed into <code>char</code> values. + * These <code>char</code> values + * are encoded in the stream using either a one, two, or three byte format. + * The particular format in use can be determined by examining the first + * byte read. + * <p> + * If the first byte has a high order bit of 0 then + * that character consists on only one byte. This character value consists + * of seven bits that are at positions 0 through 6 of the byte. As an + * example, if <code>byte1</code> is the byte read from the stream, it would + * be converted to a <code>char</code> like so: + * <p> + * <code>(char)byte1</code> + * <p> + * If the first byte has <code>110</code> as its high order bits, then the + * character consists of two bytes. The bits that make up the character + * value are in positions 0 through 4 of the first byte and bit positions + * 0 through 5 of the second byte. (The second byte should have + * 10 as its high order bits). These values are in most significant + * byte first (i.e., "big endian") order. + * <p> + * As an example, if <code>byte1</code> and <code>byte2</code> + * are the first two bytes + * read respectively, and the high order bits of them match the patterns + * which indicate a two byte character encoding, then they would be + * converted to a Java <code>char</code> like so: + * <p> + * <code>(char)(((byte1 & 0x1F) << 6) | (byte2 & 0x3F))</code> + * <p> + * If the first byte has a <code>1110</code> as its high order bits, then the + * character consists of three bytes. The bits that make up the character + * value are in positions 0 through 3 of the first byte and bit positions + * 0 through 5 of the other two bytes. (The second and third bytes should + * have <code>10</code> as their high order bits). These values are in most + * significant byte first (i.e., "big endian") order. + * <p> + * As an example, if <code>byte1</code> <code>byte2</code> + * and <code>byte3</code> are the + * three bytes read, and the high order bits of them match the patterns + * which indicate a three byte character encoding, then they would be + * converted to a Java <code>char</code> like so: + * <p> + * <code>(char)(((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | + * (byte3 & 0x3F))</code> + * <p> + * Note that all characters are encoded in the method that requires the + * fewest number of bytes with the exception of the character with the + * value of <code>\u0000</code> which is encoded as two bytes. This is + * a modification of the UTF standard used to prevent C language style + * <code>NUL</code> values from appearing in the byte stream. + * <p> + * This method can read data that was written by an object implementing the + * <code>writeUTF()</code> method in <code>DataOutput</code> + * + * @return The <code>String</code> read + * + * @exception EOFException If end of file is reached before reading the + * String + * @exception UTFDataFormatException If the data is not in UTF-8 format + * @exception IOException If any other error occurs + * + * @see DataOutput + */ + public final String readUTF () throws IOException + { + return in.readUTF(); + } + + /** + * This method sets the current file position to the specified offset + * from the beginning of the file. Note that some operating systems will + * allow the file pointer to be set past the current end of the file. + * + * @param pos The offset from the beginning of the file at which to set + * the file pointer + * + * @exception IOException If an error occurs + */ + public void seek (long pos) throws IOException + { + ch.position(pos); + } + + /** + * This method attempts to skip and discard the specified number of bytes + * in the input stream. It may actually skip fewer bytes than requested. + * The actual number of bytes skipped is returned. This method will not + * skip any bytes if passed a negative number of bytes to skip. + * + * @param numBytes The requested number of bytes to skip. + * + * @return The number of bytes actually skipped. + * + * @exception IOException If an error occurs. + */ + public int skipBytes (int numBytes) throws IOException + { + if (numBytes < 0) + throw new IllegalArgumentException ("Can't skip negative bytes: " + + numBytes); + + if (numBytes == 0) + return 0; + + long oldPos = ch.position(); + long newPos = oldPos + numBytes; + long size = ch.size(); + if (newPos > size) + newPos = size; + ch.position(newPos); + return (int) (ch.position() - oldPos); + } + + /** + * This method writes a single byte of data to the file. The file must + * be open for read-write in order for this operation to succeed. + * + * @param oneByte The byte of data to write, passed as an int. + * + * @exception IOException If an error occurs + */ + public void write (int oneByte) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.write(oneByte); + } + + /** + * This method writes all the bytes in the specified array to the file. + * The file must be open read-write in order for this operation to succeed. + * + * @param buffer The array of bytes to write to the file + */ + public void write (byte[] buffer) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.write(buffer); + } + + /** + * This method writes <code>len</code> bytes to the file from the specified + * array starting at index <code>offset</code> into the array. + * + * @param buffer The array of bytes to write to the file + * @param offset The index into the array to start writing file + * @param len The number of bytes to write + * + * @exception IOException If an error occurs + */ + public void write (byte[] buffer, int offset, int len) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.write (buffer, offset, len); + } + + /** + * This method writes a Java <code>boolean</code> to the underlying output + * stream. For a value of <code>true</code>, 1 is written to the stream. + * For a value of <code>false</code>, 0 is written. + * + * @param val The <code>boolean</code> value to write to the stream + * + * @exception IOException If an error occurs + */ + public final void writeBoolean (boolean val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeBoolean(val); + } + + /** + * This method writes a Java <code>byte</code> value to the underlying + * output stream. + * + * @param val The <code>byte</code> to write to the stream, passed + * as an <code>int</code>. + * + * @exception IOException If an error occurs + */ + public final void writeByte (int val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeByte(val); + } + + /** + * This method writes a Java <code>short</code> to the stream, high byte + * first. This method requires two bytes to encode the value. + * + * @param val The <code>short</code> value to write to the stream, + * passed as an <code>int</code>. + * + * @exception IOException If an error occurs + */ + public final void writeShort (int val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeShort(val); + } + + /** + * This method writes a single <code>char</code> value to the stream, + * high byte first. + * + * @param val The <code>char</code> value to write, passed as + * an <code>int</code>. + * + * @exception IOException If an error occurs + */ + public final void writeChar (int val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeChar(val); + } + + /** + * This method writes a Java <code>int</code> to the stream, high bytes + * first. This method requires four bytes to encode the value. + * + * @param val The <code>int</code> value to write to the stream. + * + * @exception IOException If an error occurs + */ + public final void writeInt (int val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeInt(val); + } + + /** + * This method writes a Java <code>long</code> to the stream, high bytes + * first. This method requires eight bytes to encode the value. + * + * @param val The <code>long</code> value to write to the stream. + * + * @exception IOException If an error occurs + */ + public final void writeLong (long val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeLong(val); + } + + /** + * This method writes a Java <code>float</code> value to the stream. This + * value is written by first calling the method + * <code>Float.floatToIntBits</code> + * to retrieve an <code>int</code> representing the floating point number, + * then writing this <code>int</code> value to the stream exactly the same + * as the <code>writeInt()</code> method does. + * + * @param val The floating point number to write to the stream. + * + * @exception IOException If an error occurs + * + * @see #writeInt(int) + */ + public final void writeFloat (float val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeFloat(val); + } + + /** + * This method writes a Java <code>double</code> value to the stream. This + * value is written by first calling the method + * <code>Double.doubleToLongBits</code> + * to retrieve an <code>long</code> representing the floating point number, + * then writing this <code>long</code> value to the stream exactly the same + * as the <code>writeLong()</code> method does. + * + * @param val The double precision floating point number to write to the + * stream. + * + * @exception IOException If an error occurs + * + * @see #writeLong(long) + */ + public final void writeDouble (double val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeDouble(val); + } + + /** + * This method writes all the bytes in a <code>String</code> out to the + * stream. One byte is written for each character in the <code>String</code>. + * The high eight bits of each character are discarded. + * + * @param val The <code>String</code> to write to the stream + * + * @exception IOException If an error occurs + */ + public final void writeBytes (String val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeBytes(val); + } + + /** + * This method writes all the characters in a <code>String</code> to the + * stream. There will be two bytes for each character value. The high + * byte of the character will be written first. + * + * @param val The <code>String</code> to write to the stream. + * + * @exception IOException If an error occurs + */ + public final void writeChars (String val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeChars(val); + } + + /** + * This method writes a Java <code>String</code> to the stream in a modified + * UTF-8 format. First, two bytes are written to the stream indicating the + * number of bytes to follow. Note that this is the number of bytes in the + * encoded <code>String</code> not the <code>String</code> length. Next + * come the encoded characters. Each character in the <code>String</code> + * is encoded as either one, two or three bytes. For characters in the + * range of <code>\u0001</code> to <code>\u007F</code>, + * one byte is used. The character + * value goes into bits 0-7 and bit eight is 0. For characters in the range + * of <code>\u0080</code> to <code>\u007FF</code>, two + * bytes are used. Bits + * 6-10 of the character value are encoded bits 0-4 of the first byte, with + * the high bytes having a value of "110". Bits 0-5 of the character value + * are stored in bits 0-5 of the second byte, with the high bits set to + * "10". This type of encoding is also done for the null character + * <code>\u0000</code>. This eliminates any C style NUL character values + * in the output. All remaining characters are stored as three bytes. + * Bits 12-15 of the character value are stored in bits 0-3 of the first + * byte. The high bits of the first bytes are set to "1110". Bits 6-11 + * of the character value are stored in bits 0-5 of the second byte. The + * high bits of the second byte are set to "10". And bits 0-5 of the + * character value are stored in bits 0-5 of byte three, with the high bits + * of that byte set to "10". + * + * @param val The <code>String</code> to write to the output in UTF format + * + * @exception IOException If an error occurs + */ + public final void writeUTF (String val) throws IOException + { + if (out == null) + throw new IOException("Bad file descriptor"); + + out.writeUTF(val); + } + + /** + * This method creates a java.nio.channels.FileChannel. + * Nio does not allow one to create a file channel directly. + * A file channel must be created by first creating an instance of + * Input/Output/RandomAccessFile and invoking the getChannel() method on it. + */ + public final synchronized FileChannel getChannel () + { + return ch; + } +} diff --git a/libjava/java/io/Reader.h b/libjava/java/io/Reader.h new file mode 100644 index 0000000..678bc91 --- /dev/null +++ b/libjava/java/io/Reader.h @@ -0,0 +1,46 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_Reader__ +#define __java_io_Reader__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + +extern "Java" +{ + namespace java + { + namespace nio + { + class CharBuffer; + } + } +} + +class java::io::Reader : public ::java::lang::Object +{ + +public: // actually protected + Reader(); + Reader(::java::lang::Object *); +public: + virtual jint read(JArray< jchar > *, jint, jint) = 0; + virtual jint read(JArray< jchar > *); + virtual jint read(); + virtual jint read(::java::nio::CharBuffer *); + virtual void close() = 0; + virtual jboolean markSupported(); + virtual void mark(jint); + virtual void reset(); + virtual jboolean ready(); + virtual jlong skip(jlong); +public: // actually protected + ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) lock; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_Reader__ diff --git a/libjava/java/io/SequenceInputStream.h b/libjava/java/io/SequenceInputStream.h new file mode 100644 index 0000000..f5baa7d --- /dev/null +++ b/libjava/java/io/SequenceInputStream.h @@ -0,0 +1,32 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_SequenceInputStream__ +#define __java_io_SequenceInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + + +class java::io::SequenceInputStream : public ::java::io::InputStream +{ + +public: + SequenceInputStream(::java::util::Enumeration *); + SequenceInputStream(::java::io::InputStream *, ::java::io::InputStream *); + virtual jint available(); + virtual void close(); + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); +private: + ::java::io::InputStream * getNextStream(); + ::java::io::InputStream * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) in; + ::java::io::InputStream * in2; + ::java::util::Enumeration * e; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_SequenceInputStream__ diff --git a/libjava/java/io/Serializable.h b/libjava/java/io/Serializable.h new file mode 100644 index 0000000..12c36e5 --- /dev/null +++ b/libjava/java/io/Serializable.h @@ -0,0 +1,18 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_Serializable__ +#define __java_io_Serializable__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::Serializable : public ::java::lang::Object +{ + +public: + static ::java::lang::Class class$; +} __attribute__ ((java_interface)); + +#endif // __java_io_Serializable__ diff --git a/libjava/java/io/SerializablePermission.h b/libjava/java/io/SerializablePermission.h new file mode 100644 index 0000000..04c3dce --- /dev/null +++ b/libjava/java/io/SerializablePermission.h @@ -0,0 +1,27 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_SerializablePermission__ +#define __java_io_SerializablePermission__ + +#pragma interface + +#include <java/security/BasicPermission.h> +#include <gcj/array.h> + + +class java::io::SerializablePermission : public ::java::security::BasicPermission +{ + +public: + SerializablePermission(::java::lang::String *); + SerializablePermission(::java::lang::String *, ::java::lang::String *); +public: // actually package-private + static const jlong serialVersionUID = 8537212141160296410LL; +private: + static JArray< ::java::lang::String * > * legal_names; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_SerializablePermission__ diff --git a/libjava/java/io/StreamCorruptedException.h b/libjava/java/io/StreamCorruptedException.h new file mode 100644 index 0000000..79b0d02 --- /dev/null +++ b/libjava/java/io/StreamCorruptedException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_StreamCorruptedException__ +#define __java_io_StreamCorruptedException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::StreamCorruptedException : public ::java::io::ObjectStreamException +{ + +public: + StreamCorruptedException(); + StreamCorruptedException(::java::lang::String *); +private: + static const jlong serialVersionUID = 8983558202217591746LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_StreamCorruptedException__ diff --git a/libjava/java/io/StreamTokenizer.h b/libjava/java/io/StreamTokenizer.h new file mode 100644 index 0000000..ad9496c --- /dev/null +++ b/libjava/java/io/StreamTokenizer.h @@ -0,0 +1,72 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_StreamTokenizer__ +#define __java_io_StreamTokenizer__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::StreamTokenizer : public ::java::lang::Object +{ + +public: + StreamTokenizer(::java::io::InputStream *); + StreamTokenizer(::java::io::Reader *); + virtual void commentChar(jint); + virtual void eolIsSignificant(jboolean); + virtual jint lineno(); + virtual void lowerCaseMode(jboolean); +private: + jboolean isWhitespace(jint); + jboolean isAlphabetic(jint); + jboolean isNumeric(jint); + jboolean isQuote(jint); + jboolean isComment(jint); +public: + virtual jint nextToken(); +private: + void resetChar(jint); +public: + virtual void ordinaryChar(jint); + virtual void ordinaryChars(jint, jint); + virtual void parseNumbers(); + virtual void pushBack(); + virtual void quoteChar(jint); + virtual void resetSyntax(); + virtual void slashSlashComments(jboolean); + virtual void slashStarComments(jboolean); + virtual ::java::lang::String * toString(); + virtual void whitespaceChars(jint, jint); + virtual void wordChars(jint, jint); + static const jint TT_EOF = -1; + static const jint TT_EOL = 10; + static const jint TT_NUMBER = -2; + static const jint TT_WORD = -3; +private: + static const jint TT_NONE = -4; +public: + jint __attribute__((aligned(__alignof__( ::java::lang::Object)))) ttype; + ::java::lang::String * sval; + jdouble nval; +private: + jboolean eolSignificant; + jboolean lowerCase; + jboolean slashSlash; + jboolean slashStar; + JArray< jboolean > * whitespace; + JArray< jboolean > * alphabetic; + JArray< jboolean > * numeric; + JArray< jboolean > * quote; + JArray< jboolean > * comment; + ::java::io::PushbackReader * in; + jboolean pushedBack; + jint lineNumber; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_StreamTokenizer__ diff --git a/libjava/java/io/StringBufferInputStream.h b/libjava/java/io/StringBufferInputStream.h new file mode 100644 index 0000000..077bc4d --- /dev/null +++ b/libjava/java/io/StringBufferInputStream.h @@ -0,0 +1,31 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_StringBufferInputStream__ +#define __java_io_StringBufferInputStream__ + +#pragma interface + +#include <java/io/InputStream.h> +#include <gcj/array.h> + + +class java::io::StringBufferInputStream : public ::java::io::InputStream +{ + +public: + StringBufferInputStream(::java::lang::String *); + virtual jint available(); + virtual jint read(); + virtual jint read(JArray< jbyte > *, jint, jint); + virtual void reset(); + virtual jlong skip(jlong); +public: // actually protected + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::io::InputStream)))) buffer; + jint pos; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_StringBufferInputStream__ diff --git a/libjava/java/io/StringReader.h b/libjava/java/io/StringReader.h new file mode 100644 index 0000000..57a2d3f --- /dev/null +++ b/libjava/java/io/StringReader.h @@ -0,0 +1,35 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_StringReader__ +#define __java_io_StringReader__ + +#pragma interface + +#include <java/io/Reader.h> +#include <gcj/array.h> + + +class java::io::StringReader : public ::java::io::Reader +{ + +public: + StringReader(::java::lang::String *); + virtual void close(); + virtual void mark(jint); + virtual jboolean markSupported(); + virtual jint read(); + virtual jint read(JArray< jchar > *, jint, jint); + virtual jboolean ready(); + virtual void reset(); + virtual jlong skip(jlong); +private: + ::java::lang::String * __attribute__((aligned(__alignof__( ::java::io::Reader)))) buf; + jint pos; + jint markedPos; + jint count; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_StringReader__ diff --git a/libjava/java/io/StringWriter.h b/libjava/java/io/StringWriter.h new file mode 100644 index 0000000..16e6de5 --- /dev/null +++ b/libjava/java/io/StringWriter.h @@ -0,0 +1,43 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_StringWriter__ +#define __java_io_StringWriter__ + +#pragma interface + +#include <java/io/Writer.h> +#include <gcj/array.h> + + +class java::io::StringWriter : public ::java::io::Writer +{ + +public: + virtual void close(); + virtual void flush(); + virtual ::java::lang::StringBuffer * getBuffer(); + StringWriter(); + StringWriter(jint); + virtual ::java::lang::String * toString(); + virtual void write(jint); + virtual void write(JArray< jchar > *, jint, jint); + virtual void write(::java::lang::String *); + virtual void write(::java::lang::String *, jint, jint); + virtual ::java::io::StringWriter * target$append(jchar); + virtual ::java::io::StringWriter * target$append(::java::lang::CharSequence *); + virtual ::java::io::StringWriter * target$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *, jint, jint); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *, jint, jint); + virtual ::java::lang::Appendable * append(::java::lang::CharSequence *); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *); + virtual ::java::lang::Appendable * append(jchar); + virtual ::java::io::Writer * target$append(jchar); +private: + static const jint DEFAULT_BUFFER_SIZE = 16; + ::java::lang::StringBuffer * __attribute__((aligned(__alignof__( ::java::io::Writer)))) buffer; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_StringWriter__ diff --git a/libjava/java/io/SyncFailedException.h b/libjava/java/io/SyncFailedException.h new file mode 100644 index 0000000..1088ca2 --- /dev/null +++ b/libjava/java/io/SyncFailedException.h @@ -0,0 +1,22 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_SyncFailedException__ +#define __java_io_SyncFailedException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::SyncFailedException : public ::java::io::IOException +{ + +public: + SyncFailedException(::java::lang::String *); +private: + static const jlong serialVersionUID = -2353342684412443330LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_SyncFailedException__ diff --git a/libjava/java/io/UTFDataFormatException.h b/libjava/java/io/UTFDataFormatException.h new file mode 100644 index 0000000..48f8cf7 --- /dev/null +++ b/libjava/java/io/UTFDataFormatException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_UTFDataFormatException__ +#define __java_io_UTFDataFormatException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::UTFDataFormatException : public ::java::io::IOException +{ + +public: + UTFDataFormatException(); + UTFDataFormatException(::java::lang::String *); +private: + static const jlong serialVersionUID = 420743449228280612LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_UTFDataFormatException__ diff --git a/libjava/java/io/UnsupportedEncodingException.h b/libjava/java/io/UnsupportedEncodingException.h new file mode 100644 index 0000000..6291af2 --- /dev/null +++ b/libjava/java/io/UnsupportedEncodingException.h @@ -0,0 +1,23 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_UnsupportedEncodingException__ +#define __java_io_UnsupportedEncodingException__ + +#pragma interface + +#include <java/io/IOException.h> + +class java::io::UnsupportedEncodingException : public ::java::io::IOException +{ + +public: + UnsupportedEncodingException(); + UnsupportedEncodingException(::java::lang::String *); +private: + static const jlong serialVersionUID = -4274276298326136670LL; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_UnsupportedEncodingException__ diff --git a/libjava/java/io/VMObjectInputStream.h b/libjava/java/io/VMObjectInputStream.h new file mode 100644 index 0000000..307dd55 --- /dev/null +++ b/libjava/java/io/VMObjectInputStream.h @@ -0,0 +1,21 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_VMObjectInputStream__ +#define __java_io_VMObjectInputStream__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::VMObjectInputStream : public ::java::lang::Object +{ + +public: // actually package-private + VMObjectInputStream(); + static ::java::lang::Object * allocateObject(::java::lang::Class *, ::java::lang::Class *, ::java::lang::reflect::Constructor *); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_VMObjectInputStream__ diff --git a/libjava/java/io/VMObjectInputStream.java b/libjava/java/io/VMObjectInputStream.java new file mode 100644 index 0000000..77bdf71 --- /dev/null +++ b/libjava/java/io/VMObjectInputStream.java @@ -0,0 +1,56 @@ +/* ObjectInputStream.java -- Class used to read serialized objects + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.io; + +import gnu.classpath.Configuration; +import java.lang.reflect.Constructor; + +final class VMObjectInputStream +{ + /** + * Allocates a new Object of type clazz but without running the + * default constructor on it. It then calls the given constructor on + * it. The given constructor method comes from the constr_clazz + * which is a super class of the given clazz. + */ + static native Object allocateObject(Class clazz, Class constr_clazz, + Constructor constructor) + throws InstantiationException; +} diff --git a/libjava/java/io/VMObjectStreamClass.h b/libjava/java/io/VMObjectStreamClass.h new file mode 100644 index 0000000..5f2ef2c --- /dev/null +++ b/libjava/java/io/VMObjectStreamClass.h @@ -0,0 +1,30 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_VMObjectStreamClass__ +#define __java_io_VMObjectStreamClass__ + +#pragma interface + +#include <java/lang/Object.h> + +class java::io::VMObjectStreamClass : public ::java::lang::Object +{ + +public: // actually package-private + VMObjectStreamClass(); + static jboolean hasClassInitializer(::java::lang::Class *); + static void setDoubleNative(::java::lang::reflect::Field *, ::java::lang::Object *, jdouble); + static void setFloatNative(::java::lang::reflect::Field *, ::java::lang::Object *, jfloat); + static void setLongNative(::java::lang::reflect::Field *, ::java::lang::Object *, jlong); + static void setIntNative(::java::lang::reflect::Field *, ::java::lang::Object *, jint); + static void setShortNative(::java::lang::reflect::Field *, ::java::lang::Object *, jshort); + static void setCharNative(::java::lang::reflect::Field *, ::java::lang::Object *, jchar); + static void setByteNative(::java::lang::reflect::Field *, ::java::lang::Object *, jbyte); + static void setBooleanNative(::java::lang::reflect::Field *, ::java::lang::Object *, jboolean); + static void setObjectNative(::java::lang::reflect::Field *, ::java::lang::Object *, ::java::lang::Object *); +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_VMObjectStreamClass__ diff --git a/libjava/java/io/WriteAbortedException.h b/libjava/java/io/WriteAbortedException.h new file mode 100644 index 0000000..712c04d --- /dev/null +++ b/libjava/java/io/WriteAbortedException.h @@ -0,0 +1,25 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_WriteAbortedException__ +#define __java_io_WriteAbortedException__ + +#pragma interface + +#include <java/io/ObjectStreamException.h> + +class java::io::WriteAbortedException : public ::java::io::ObjectStreamException +{ + +public: + WriteAbortedException(::java::lang::String *, ::java::lang::Exception *); + virtual ::java::lang::String * getMessage(); + virtual ::java::lang::Throwable * getCause(); +private: + static const jlong serialVersionUID = -3326426625597282442LL; +public: + ::java::lang::Exception * __attribute__((aligned(__alignof__( ::java::io::ObjectStreamException)))) detail; + static ::java::lang::Class class$; +}; + +#endif // __java_io_WriteAbortedException__ diff --git a/libjava/java/io/Writer.h b/libjava/java/io/Writer.h new file mode 100644 index 0000000..61156647 --- /dev/null +++ b/libjava/java/io/Writer.h @@ -0,0 +1,39 @@ + +// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- + +#ifndef __java_io_Writer__ +#define __java_io_Writer__ + +#pragma interface + +#include <java/lang/Object.h> +#include <gcj/array.h> + + +class java::io::Writer : public ::java::lang::Object +{ + +public: // actually protected + Writer(); + Writer(::java::lang::Object *); +public: + virtual void flush() = 0; + virtual void close() = 0; + virtual void write(jint); + virtual void write(JArray< jchar > *); + virtual void write(JArray< jchar > *, jint, jint) = 0; + virtual void write(::java::lang::String *); + virtual void write(::java::lang::String *, jint, jint); + virtual ::java::io::Writer * target$append(jchar); + virtual ::java::io::Writer * target$append(::java::lang::CharSequence *); + virtual ::java::io::Writer * target$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); +public: // actually protected + ::java::lang::Object * __attribute__((aligned(__alignof__( ::java::lang::Object)))) lock; +public: + static ::java::lang::Class class$; +}; + +#endif // __java_io_Writer__ diff --git a/libjava/java/io/natObjectInputStream.cc b/libjava/java/io/natObjectInputStream.cc index 2d1a556..6212396 100644 --- a/libjava/java/io/natObjectInputStream.cc +++ b/libjava/java/io/natObjectInputStream.cc @@ -1,6 +1,6 @@ -// natObjectInputStream.cc - Native part of ObjectInputStream class. +// natObjectInputStream.cc - Native part of VMObjectInputStream class. -/* Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation +/* Copyright (C) 1998, 1999, 2000, 2001, 2005, 2006 Free Software Foundation This ObjectInputStream is part of libgcj. @@ -14,8 +14,7 @@ details. */ #include <jvm.h> #include <gcj/method.h> -#include <java/io/ObjectInputStream$GetField.h> -#include <java/io/ObjectInputStream.h> +#include <java/io/VMObjectInputStream.h> #include <java/io/IOException.h> #include <java/lang/Class.h> #include <java/lang/reflect/Modifier.h> @@ -32,7 +31,7 @@ details. */ #endif jobject -java::io::ObjectInputStream::allocateObject (jclass klass, jclass, +java::io::VMObjectInputStream::allocateObject (jclass klass, jclass, ::java::lang::reflect::Constructor *ctr) { jobject obj = NULL; @@ -69,12 +68,3 @@ java::io::ObjectInputStream::allocateObject (jclass klass, jclass, return obj; } - -java::lang::ClassLoader * -java::io::ObjectInputStream::currentLoader () -{ - jclass caller = _Jv_StackTrace::GetCallingClass (&ObjectInputStream::class$); - if (caller) - return caller->getClassLoaderInternal(); - return NULL; -} |