From 38161fcaf592e9a233b87c80b68029c6eb247638 Mon Sep 17 00:00:00 2001 From: kjvdheide Date: Thu, 4 Jan 2018 02:47:58 +0000 Subject: [PATCH] JAL-2871 added inputstream constructor to Configuration --- .../org/forester/archaeopteryx/Configuration.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/forester/java/src/org/forester/archaeopteryx/Configuration.java b/forester/java/src/org/forester/archaeopteryx/Configuration.java index 3db44f7..6797874 100644 --- a/forester/java/src/org/forester/archaeopteryx/Configuration.java +++ b/forester/java/src/org/forester/archaeopteryx/Configuration.java @@ -33,6 +33,7 @@ import java.io.BufferedReader; import java.io.File; import java.io.FileReader; import java.io.IOException; +import java.io.InputStream; import java.io.InputStreamReader; import java.net.URL; import java.util.Arrays; @@ -276,7 +277,23 @@ public final class Configuration { public Configuration() { this( null, false, false, false ); } - + public Configuration(final InputStream is, final boolean is_applet, final boolean verbose) { + + setDisplayColors( new TreeMap() ); + try { + InputStreamReader isr = new InputStreamReader(is); + final BufferedReader bf = new BufferedReader( isr ); + readConfig( bf ); + bf.close(); + ForesterUtil.programMessage( AptxConstants.PRG_NAME, "successfully read from configuration url [" + + config_filename + "]" ); + _could_read_config_file = true; + } + catch ( final Exception e ) { + ForesterUtil.printWarningMessage( AptxConstants.PRG_NAME, "failed to read configuration from [" + + config_filename + "]: " + e.getLocalizedMessage() ); + } + } public Configuration( final String cf, final boolean is_url, final boolean is_applet, final boolean verbose ) { if ( ForesterUtil.isEmpty( cf ) ) { config_filename = default_config_filename; -- 1.7.10.2