Nice/stdlib/nice/io file.nice,1.1,1.2

Daniel Bonniot <[email protected]>
Newsgroups gmane.comp.lang.nice.cvs
Message-ID <[email protected]>
Update of /cvsroot/nice/Nice/stdlib/nice/io
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8992/stdlib/nice/io

Modified Files:
	file.nice 
Log Message:
Fixed some errors in nice.io and end-of-line weirdnesses. Still disable its
compilation since some errors remain.


Index: file.nice
===================================================================
RCS file: /cvsroot/nice/Nice/stdlib/nice/io/file.nice,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** file.nice	3 Mar 2005 23:50:04 -0000	1.1
--- file.nice	4 Mar 2005 09:48:16 -0000	1.2
***************
*** 101,114 ****
   */
  String read(File file, ?String encoding = null) 
!     requires file.exists(): "File " file " does not exist",
!             file.isFile(): file + " is not a normal file. Only normal files can be read."
  {
    let chars = new char[blockSize];
    let buff = new StringBuffer();
!   let input = new BufferedReader(
                      (encoding == null) 
                          ? new java.io.FileReader(file)
                          : new java.io.InputStreamReader(
! 			                new java.io.FileInputStream(file), encoding)
                              );
    using(input) {
--- 101,114 ----
   */
  String read(File file, ?String encoding = null) 
!     requires file.exists(): "File " file " does not exist",
!             file.isFile(): file + " is not a normal file. Only normal files can be read."
  {
    let chars = new char[blockSize];
    let buff = new StringBuffer();
!   let input = new java.io.BufferedReader(
                      (encoding == null) 
                          ? new java.io.FileReader(file)
                          : new java.io.InputStreamReader(
! 			                new java.io.FileInputStream(file), encoding)
                              );
    using(input) {
***************
*** 118,150 ****
    }
    return buff.toString();
! }
! 
! /**
!  * Opens a file and returns a generator which yields the lines contained in the file,
!  * one by one.
!  */
! void->String readLines(File file, ?encoding = null)
!     requires file.exists(): "File " file " does not exist",
!             file.isFile(): file + " is not a normal file. Only normal files can be read."
! {
!   let input = new BufferedReader(
                      (encoding == null) 
                          ? new java.io.FileReader(file)
                          : new java.io.InputStreamReader(
! 			                new java.io.FileInputStream(file), encoding)
!                             );
!   void close() { input.close(); stop(); }
!   return ()=> try {
!     return input.readLine() || close();
!     } catch (Throwable t) {
!         input.close();
!         throw t;
      }
  }
! 
! /**
!  * Returns the standard temp directory. 
   */
! File getTempDir() {
    //There must be a better way?
    let f = createTempFile("getTempDir", "test");
--- 118,152 ----
    }
    return buff.toString();
! }
! 
! /**
!  * Opens a file and returns a generator which yields the lines contained in the file,
!  * one by one.
!  */
! void->String readLines(File file, ?String encoding = null)
!     requires file.exists(): "File " file " does not exist",
!             file.isFile(): file + " is not a normal file. Only normal files can be read."
! {
!   let input = new java.io.BufferedReader(
                      (encoding == null) 
                          ? new java.io.FileReader(file)
                          : new java.io.InputStreamReader(
! 			                new java.io.FileInputStream(file), encoding)
!                             );
!   void close() { input.close(); stop(); }
!   return ()=> {
!     try {
!       return input.readLine() || close();
!     } catch (Throwable t) {
!       input.close();
!       throw t;
      }
+   };
  }
! 
! /**
!  * Returns the standard temp directory. 
   */
! File getTempDir() {
    //There must be a better way?
    let f = createTempFile("getTempDir", "test");



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.