int id = buffer.getInt();
if (type == SSH_FXP_STATUS) {
int substatus = buffer.getInt();
String msg = buffer.getString();
String lang = buffer.getString();
throw new SshException("SFTP error (" + substatus + "): " + msg);
} else if (type == SSH_FXP_NAME) {
int len = buffer.getInt();
if (len != 1) {
throw new SshException("SFTP error: received " + len + " names instead of 1");
}
String name = buffer.getString();
String longName = buffer.getString();
Attributes attrs = readAttributes(buffer);
return name;
} else {
throw new SshException("Unexpected SFTP packet received: " + type);
}
}