X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFileParse.java;h=fddb5659da8e7d737de713f5602f3781cc6ce124;hb=3e29fb36af9c48e07837e32b7e99c081b2461b2f;hp=22213122bd40ac32ae525a526eca28b4082d05a8;hpb=fbed706fbf25c2f7a5b3f3ba9b2b44737c411dcc;p=jalview.git diff --git a/src/jalview/io/FileParse.java b/src/jalview/io/FileParse.java index 2221312..fddb565 100755 --- a/src/jalview/io/FileParse.java +++ b/src/jalview/io/FileParse.java @@ -23,6 +23,7 @@ package jalview.io; import jalview.api.AlignExportSettingI; import jalview.api.AlignViewportI; import jalview.api.AlignmentViewPanel; +import jalview.api.FeatureSettingsModelI; import jalview.util.MessageManager; import java.io.BufferedReader; @@ -80,7 +81,7 @@ public class FileParse public void setNewlineString(String nl) { - newline = nl; + newline = nl; } public String getNewlineString() @@ -98,7 +99,7 @@ public class FileParse protected BufferedReader dataIn = null; - protected String errormessage = "UNITIALISED SOURCE"; + protected String errormessage = "UNINITIALISED SOURCE"; protected boolean error = true; @@ -124,7 +125,9 @@ public class FileParse { if (from == null) { - throw new Error(MessageManager.getString("error.implementation_error_null_fileparse")); + throw new Error( + MessageManager + .getString("error.implementation_error_null_fileparse")); } if (from == this) { @@ -239,7 +242,10 @@ public class FileParse { if (e != null) { - throw new IOException(MessageManager.getString("exception.failed_to_resolve_gzip_stream"), e); + throw new IOException( + MessageManager + .getString("exception.failed_to_resolve_gzip_stream"), + e); } throw q; } @@ -318,12 +324,17 @@ public class FileParse { if (checkFileSource(suffixLess)) { - throw new IOException(MessageManager.formatMessage("exception.problem_opening_file_also_tried", new String[]{inFile.getName(),suffixLess,errormessage})); + throw new IOException(MessageManager.formatMessage( + "exception.problem_opening_file_also_tried", + new String[] { inFile.getName(), suffixLess, + errormessage })); } } else { - throw new IOException(MessageManager.formatMessage("exception.problem_opening_file", new String[]{inFile.getName(),errormessage})); + throw new IOException(MessageManager.formatMessage( + "exception.problem_opening_file", + new String[] { inFile.getName(), errormessage })); } } } @@ -335,7 +346,7 @@ public class FileParse { checkURLSource(fileStr); if (suffixSeparator == '#') - { + { extractSuffix(fileStr); // URL lref is stored for later reference. } } catch (IOException e) @@ -402,7 +413,9 @@ public class FileParse if (dataIn == null || error) { // pass up the reason why we have no source to read from - throw new IOException(MessageManager.formatMessage("exception.failed_to_read_data_from_source", new String[]{errormessage})); + throw new IOException(MessageManager.formatMessage( + "exception.failed_to_read_data_from_source", + new String[] { errormessage })); } error = false; dataIn.mark(READAHEAD_LIMIT); @@ -422,7 +435,8 @@ public class FileParse } else { - throw new IOException(MessageManager.getString("exception.no_init_source_stream")); + throw new IOException( + MessageManager.getString("exception.no_init_source_stream")); } } @@ -432,7 +446,9 @@ public class FileParse { return dataIn.readLine(); } - throw new IOException(MessageManager.formatMessage("exception.invalid_source_stream", new String[]{errormessage})); + throw new IOException(MessageManager.formatMessage( + "exception.invalid_source_stream", + new String[] { errormessage })); } /** @@ -466,18 +482,28 @@ public class FileParse } /** - * rewinds the datasource the beginning. + * Rewinds the datasource to the marked point if possible + * + * @param bytesRead * */ - public void reset() throws IOException + public void reset(int bytesRead) throws IOException { + if (bytesRead >= READAHEAD_LIMIT) + { + System.err.println(String.format( + "File reset error: read %d bytes but reset limit is %d", + bytesRead, READAHEAD_LIMIT)); + } if (dataIn != null && !error) { dataIn.reset(); } else { - throw new IOException(MessageManager.getString("error.implementation_error_reset_called_for_invalid_source")); + throw new IOException( + MessageManager + .getString("error.implementation_error_reset_called_for_invalid_source")); } } @@ -582,9 +608,21 @@ public class FileParse */ public void configureForView(AlignmentViewPanel avpanel) { - if (avpanel!=null) { + if (avpanel != null) + { setViewport(avpanel.getAlignViewport()); } // could also set export/import settings } + + /** + * Returns the preferred feature colour configuration if there is one, else + * null + * + * @return + */ + public FeatureSettingsModelI getFeatureColourScheme() + { + return null; + } }