diff src/ch/ethz/ssh2/SFTPv6FileAttributes.java @ 308:42b15aaa7ac7 ganymed

merge
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:21:50 -0700
parents 071eccdff8ea
children
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/SFTPv6FileAttributes.java	Wed Jul 30 13:38:04 2014 -0700
+++ b/src/ch/ethz/ssh2/SFTPv6FileAttributes.java	Wed Jul 30 14:21:50 2014 -0700
@@ -173,78 +173,98 @@
         int flags = tr.readUINT32();
         // The type field is always present
         this.type = tr.readByte();
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_SIZE) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SIZE) != 0) {
             this.size = tr.readUINT64();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_ALLOCATION_SIZE) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_ALLOCATION_SIZE) != 0) {
             // Ignore
             tr.readUINT64();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_OWNERGROUP) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_OWNERGROUP) != 0) {
             this.owner = tr.readString();
             this.group = tr.readString();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS) != 0) {
             this.permissions = tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_ACCESSTIME) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_ACCESSTIME) != 0) {
             this.atime = tr.readUINT64();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
             // Ignore
             tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_CREATETIME) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_CREATETIME) != 0) {
             this.createtime = tr.readUINT64();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
             // Ignore
             tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_MODIFYTIME) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_MODIFYTIME) != 0) {
             this.mtime = tr.readUINT64();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
             // Ignore
             tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_CTIME) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_CTIME) != 0) {
             this.ctime = tr.readUINT64();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_SUBSECOND_TIMES) != 0) {
             // Ignore
             tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_ACL) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_ACL) != 0) {
             // Ignore
             tr.readString();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_BITS) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_BITS) != 0) {
             // Ignore attrib-bits
             tr.readUINT32();
             // Ignore attrib-bits-valid
             tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_TEXT_HINT) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_TEXT_HINT) != 0) {
             // Ignore
             tr.readByte();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_MIME_TYPE) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_MIME_TYPE) != 0) {
             // Ignore
             tr.readString();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_LINK_COUNT) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_LINK_COUNT) != 0) {
             // Ignore
             tr.readUINT32();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_UNTRANSLATED_NAME) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_UNTRANSLATED_NAME) != 0) {
             // Ignore
             tr.readString();
         }
-        if((flags & AttribFlags.SSH_FILEXFER_ATTR_EXTENDED) != 0) {
+
+        if ((flags & AttribFlags.SSH_FILEXFER_ATTR_EXTENDED) != 0) {
             int count = tr.readUINT32();
+
             // Read it anyway to detect corrupt packets
-            while(count > 0) {
+            while (count > 0) {
                 // extension-name
                 tr.readByteString();
                 // extension-data
@@ -266,54 +286,70 @@
         // The 'valid-attribute-flags' specifies which of the fields are present.  Those fields
         // for which the corresponding flag is not set are not present
         int attrFlags = 0;
-        if(this.size != null) {
+
+        if (this.size != null) {
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_SIZE;
         }
-        if((this.owner != null) && (this.group != null)) {
+
+        if ((this.owner != null) && (this.group != null)) {
             // If either the owner or group field is zero length, the field should
             // be considered absent, and no change should be made to that specific
             // field during a modification operation.
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_OWNERGROUP;
         }
-        if(this.permissions != null) {
+
+        if (this.permissions != null) {
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_PERMISSIONS;
         }
-        if(this.atime != null) {
+
+        if (this.atime != null) {
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_ACCESSTIME;
         }
-        if(this.createtime != null) {
+
+        if (this.createtime != null) {
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_CREATETIME;
         }
-        if(this.mtime != null) {
+
+        if (this.mtime != null) {
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_MODIFYTIME;
         }
-        if(this.ctime != null) {
+
+        if (this.ctime != null) {
             attrFlags = attrFlags | AttribFlags.SSH_FILEXFER_ATTR_CTIME;
         }
+
         tw.writeUINT32(attrFlags);
+
         // The type field is always present.
-        if(this.size != null) {
+        if (this.size != null) {
             tw.writeUINT64(this.size);
         }
-        if((this.owner != null) && (this.group != null)) {
+
+        if ((this.owner != null) && (this.group != null)) {
             tw.writeString(owner);
             tw.writeString(group);
         }
-        if(this.permissions != null) {
+
+        if (this.permissions != null) {
             tw.writeUINT32(this.permissions);
         }
-        if(this.atime != null) {
+
+        if (this.atime != null) {
             tw.writeUINT64(this.atime);
         }
-        if(this.createtime != null) {
+
+        if (this.createtime != null) {
             tw.writeUINT64(this.createtime);
         }
-        if(this.mtime != null) {
+
+        if (this.mtime != null) {
             tw.writeUINT64(this.mtime);
         }
-        if(this.ctime != null) {
+
+        if (this.ctime != null) {
             tw.writeUINT64(this.ctime);
         }
+
         return tw.getBytes();
     }