# Friday, 16 August 2002
« No Title | Main | No Title »
No Title

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.

Friday, 16 August 2002 15:20:30 (W. Europe Daylight Time, UTC+02:00)  #    Comments [0]
Name
E-mail
Home page

I apologize for the lameness of this, but the comment spam was driving me nuts. In order to be able to post a comment, you need to answer a simple question. Hopefully this question is easy enough not to annoy serious commenters, but hard enough to keep the spammers away.

Anti-Spam Question: What method on java.lang.System returns an object's original hashcode (i.e. the one that would be returned by java.lang.Object.hashCode() if it wasn't overridden)? (case is significant)

Answer:  
Comment (HTML not allowed)  

Live Comment Preview