[Nice-commit] Nice/stdlib/nice/lang java-io.nice,NONE,1.1 java.nice,1.44,1.45
Brought to you by:
bonniot
From: <ar...@us...> - 2003-11-26 00:29:35
|
Update of /cvsroot/nice/Nice/stdlib/nice/lang In directory sc8-pr-cvs1:/tmp/cvs-serv3872/F:/nice/stdlib/nice/lang Modified Files: java.nice Added Files: java-io.nice Log Message: Move retypings of java.io to a new file and added few more retypings. --- NEW FILE: java-io.nice --- /**************************************************************************** * N I C E * * A high-level object-oriented research language * * (c) Daniel Bonniot 2003 * * * * This package is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * Free Software Foundation; either version 2 of the License, or (at your * * option) any later version. * * * * 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. * ****************************************************************************/ /** Retypings for the java.io package */ import java.io.*; import java.net.*; /** In Java, System.out and System.err are possibly null. In Nice we prevent this to happen, and give them a non-null type. */ // prevents to stdout and stderr to be set to null void setStdout (PrintStream ps) = native void System.setOut(PrintStream); void setStderr (PrintStream ps) = native void System.setErr(PrintStream); PrintStream stdout () = native System.out; PrintStream stderr () = native System.err; /** Convenience: printing on the standard output. */ <Any T> void print (T object) = System.out.print (object); <Any T> void println (T object) = System.out.println(object); // Constructors BufferedInputStream BufferedInputStream(InputStream) = native new BufferedInputStream(InputStream); BufferedInputStream BufferedInputStream(InputStream, int) = native new BufferedInputStream(InputStream, int); BufferedOutputStream BufferedOutputStream(OutputStream) = native new BufferedOutputStream(OutputStream); BufferedOutputStream BufferedOutputStream(OutputStream, int) = native new BufferedOutputStream(OutputStream, int); BufferedReader BufferedReader(Reader) = native new BufferedReader(Reader); BufferedReader BufferedReader(Reader,int) = native new BufferedReader(Reader, int); BufferedWriter BufferedWriter(Writer) = native new BufferedWriter(Writer); BufferedWriter BufferedWriter(Writer, int) = native new BufferedWriter(Writer, int); ByteArrayInputStream ByteArrayInputStream(byte[]) = native new ByteArrayInputStream(byte[]); ByteArrayInputStream ByteArrayInputStream(byte[], int, int) = native new ByteArrayInputStream(byte[], int, int); ByteArrayOutputStream ByteArrayOutputStream(int) = native new ByteArrayOutputStream(int); CharArrayReader CharArrayReader(char[]) = native new CharArrayReader(char[]); CharArrayReader CharArrayReader(char[], int, int) = native new CharArrayReader(char[], int, int); DataInputStream DataInputStream(InputStream) = native new DataInputStream(InputStream); DataOutputStream DataOutputStream(OutputStream) = native new DataOutputStream(OutputStream); File File(?File, String) = native new File(File, String); File File(String) = native new File(String); File File(?String, String) = native new File(String, String); File File(URI) = native new File(URI); FileInputStream FileInputStream(File) = native new FileInputStream(File); FileInputStream FileInputStream(FileDescriptor) = native new FileInputStream(FileDescriptor); FileInputStream FileInputStream(String) = native new FileInputStream(String); FileOutputStream FileOutputStream(File) = native new FileOutputStream(File); FileOutputStream FileOutputStream(File, boolean) = native new FileOutputStream(File, boolean); FileOutputStream FileOutputStream(FileDescriptor) = native new FileOutputStream(FileDescriptor); FileOutputStream FileOutputStream(String) = native new FileOutputStream(String); FileOutputStream FileOutputStream(String, boolean) = native new FileOutputStream(String, boolean); FilePermission FilePermission(String, String) = native new FilePermission(String, String); FileReader FileReader(File) = native new FileReader(File); FileReader FileReader(FileDescriptor) = native new FileReader(FileDescriptor); FileReader FileReader(String) = native new FileReader(String); FileWriter FileWriter(File) = native new FileWriter(File); FileWriter FileWriter(File, boolean) = native new FileWriter(File, boolean); FileWriter FileWriter(FileDescriptor) = native new FileWriter(FileDescriptor); FileWriter FileWriter(String) = native new FileWriter(String); FileWriter FileWriter(String, boolean) = native new FileWriter(String, boolean); FilterInputStream FilterInputStream(InputStream) = native new FilterInputStream(InputStream); FilterOutputStream FilterOutputStream(OutputStream) = native new FilterOutputStream(OutputStream); FilterReader FilterReader(Reader) = native new FilterReader(Reader); FilterWriter FilterWriter(Writer) = native new FilterWriter(Writer); // InputStreams int read(InputStream, byte[]) = native int InputStream.read(byte[]); int read(InputStream, byte[], int, int) = native int InputStream.read( byte[], int, int); void unread(PushbackInputStream, byte[]) = native void PushbackInputStream.unread(byte[]); void unread(PushbackInputStream, byte[], int, int) = native void PushbackInputStream.unread( byte[], int, int); void connect(PipedInputStream, PipedOutputStream) = native void PipedInputStream.connect(PipedOutputStream); // OutputStreams void write(OutputStream, byte[]) = native void OutputStream.write(byte[]); void write(OutputStream, byte[], int, int) = native void OutputStream.write( byte[], int, int); byte[] toByteArray(ByteArrayOutputStream) = native byte[] ByteArrayOutputStream.toByteArray(); String toString(ByteArrayOutputStream, String) = native String ByteArrayOutputStream.toString(String); void writeTo(ByteArrayOutputStream, OutputStream) = native void ByteArrayOutputStream.writeTo(OutputStream); <T> void print(PrintStream, T) = native void PrintStream.print(Object); void print(PrintStream, String) = native void PrintStream.print(String); void print(PrintStream, char[]) = native void PrintStream.print(char[]); <T> void println(PrintStream, T) = native void PrintStream.println(Object); void println(PrintStream, String) = native void PrintStream.println(String); void println(PrintStream, char[]) = native void PrintStream.println(char[]); void connect(PipedOutputStream, PipedInputStream) = native void PipedOutputStream.connect(PipedInputStream); // Readers int read(Reader, char[]) = native int Reader.read(char[]); int read(Reader, char[], int, int) = native int Reader.read(char[], int, int); ?String readLine(BufferedReader) = native String BufferedReader.readLine(); void unread(PushbackReader, char[]) = native void PushbackReader.unread(char[]); void unread(PushbackReader, char[], int, int) = native void PushbackReader.unread(char[], int, int); ?String getEncoding(InputStreamReader) = native String InputStreamReader.getEncoding(); void connect(PipedReader, PipedWriter) = native void PipedReader.connect(PipedWriter); // Writers void write(Writer, char[]) = native void Writer.write(char[]); void write(Writer, char[], int, int) = native void Writer.write(char[], int, int); void write(Writer, String) = native void Writer.write(String); void write(Writer, String, int, int) = native void Writer.write(String, int, int); char[] toCharArray(CharArrayWriter) = native char[] CharArrayWriter.toCharArray(); void writeTo(CharArrayWriter, Writer) = native void CharArrayWriter.writeTo(Writer); ?String getEncoding(OutputStreamWriter) = native String OutputStreamWriter.getEncoding(); void connect(PipedWriter, PipedReader) = native void PipedWriter.connect(PipedReader); <T> void print(PrintWriter, T) = native void PrintWriter.print(Object); void print(PrintWriter, String) = native void PrintWriter.print(String); void print(PrintWriter, char[]) = native void PrintWriter.print(char[]); <T> void println(PrintWriter, T) = native void PrintWriter.println(Object); void println(PrintWriter, String) = native void PrintWriter.println(String); void println(PrintWriter, char[]) = native void PrintWriter.println(char[]); StringBuffer getBuffer(StringWriter) = native StringBuffer StringWriter.getBuffer(); // File File createTempFile(String, ?String) = native File File.createTempFile(String, String); File createTempFile(String, ?String, ?File) = native File File.createTempFile(String, String, File); File getAbsoluteFile(File) = native File File.getAbsoluteFile(); String getAbsolutePath(File) = native String File.getAbsolutePath(); File getCanonicalFile(File) = native File File.getCanonicalFile(); String getCanonicalPath(File) = native String File.getCanonicalPath(); String getName(File) = native String File.getName(); ?String getParent(File) = native String File.getParent(); ?File getParentFile(File) = native File File.getParentFile(); String getPath(File) = native String File.getPath(); ?(String[]) list(File) = native String[] File.list(); ?(String[]) list(File, FilenameFilter) = native String[] File.list(FilenameFilter); ?(File[]) listFiles(File) = native File[] File.listFiles(); ?(File[]) listFiles(File, FileFilter) = native File[] File.listFiles(FileFilter); ?(File[]) listFiles(File, FilenameFilter) = native File[] File.listFiles(FilenameFilter); ?(File[]) listRoots() = native File[] File.listRoots(); URI toURI(File) = native URI File.toURI(); URL toURL(File) = native URL File.toURL(); // DataInput/Output void readFully(DataInput, byte[]) = native void DataInput.readFully(byte[]); void readFully(DataInput, byte[], int, int) = native void DataInput.readFully( byte[], int, int); ?String readLine(DataInput) = native String DataInput.readLine(); String readUTF(DataInput) = native String DataInput.readUTF(); void write(DataOutput, byte[]) = native void DataOutput.write(byte[]); void write(DataOutput, byte[], int, int) = native void DataOutput.write( byte[], int, int); void writeBytes(DataOutput, String) = native void DataOutput.writeBytes(String); void writeChars(DataOutput, String) = native void DataOutput.writeChars(String); void writeUTF(DataOutput, String) = native void DataOutput.writeUTF(String); // Serialization <T> void writeObject(ObjectOutput, T) = native void ObjectOutput.writeObject(Object); <T> T readObject(ObjectInput) = native Object ObjectInput.readObject(); void readExternal(Externalizable, ObjectInput) = native void Externalizable.readExternal(ObjectInput); void writeExternal(Externalizable, ObjectOutput) = native void Externalizable.writeExternal(ObjectOutput); // Other boolean accept(FileFilter, File) = native boolean FileFilter.accept(File); boolean accept(FilenameFilter, File, String) = native boolean FilenameFilter.accept(File, String); Index: java.nice =================================================================== RCS file: /cvsroot/nice/Nice/stdlib/nice/lang/java.nice,v retrieving revision 1.44 retrieving revision 1.45 diff -C2 -d -r1.44 -r1.45 *** java.nice 19 Nov 2003 16:04:45 -0000 1.44 --- java.nice 26 Nov 2003 00:29:31 -0000 1.45 *************** *** 29,33 **** import java.text.*; - import java.io.*; import java.lang.reflect.*; --- 29,32 ---- *************** *** 80,114 **** DateFormat getDateInstance() = native DateFormat DateFormat.getDateInstance(); DateFormat getDateInstance(int style) = native DateFormat DateFormat.getDateInstance(int); - - // PACKAGE: java.io - - <Any T> void print (PrintStream ps, T object) = - native void PrintStream.print (Object); - <Any T> void println (PrintStream ps, T object) = - native void PrintStream.println(Object); - String getAbsolutePath (File) = native String File.getAbsolutePath(); - - ?String readLine(BufferedReader) = native String BufferedReader.readLine(); - ?String readLine(DataInput) = native String DataInput.readLine(); - - /** - In Java, System.out and System.err are possibly null. - In Nice we prevent this to happen, and give them a non-null type. - */ - - // prevents to stdout and stderr to be set to null - void setStdout (PrintStream ps) = native void System.setOut(PrintStream); - void setStderr (PrintStream ps) = native void System.setErr(PrintStream); - - PrintStream stdout () = native System.out; - PrintStream stderr () = native System.err; - - /** Convenience: printing on the standard output. */ - <Any T> void print (T object) = System.out.print (object); - <Any T> void println (T object) = System.out.println(object); - - // Serialization - <Any T> void writeObject(ObjectOutput, T) = native void ObjectOutput.writeObject(Object); - <Any T> T readObject(ObjectInput) = native Object ObjectInput.readObject(); // PACKAGE: java.util --- 79,82 ---- |