JAL-2277 Refactored out duplicated method - printUnwrapped() in HtmlSvgOutput, extern...
[jalview.git] / src / jalview / io / BioJsHTMLOutput.java
index 817f75c..9b6a15a 100644 (file)
@@ -137,7 +137,7 @@ public class BioJsHTMLOutput
                       exportData.getStartEndPostions(), ap
                               .getAlignViewport().getColumnSelection());
 
-      String bioJSTemplateString = getBioJsTemplateAsString();
+      String bioJSTemplateString = HtmlFile.readFileAsString(getCurrentBJSTemplateFile());
       String generatedBioJsWithJalviewAlignmentAsJson = bioJSTemplateString
               .replaceAll("#sequenceData#", bioJSON).toString();
 
@@ -208,46 +208,6 @@ public class BioJsHTMLOutput
     return selectedFile;
   }
 
-  public static String getBioJsTemplateAsString() throws IOException
-  {
-    InputStreamReader isReader = null;
-    BufferedReader buffReader = null;
-    StringBuilder sb = new StringBuilder();
-    Objects.requireNonNull(getCurrentBJSTemplateFile(),
-            "BioJsTemplate File not initialized!");
-    @SuppressWarnings("deprecation")
-    URL url = getCurrentBJSTemplateFile().toURL();
-    if (url != null)
-    {
-      try
-      {
-        isReader = new InputStreamReader(url.openStream());
-        buffReader = new BufferedReader(isReader);
-        String line;
-        String lineSeparator = System.getProperty("line.separator");
-        while ((line = buffReader.readLine()) != null)
-        {
-          sb.append(line).append(lineSeparator);
-        }
-
-      } catch (Exception ex)
-      {
-        ex.printStackTrace();
-      } finally
-      {
-        if (isReader != null)
-        {
-          isReader.close();
-        }
-
-        if (buffReader != null)
-        {
-          buffReader.close();
-        }
-      }
-    }
-    return sb.toString();
-  }
 
   public static void refreshBioJSVersionsInfo(String dirName)
           throws URISyntaxException