Пример #1
0
        internal 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.getString(buf.getString());
                        attr.extended[i * 2 + 1] = Util.getString(buf.getString());
                    }
                }
            }
            return(attr);
        }
Пример #2
0
 internal 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.getString(buf.getString());
                 attr.extended[i*2+1]=Util.getString(buf.getString());
             }
         }
     }
     return attr;
 }