Because you're using a version of Java >= 1.6, which introduced Properties.load(Reader).
How can properties.load() accept a non-inputStream
-
03-12-2021 - |
题
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!
解决方案
不隶属于 StackOverflow