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.