Load a Properties object from inputstream. - Java java.util

Java examples for java.util:Properties File

Description

Load a Properties object from inputstream.

Demo Code


//package com.java2s;
import java.io.*;
import java.util.Properties;

public class Main {
    /**/*from  ww  w . j a  va2  s .c  o m*/
     * Load a Properties object from inputstream. Close the stream afterward
     * @param is
     * @return
     */
    public static Properties load(InputStream is) {
        Properties properties = new Properties();
        try {
            properties.load(is);
        } catch (IOException e) {
            throw new RuntimeException(e);
        } finally {
            try {
                is.close();
            } catch (IOException e) {
                ;
            }
        }
        return properties;
    }
}

Related Tutorials