Updated: 3/13/2003; 2:20:17 PM.
IKVM.NET Weblog
The development of a Java VM for .NET
        

Friday, August 16, 2002
This weblog has moved to http://weblog.ikvm.net/

I reimplemented java.io.FileDescriptor to directly use System.IO.Stream (compiling against the netexp generated mscorlib.jar). This approach seems workable. As an example of how this turns out, here is the FileDescriptor.sync() code:

 public synchronized void sync() throws SyncFailedException
 {
  if(stream == null)
  {
   throw new SyncFailedException("The handle is invalid");
  }
  try
  {
   if(false) throw new system.io.IOException();
   stream.Flush();
  }
  catch(system.io.IOException x)
  {
   throw new SyncFailedException(x.get_Message());
  }
 }

I decided (for the moment) to not have every .NET method throw Throwable, but used the if(false) throw new ... trick. Works quite well, and it doesn't generate any code. I wonder if it would be legal for the compiler to move the stream.Flush() out of the try block... Not that I think any compiler would do this.

Updated the binaries and source snapshots.


2:20:30 PM    Comments

© Copyright 2003 Jeroen Frijters.
 
August 2002
Sun Mon Tue Wed Thu Fri Sat
        1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31
Jul   Sep