Question

According to it's doc page, java.util.Properties.load() only accepts a java.io.InputStream . Why is it that I can safely load a FileReader, when it is clearly not a child of InputStream?

This prints the properties from pFile. It works for some reason:

    String pFile = "/path/to/properties/file";
    Properties p = new Properties();
    FileReader fr = new FileReader(pFile);
    p.load(fr);
    System.out.println(p.toString());

Thank you in advance!

Was it helpful?

Solution

Because you're using a version of Java >= 1.6, which introduced Properties.load(Reader).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top