String msg = buffer.getString();
String lang = buffer.getString();
if (substatus == SSH_FX_EOF) {
return null;
}
throw new SshException("SFTP error (" + substatus + "): " + msg);
} else if (type == SSH_FXP_NAME) {
int len = buffer.getInt();
DirEntry[] entries = new DirEntry[len];
for (int i = 0; i < len; i++) {
String name = buffer.getString();
String longName = buffer.getString();
Attributes attrs = readAttributes(buffer);
entries[i] = new DirEntry(name, longName, attrs);
}
return entries;
} else {
throw new SshException("Unexpected SFTP packet received: " + type);
}
}