[jcifs] Class SmbFile

Michael B. Allen mballen at erols.com
Sat Nov 10 10:52:30 EST 2001


Kurien Mathew wrote:

>Why does not 'SmbFile' extend java.io.File?
>
>Doing so would make it possible to list the available SMB resources in
>JFileChooser using "smb://" as 'root'.
>
I don't think that would work. There are assumptions made by the 
underlying FileSystem implementation that would undoubtledly cause 
problems. For example if SmbFile extended File and you passed it to an 
FileOutputStream constructor, it would call getPath which would return 
an SMB URL. Then open on the FileSystem implementation would be called 
which the local OS wouldn't have a clue what to do with. I suspect 
there's quite a bit of this in the java.io. package. It's theoretically 
possible and an interesting idea but I think it would turn out to be 
more trouble than it's worth. I don't think they intended java.io.File 
to be extending (at least not for networking protocols).

Mike






More information about the jcifs mailing list