Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def specifedLoadFromFile[T](filePath:File)(implicit tag:ClassTag[T]): T = {
- try {
- val oos = new ObjectInputStream(new FileInputStream(filePath))
- val data = oos.readObject.asInstanceOf[T]
- oos.close()
- data
- } catch {
- case e: Exception => new T()//Типо ,если не могли прочитать из файла, то создадим пустую
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement