From: amwaterhouse Date: Wed, 8 Mar 2006 16:58:16 +0000 (+0000) Subject: Can read from zip file X-Git-Tag: Root_VamJalview_2_07b+~74 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=9a5435d4f6b25c70aa7c10c66f022ccd86eb4de1;p=jalview.git Can read from zip file --- diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java index 26f1701..63728ae 100755 --- a/src/MCview/PDBfile.java +++ b/src/MCview/PDBfile.java @@ -24,18 +24,18 @@ import java.net.*; import java.util.*; import java.awt.Color; +import jalview.io.AppletFormatAdapter; public class PDBfile extends jalview.io.FileParse { public Vector chains = new Vector(); Vector lineArray = new Vector(); - String id; + public String id; public PDBfile(String[] lines) { for (int i = 0; i < lines.length; i++) lineArray.addElement(lines[i]); - noLines = lineArray.size(); parse(); } @@ -47,16 +47,24 @@ public class PDBfile extends jalview.io.FileParse { BufferedReader dataIn; - if (inType.equals("File")) { + + if (inType.equals(AppletFormatAdapter.FILE)) { dataIn = new BufferedReader(new FileReader(inFile)); } - else if(inType.equals("Paste")) + else if(inType.equals(AppletFormatAdapter.PASTE)) { dataIn = new BufferedReader(new StringReader(inFile)); } - else { + else if (inType.equalsIgnoreCase(AppletFormatAdapter.CLASSLOADER)) + { + java.io.InputStream is = getClass().getResourceAsStream("/" + + inFile); + + dataIn = new BufferedReader(new java.io.InputStreamReader(is)); + } + else + { URL url = new URL(inFile); - this.fileSize = 0; dataIn = new BufferedReader(new InputStreamReader(url.openStream())); } @@ -64,7 +72,6 @@ public class PDBfile extends jalview.io.FileParse { lineArray.addElement(line); } - noLines = lineArray.size(); parse(); lineArray = null;