classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gnu.java.nio.FileChannelImpl


From: Ewout Prangsma
Subject: Re: gnu.java.nio.FileChannelImpl
Date: Fri, 26 Nov 2004 09:19:28 +0100
User-agent: Mozilla Thunderbird 0.9 (Windows/20041103)


Hmm, where would you put it ? Into java.nio.channels because it
inherits FileChannel, or java.io because its used there ?
      
Ahhh you got a point there. Well in that case i would suggest
java.io, to make the package protection work.
    

The problem is that its used from other classes in gnu.java.nio too. 
File locking, mapped byte buffers, all (will) need it.
  

I searched and found that FileChannelImpl is used in gnu.java.nio.FileLockImpl, java.nio.channels.Channels & java.io.FileDescriptor.

So here is my suggestions.

- Rename gnu.java.nio.FileChannelImpl to VMFileChannel (placed in vm/reference)
- Rename gnu.java.nio.FileLockImpl to VMFileLock (placed in vm/reference)
- Add a new VMFileChannelImpl in java.io (placed in vm/reference) that constains
  1. a static method FileChannel open(...) the default implementation is to return a new VMFileChannel(...), but vm's can decide to implement it themselves.
  2. a static method FileChannel getOut(), FileChannel getIn(), FileChannel getErr() to replace the in, out, err fields of FileChannelImpl
- Add a new VMChannels to java.nio.channels (placed in vm/reference) that implements the native methods of Channels (newInputStream, newOutputStream)
- Replace the FileChannelImpl instanceof check in Channels by a FileChannel instanceof check.
- Replace the FileChannelImpl.in/out/err reference in java.io.FileDescriptor with VMFileChannelImpl.getIn()/getOut()/getErr().

Ewout



Michael
  

reply via email to

[Prev in Thread] Current Thread [Next in Thread]