In the Java project development process, using the properties file as a configuration is basically essential, many such as system configuration information, file upload configuration information, etc. are in this way to save.
At the same time learning to manipulate properties files is also the Java Foundation.
Copy Code code as follows:
public class Propertiesutil {
public static Map Getfileio (String fileName) {
Properties prop = new properties ();
Map propmap=new HashMap ();
InputStream in = PropertiesUtil.class.getResourceAsStream (FileName);
try {
Prop.load (in);
Setkeyset = Prop.keyset ();
for (Object Object:keyset) {
String propvalue= Prop.getproperty (object.tostring ()). ToString ();
Propmap.put (Object.ToString (), Prop.getproperty (Object.ToString ()). ToString ());
System.out.println (object.tostring () + ":" +propvalue);
}
catch (IOException e) {
E.printstacktrace ();
}finally{
try {
In.close ();
catch (IOException e) {
E.printstacktrace ();
}
}
return null;
}
public static void Main (string[] args) {
Getfileio ("/loginurl.properties");
}
}