I want to read file extended attributes using com.jcraft.JSch 0.1.55 (the file is on SFTP server). I know that class SftpATTR
actually does have a method
public String[] getExtended()
but in my case it returns null.
I see that in this code
static SftpATTRS getATTR(Buffer buf){
SftpATTRS attr=new SftpATTRS();
attr.flags=buf.getInt();
if((attr.flags&SSH_FILEXFER_ATTR_SIZE)!=0){ attr.size=buf.getLong(); }
if((attr.flags&SSH_FILEXFER_ATTR_UIDGID)!=0){
attr.uid=buf.getInt(); attr.gid=buf.getInt();
}
if((attr.flags&SSH_FILEXFER_ATTR_PERMISSIONS)!=0){
attr.permissions=buf.getInt();
}
if((attr.flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){
attr.atime=buf.getInt();
}
if((attr.flags&SSH_FILEXFER_ATTR_ACMODTIME)!=0){
attr.mtime=buf.getInt();
}
if((attr.flags&SSH_FILEXFER_ATTR_EXTENDED)!=0){
int count=buf.getInt();
if(count>0){
attr.extended=new String[count*2];
for(int i=0; i<count; i++){
attr.extended[i*2]=Util.byte2str(buf.getString());
attr.extended[i*2+1]=Util.byte2str(buf.getString());
}
}
}
return attr;
}
the last if-statement is responsible for reading extended attributes but it seems to me that it always evaluates to false, because
int flags=0;
and
public static final int SSH_FILEXFER_ATTR_EXTENDED= 0x80000000;
I cannot change the flags directly because it's setter doesn't have a public modifier.
Is there another way to change the flags or read the extended attributes somehow?