Java Path File Read nio readJsonObject(Path path, TypeReference typeReference)

Here you can find the source of readJsonObject(Path path, TypeReference typeReference)

Description

read Json Object

License

Open Source License

Declaration

public static <T> T readJsonObject(Path path, TypeReference<T> typeReference) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;

import java.nio.file.Path;

public class Main {
    public static <T> T readJsonObject(Path path, TypeReference<T> typeReference) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        return mapper.readValue(path.toFile(), typeReference);
    }/*from w w w.j av a2 s.co m*/
}

Related

  1. readFromFile(String path)
  2. readFromFile(String path)
  3. readFully(Path filePath)
  4. readIntsFromFile(String filePath)
  5. readJson(Class dataClass, Path path)
  6. readKeyFile(String path)
  7. readLine(BufferedReader br, Path path)
  8. readLineByLine(String filePath)
  9. readLines(Path path, boolean ignoreComments)