JAL-3615 code tidy, improve unit test
[jalview.git] / src / jalview / io / FileParse.java
index d986dc5..2ff0d27 100755 (executable)
@@ -230,19 +230,18 @@ public class FileParse
       return false;
     }
     input.mark(4);
-    byte[] bytes = new byte[2]; // input.readNBytes(2);
+    
+    // get first 2 bytes or return false
+    byte[] bytes = new byte[2];
     int read = input.read(bytes);
     input.reset();
     if (read != bytes.length)
     {
       return false;
     }
-    if (bytes.length == 2)
-    {
-      int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
-      return (GZIPInputStream.GZIP_MAGIC == header);
-    }
-    return false;
+    
+    int header = (bytes[0] & 0xff) | ((bytes[1] << 8) & 0xff00);
+    return (GZIPInputStream.GZIP_MAGIC == header);
   }
 
   /**