Java ObjectOutputStream Write loadData(Class expectedClass, String filename)

Here you can find the source of loadData(Class expectedClass, String filename)

Description

load Data

License

Open Source License

Declaration

public static <T> T loadData(Class<T> expectedClass, String filename) 

Method Source Code


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

import java.io.FileInputStream;

import java.io.ObjectInputStream;

public class Main {
    public static <T> T loadData(Class<T> expectedClass, String filename) {
        T o = null;/*from   w w  w  .j av a 2 s.  co m*/
        try {
            FileInputStream fi = new FileInputStream(filename);
            ObjectInputStream oi = new ObjectInputStream(fi);
            o = expectedClass.cast(oi.readObject());
            oi.close();
            fi.close();
        } catch (Exception e) {
        }
        return o;
    }
}

Related

  1. load(String fileName)
  2. load(String filename)
  3. load(String name, Class resultClass)
  4. load(String path)
  5. loadAllPlaying(String path)
  6. loadData(HashMap data, String filename)
  7. loadGZipObject(File file)
  8. LoadMatFromFile(double[] mat, String filename)
  9. loadObj(String file)