X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFileParse.java;h=adc57cddf7cab38225a82bf08cae0a79aa793eec;hb=7d451923bf2ad5a358109eed435f354fc935f6ab;hp=af3bbeca10db20c4b1f5fa044a8d78089d517ab0;hpb=efc31b4a8d5cee63555586804a2b79c06bdb5a14;p=jalview.git diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index af3bbec..adc57cd 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -24,8 +24,6 @@ import java.net.*; public class FileParse { public File inFile; - public int fileSize; - public int noLines; protected String type; protected BufferedReader dataIn; @@ -38,35 +36,33 @@ public class FileParse { this.type = type; - if (type.equals("File")) + if (type.equals(AppletFormatAdapter.FILE)) { this.inFile = new File(fileStr); - this.fileSize = (int) inFile.length(); - dataIn = new BufferedReader(new FileReader(fileStr)); } - else if (type.equals("URL")) + else if (type.equals(AppletFormatAdapter.URL)) { URL url = new URL(fileStr); - this.fileSize = 0; dataIn = new BufferedReader(new InputStreamReader(url.openStream())); } - else if (type.equals("Paste")) + else if (type.equals(AppletFormatAdapter.PASTE)) { dataIn = new BufferedReader(new StringReader(fileStr)); } + else if (type.equals(AppletFormatAdapter.CLASSLOADER)) + { + java.io.InputStream is = getClass().getResourceAsStream("/" + fileStr); + if (is != null) + { + dataIn = new BufferedReader(new java.io.InputStreamReader(is)); + } + } } public String nextLine() throws IOException { - String next = dataIn.readLine(); - - if (next != null) - { - noLines++; - } - - return next; + return dataIn.readLine(); } }