*/
public synchronized SftpFile openDirectory(String path)
throws IOException {
String absolutePath = getAbsolutePath(path);
UnsignedInteger32 requestId = nextRequestId();
SubsystemMessage msg = new SshFxpOpenDir(requestId, absolutePath);
sendMessage(msg);
byte[] handle = getHandleResponse(requestId);
requestId = nextRequestId();
msg = new SshFxpStat(requestId, absolutePath);
sendMessage(msg);
try {
SubsystemMessage reply = messageStore.getMessage(requestId);
if (reply instanceof SshFxpAttrs) {
SftpFile file = new SftpFile(absolutePath,
((SshFxpAttrs) reply).getAttributes());
file.setHandle(handle);
file.setSFTPSubsystem(this);
return file;
} else if (reply instanceof SshFxpStatus) {
throw new IOException(((SshFxpStatus) reply).getErrorMessage());
} else {
throw new IOException("Unexpected server response " +
reply.getMessageName());
}
} catch (InterruptedException ex) {
throw new IOException("The thread was interrupted");
}
}