Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.alexey.task6;
- import java.io.*;
- public class StorageService<T extends Serializable> {
- public T Load() throws IOException, ClassNotFoundException {
- FileInputStream fis = new FileInputStream("data.bindb");
- ObjectInputStream oin = new ObjectInputStream(fis);
- return (T) oin.readObject();
- }
- public void Save(T data) throws IOException {
- FileOutputStream fos = new FileOutputStream("data.bindb");
- ObjectOutputStream oos = new ObjectOutputStream(fos);
- oos.writeObject(data);
- oos.flush();
- oos.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement