Java Properties Load from File loadProperties(File file, String charset)

Here you can find the source of loadProperties(File file, String charset)

Description

load Properties

License

Apache License

Declaration

public static Properties loadProperties(File file, String charset)
        throws IOException 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.util.Properties;

public class Main {

    public static Properties loadProperties(File file, String charset)
            throws IOException {
        InputStream in = null;//from  www . ja  v  a2 s  .  c  o m
        try {
            in = new FileInputStream(file);
            return loadProperties(in, charset);
        } finally {
            if (in != null) {
                in.close();
            }
        }
    }

    public static Properties loadProperties(InputStream in, String charset)
            throws IOException {
        return loadProperties(new InputStreamReader(in, charset));
    }

    public static Properties loadProperties(Reader reader)
            throws IOException {
        Properties props = new Properties();
        props.load(reader);
        return props;
    }
}

Related

  1. loadProperties(File file)
  2. loadProperties(File file)
  3. loadProperties(File file)
  4. loadProperties(File file)
  5. loadProperties(File file)
  6. loadProperties(File fileName)
  7. loadProperties(File path)
  8. loadProperties(File propertyFile)
  9. loadProperties(File propertyFile, Properties properties)