}
return nfsEntrySet.iterator();
}
private Set<NFS2Entry> getNFS2EntrySet() throws IOException {
final NFS2Client nfsClient = getNFS2Client();
Set<NFS2Entry> nfsEntrySet;
try {
nfsEntrySet =
AccessController.doPrivileged(new PrivilegedExceptionAction<Set<NFS2Entry>>() {
public Set<NFS2Entry> run() throws Exception {
Set<Entry> entrySet = new LinkedHashSet<Entry>();
boolean eof = false;
byte[] cookie = new byte[NFS2Client.COOKIE_SIZE];
while (!eof) {
ListDirectoryResult result = nfsClient.listDirectory(
directoryEntry.getFileHandle(), cookie, 2048);
entrySet.addAll(result.getEntryList());
if (result.isEof()) {
eof = true;
} else {
// I guess that the list contains at least one entry.
cookie = result.getEntryList().get(
result.getEntryList().size() - 1).getCookie();
}
}
if (entrySet.size() == 0) {
return new HashSet<NFS2Entry>();
}
Set<NFS2Entry> nfsEntrySet =
new LinkedHashSet<NFS2Entry>(entrySet.size());
for (Entry entry : entrySet) {
LookupResult lookupResult = nfsClient.lookup(
directoryEntry.getFileHandle(), entry.getName());
NFS2Entry nfsEntry = new NFS2Entry(
(NFS2FileSystem) getFileSystem(),
NFS2Directory.this, entry.getName(), lookupResult.getFileHandle(),