[jcifs] getType question

andrea.lanza at frameweb.it andrea.lanza at frameweb.it
Wed Dec 18 21:01:49 EST 2002

>> OK for all.
>> I "armed" the java exception trapping and I didn't see a real
>> downgrade.
>> Maybe this is due to the fact that my network is really little (about 20
>> computers sharing resources) and all of them share a limited number of
>> object (5-20)
>> Anyway I will consider your "alarm" about performance.
>Testing the attributes will not be slow. To be a little
>more specific, after listing smb://, smb://workgroup/, or
>smb://server/ some default attributes are assumed and cached for
>jcifs.smb.client.attrExpirationPeriod milliseconds which is 5000 unless
>specified otherwise. If you can test the attributes of each file in the
>this in that time no extra calls will be made to the server. So if you
>create a list of SmbFiles using listFiles() then wait 10 seconds and
>then query each for an attribute it will be quite slow.
>What I was trying to say would be slow would be trying to list the
>contents of each share to see if it was truely accessable. That
>would be slow. It would be slightly less slow to call exists on a
>bogus file smb://server/share/dummy which will achive the same effect
>without impolitely listing the contents of the open share. Or maybe
>smb://server/share/*.mp3 would be better :~) Remember, wild cards are
>supported by list and listFiles.

When I listFiles, I store the result in an array.
Then, to check if each of these files will be available,I do not try to
listFiles for all of them.
I used a different way. I try:
tmplngavailable = nextFiles[i].getDiskFreeSpace();
Here I get an exception if access is denied.
These is really fast. I don't know if it always works, but it seems to me.

>> thanks, as usual
>> Andrea

More information about the jcifs mailing list