Java FileInputStream Read readFileAsProperties(File file)

Here you can find the source of readFileAsProperties(File file)

Description

Uses the contents of a file to populate a Properties object.

License

Apache License

Parameter

Parameter Description
file the file to read

Exception

Parameter Description
IOException Signals that an I/O exception has occurred.

Return

A Properties object containing all the properties specified in the file

Declaration

public static Properties readFileAsProperties(File file) throws IOException 

Method Source Code

//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;
    }
}

Related

  1. readFile(String resource)
  2. readFile(String sFileName)
  3. readFileAsBinary(File file)
  4. readFileAsInputStream(File file)
  5. readFileAsInputStream(String fileName)
  6. readFileAsResource(String fileName)
  7. ReadFileAsUtf8String(String filePath)
  8. readFileAtOnce(final File file)
  9. readFileBinaries(File file)