commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert V Sasseen <rvsass...@hotmail.com>
Subject [configuration] reading full text of PropertiesConfiguration file in 2.0
Date Sat, 12 Nov 2016 02:47:58 GMT
Is there a straightforward way to get the full text of the properties file from a PropertiesConfiguration
object in 2.0? In 1.x I could do


        PropertiesConfiguration propertiesConfiguration = new PropertiesConfiguration("my.properties");

        URL url = propertiesConfiguration.getURL();
        String cont = IOUtils.toString((InputStream) url.openConnection().getContent(), StandardCharsets.UTF_8);


This worked for both properties file in my jar and in the filesystem on the classpath. But
in 2.0 PropertiesConfiguration does not have a method getURL().


Since PropertiesConfiguration has a (somewhat) complicated algorithm for finding properties
in the classpath and filesystem, I want to let it carry out its algorithm, then ask it where
it found the file, rather than having to try to understand and replicate the algorithm.


If you're wondering why I want the text, I want to be able to show my user exactly what the
file looks like, even if it's hidden away in a jar file. I know (a little) about PropertiesConfigurationLayout,
but I'd prefer to just get the file text rather than reconstruct an approximation of it using
that.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message