public static String getBioJsTemplateAsString(AlignmentI bio)
throws IOException
{
- StringBuilder sb = new StringBuilder();
+ InputStreamReader isReader = null;
+ BufferedReader buffReader = null;
+ StringBuilder sb = new StringBuilder();
URL url = bio.getClass().getResource(
"/templates/BioJSTemplate.txt");
if (url != null)
{
try
{
- BufferedReader reader = new BufferedReader(new InputStreamReader(
- url.openStream()));
+ isReader = new InputStreamReader(url.openStream());
+ buffReader = new BufferedReader(isReader);
String line;
String lineSeparator = System.getProperty("line.separator");
- while ((line = reader.readLine()) != null)
+ 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();
+ }
}
}