- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
public class DataRetriever
{
public static Object deserializeData(String fileName)
{
Object returnValue = null;
try
{
File inputFile = new File(fileName);
if (inputFile.exists() && inputFile.isFile())
{
try (ObjectInputStream readIn = new ObjectInputStream(new FileInputStream(fileName)))
{
returnValue = readIn.readObject();
}
}
else
{
throw new RuntimeException(new FileNotFoundException(fileName + " not found"));
}
}
catch (ClassNotFoundException | IOException exc)
{
throw new RuntimeException(exc);
}
return returnValue;
}
private DataRetriever() { throw new AssertionError(); }
}
Комментарии (6) RSS
Добавить комментарий