Here you can find the source of readFileAsProperties(File file)
Properties
object.
Parameter | Description |
---|---|
file | the file to read |
Parameter | Description |
---|---|
IOException | Signals that an I/O exception has occurred. |
Properties
object containing all the properties specified in the file
public static Properties readFileAsProperties(File file) throws IOException
//package com.java2s; //| Licensed under the Apache License, Version 2.0 (the "License"); | import java.io.File; import java.io.FileInputStream; import java.io.IOException; import java.util.Properties; public class Main { /**// w ww .j a v a 2s .c om * Uses the contents of a file to populate a <code>Properties</code> object. * * @param file the file to read * * @return A <code>Properties</code> object containing all the properties * specified in the file * * @throws IOException Signals that an I/O exception has occurred. */ public static Properties readFileAsProperties(File file) throws IOException { Properties properties = new Properties(); properties.load(new FileInputStream(file)); return properties; } }