Java FileReader Read load(String fileName, Class klass)

Here you can find the source of load(String fileName, Class klass)

Description

load

License

Open Source License

Declaration

public static <T> T load(String fileName, Class<T> klass) throws IOException 

Method Source Code


//package com.java2s;
import java.io.File;
import java.io.FileReader;

import java.io.IOException;

import com.google.gson.Gson;

public class Main {
    public static <T> T load(String fileName, Class<T> klass) throws IOException {
        File file = new File(fileName);

        Gson gson = new Gson();
        try (FileReader rdr = new FileReader(file)) {
            return gson.fromJson(rdr, klass);
        }//from w  w w.  j  a va 2 s .co  m
    }
}

Related

  1. load(String filename)
  2. loadIndex(File root_)
  3. loadJSON(File file)
  4. loadKeggInteractions(String species, String location)
  5. readFile(File f)