Java Path File Read nio loadFile(Path file)

Here you can find the source of loadFile(Path file)

Description

load File

License

Apache License

Declaration

public static Properties loadFile(Path file) throws IOException 

Method Source Code


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

import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Properties;

import java.io.IOException;

public class Main {
    public static Properties loadFile(Path file) throws IOException {
        Properties props = new Properties();
        try (InputStream in = Files.newInputStream(file)) {
            props.load(in);/*w  w  w  .java 2  s  . co  m*/
        }
        return props;
    }
}

Related

  1. getResourceAsStream(String resourcePath, ClassLoader classLoader, Class clazz, String resourceDesc, Consumer logger)
  2. getTestClassPathURLClassLoader(ClassLoader parent)
  3. load(Path p, PrintStream errorStream, String propertyInfo)
  4. loadFile(final Path filePath)
  5. loadFile(final Path p)
  6. loadFile(String path)
  7. loadFromFile(Path path)
  8. loadJSON(Path path)
  9. loadProperties(Path filePath)