Java Path File Read nio read(String filePath)

Here you can find the source of read(String filePath)

Description

read

License

Open Source License

Declaration

public static Object read(String filePath) throws IOException, ClassNotFoundException 

Method Source Code


//package com.java2s;
import java.io.IOException;
import java.io.ObjectInputStream;

import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;

public class Main {
    public static Object read(String filePath) throws IOException, ClassNotFoundException {
        Path path = Paths.get(filePath);
        try (ObjectInputStream input = new ObjectInputStream(Files.newInputStream(path))) {
            return input.readObject();
        }/* ww  w  .jav a  2 s  .c  om*/
    }
}

Related

  1. newBufferedReader(Path path)
  2. openBufferedReader(String pathOrUrl)
  3. openForReadingAndWriting(String filePath)
  4. openResourceReader(Class resourceOrigin, String resourcePath)
  5. read(String aPathString)
  6. read(String filePath)
  7. read(String path)
  8. readAllLines(Path path)
  9. readAllLines(String path)