diff src/ch/ethz/ssh2/packets/TypesReader.java @ 307:071eccdff8ea ganymed

fix java formatting
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:16:58 -0700
parents 91a31873c42a
children
line wrap: on
line diff
--- a/src/ch/ethz/ssh2/packets/TypesReader.java	Wed Jul 30 12:09:51 2014 -0700
+++ b/src/ch/ethz/ssh2/packets/TypesReader.java	Wed Jul 30 14:16:58 2014 -0700
@@ -30,7 +30,7 @@
         this.pos = off;
         this.max = arr.length;
 
-        if((pos < 0) || (pos > arr.length)) {
+        if ((pos < 0) || (pos > arr.length)) {
             throw new IllegalArgumentException("Illegal offset.");
         }
     }
@@ -40,17 +40,17 @@
         this.pos = off;
         this.max = off + len;
 
-        if((pos < 0) || (pos > arr.length)) {
+        if ((pos < 0) || (pos > arr.length)) {
             throw new IllegalArgumentException("Illegal offset.");
         }
 
-        if((max < 0) || (max > arr.length)) {
+        if ((max < 0) || (max > arr.length)) {
             throw new IllegalArgumentException("Illegal length.");
         }
     }
 
     public int readByte() throws IOException {
-        if(pos >= max) {
+        if (pos >= max) {
             throw new PacketFormatException("Packet too short.");
         }
 
@@ -58,20 +58,18 @@
     }
 
     public byte[] readBytes(int len) throws IOException {
-        if((pos + len) > max) {
+        if ((pos + len) > max) {
             throw new PacketFormatException("Packet too short.");
         }
 
         byte[] res = new byte[len];
-
         System.arraycopy(arr, pos, res, 0, len);
         pos += len;
-
         return res;
     }
 
     public void readBytes(byte[] dst, int off, int len) throws IOException {
-        if((pos + len) > max) {
+        if ((pos + len) > max) {
             throw new PacketFormatException("Packet too short.");
         }
 
@@ -80,7 +78,7 @@
     }
 
     public boolean readBoolean() throws IOException {
-        if(pos >= max) {
+        if (pos >= max) {
             throw new PacketFormatException("Packet too short.");
         }
 
@@ -88,34 +86,31 @@
     }
 
     public int readUINT32() throws IOException {
-        if((pos + 4) > max) {
+        if ((pos + 4) > max) {
             throw new PacketFormatException("Packet too short.");
         }
 
         return ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8)
-                | (arr[pos++] & 0xff);
+               | (arr[pos++] & 0xff);
     }
 
     public long readUINT64() throws IOException {
-        if((pos + 8) > max) {
+        if ((pos + 8) > max) {
             throw new PacketFormatException("Packet too short.");
         }
 
         long high = ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8)
-                | (arr[pos++] & 0xff); /* sign extension may take place - will be shifted away =) */
-
+                    | (arr[pos++] & 0xff); /* sign extension may take place - will be shifted away =) */
         long low = ((arr[pos++] & 0xff) << 24) | ((arr[pos++] & 0xff) << 16) | ((arr[pos++] & 0xff) << 8)
-                | (arr[pos++] & 0xff); /* sign extension may take place - handle below */
-
+                   | (arr[pos++] & 0xff); /* sign extension may take place - handle below */
         return (high << 32) | (low & 0xffffffffl); /* see Java language spec (15.22.1, 5.6.2) */
     }
 
     public BigInteger readMPINT() throws IOException {
         BigInteger b;
-
         byte raw[] = readByteString();
 
-        if(raw.length == 0) {
+        if (raw.length == 0) {
             b = BigInteger.ZERO;
         }
         else {
@@ -128,7 +123,7 @@
     public byte[] readByteString() throws IOException {
         int len = readUINT32();
 
-        if((len + pos) > max) {
+        if ((len + pos) > max) {
             throw new PacketFormatException("Malformed SSH byte string.");
         }
 
@@ -141,26 +136,24 @@
     public String readString(String charsetName) throws IOException {
         int len = readUINT32();
 
-        if((len + pos) > max) {
+        if ((len + pos) > max) {
             throw new PacketFormatException("Malformed SSH string.");
         }
 
         String res = (charsetName == null) ? new String(arr, pos, len) : new String(arr, pos, len, charsetName);
         pos += len;
-
         return res;
     }
 
     public String readString() throws IOException {
         int len = readUINT32();
 
-        if((len + pos) > max) {
+        if ((len + pos) > max) {
             throw new PacketFormatException("Malformed SSH string.");
         }
 
         String res = StringEncoder.GetString(arr, pos, len);
         pos += len;
-
         return res;
     }