Can read from zip file
authoramwaterhouse <Andrew Waterhouse>
Wed, 8 Mar 2006 16:58:16 +0000 (16:58 +0000)
committeramwaterhouse <Andrew Waterhouse>
Wed, 8 Mar 2006 16:58:16 +0000 (16:58 +0000)
src/MCview/PDBfile.java

index 26f1701..63728ae 100755 (executable)
@@ -24,18 +24,18 @@ import java.net.*;
 \r
 import java.util.*;\r
 import java.awt.Color;\r
+import jalview.io.AppletFormatAdapter;\r
 \r
 \r
 public class PDBfile extends jalview.io.FileParse {\r
     public Vector chains = new Vector();\r
     Vector lineArray = new Vector();\r
-    String id;\r
+    public String id;\r
 \r
     public PDBfile(String[] lines) {\r
         for (int i = 0; i < lines.length; i++)\r
             lineArray.addElement(lines[i]);\r
 \r
-        noLines = lineArray.size();\r
         parse();\r
     }\r
 \r
@@ -47,16 +47,24 @@ public class PDBfile extends jalview.io.FileParse {
 \r
         BufferedReader dataIn;\r
 \r
-        if (inType.equals("File")) {\r
+\r
+        if (inType.equals(AppletFormatAdapter.FILE)) {\r
             dataIn = new BufferedReader(new FileReader(inFile));\r
         }\r
-        else if(inType.equals("Paste"))\r
+        else if(inType.equals(AppletFormatAdapter.PASTE))\r
         {\r
             dataIn = new BufferedReader(new StringReader(inFile));\r
         }\r
-        else {\r
+        else if (inType.equalsIgnoreCase(AppletFormatAdapter.CLASSLOADER))\r
+        {\r
+          java.io.InputStream is = getClass().getResourceAsStream("/" +\r
+              inFile);\r
+\r
+          dataIn = new BufferedReader(new java.io.InputStreamReader(is));\r
+        }\r
+        else\r
+        {\r
             URL url = new URL(inFile);\r
-            this.fileSize = 0;\r
             dataIn = new BufferedReader(new InputStreamReader(url.openStream()));\r
         }\r
 \r
@@ -64,7 +72,6 @@ public class PDBfile extends jalview.io.FileParse {
             lineArray.addElement(line);\r
         }\r
 \r
-        noLines = lineArray.size();\r
 \r
         parse();\r
         lineArray = null;\r