X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAppletFormatAdapter.java;h=4507019828b4fe9dc93d18d0141ed2afd4fbc457;hb=b57a02c25e335d033c97f8a6bacd6b54f62bd2b6;hp=42e881c56248524a536f473d70a9a61e64a47da4;hpb=1eb7d27d73beabe1a1b74fd088c1c3254a8066be;p=jalview.git diff --git a/src/jalview/io/AppletFormatAdapter.java b/src/jalview/io/AppletFormatAdapter.java index 42e881c..4507019 100755 --- a/src/jalview/io/AppletFormatAdapter.java +++ b/src/jalview/io/AppletFormatAdapter.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.5) - * Copyright (C) 2010 J Procter, AM Waterhouse, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) + * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle * * This file is part of Jalview. * @@ -67,7 +67,7 @@ public class AppletFormatAdapter */ public static final String[] READABLE_EXTENSIONS = new String[] { "fa, fasta, fastq", "aln", "pfam", "msf", "pir", "blc", "amsa", "jar", - "sto" }; // , + "sto,stk" }; // , // ".blast" // }; @@ -119,6 +119,21 @@ public class AppletFormatAdapter String inFile; /** + * character used to write newlines + */ + protected String newline = System.getProperty("line.separator"); + + public void setNewlineString(String nl) + { + newline = nl; + } + + public String getNewlineString() + { + return newline; + } + + /** * check that this format is valid for reading * * @param format @@ -441,7 +456,7 @@ public class AppletFormatAdapter throw new Exception( "Implementation error: Unknown file format string"); } - + afile.setNewlineString(newline); afile.addJVSuffix(jvsuffix); afile.setSeqs(alignment.getSequencesArray()); @@ -463,6 +478,18 @@ public class AppletFormatAdapter return null; } + public static String checkProtocol(String file) + { + String protocol = FILE; + String ft = file.toLowerCase().trim(); + if (ft.indexOf("http:") == 0 || ft.indexOf("https:") == 0 + || ft.indexOf("file:") == 0) + { + protocol = URL; + } + return protocol; + } + public static void main(String[] args) { int i = 0; @@ -597,11 +624,14 @@ public class AppletFormatAdapter if (!fp.isValid()) { fp = null; - } else { - if (debug) + } + else { - System.out.println("Successful."); - }} + if (debug) + { + System.out.println("Successful."); + } + } } catch (Exception e) { if (debug) @@ -690,4 +720,4 @@ public class AppletFormatAdapter } return null; } -} \ No newline at end of file +}