Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bookclub1;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.FileOutputStream;
- import java.io.IOException;
- import java.io.ObjectInputStream;
- import java.io.ObjectOutputStream;
- import java.util.LinkedList;
- public class MemberList {
- public static void SaveMember(LinkedList<member> books) throws IOException {
- ObjectOutputStream B;
- try {
- B = new ObjectOutputStream(new FileOutputStream("src/bookclub1/MemberList.txt"));
- B.writeObject(books);
- B.close();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- public static LinkedList<member> readBooks(LinkedList<member> readBooks) throws ClassNotFoundException {
- try {
- ObjectInputStream bookstock = new ObjectInputStream(new FileInputStream("src/bookclub1/Memberlist.txt"));
- readBooks = (LinkedList<member>) bookstock.readObject();
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- } catch (IOException e) {
- e.printStackTrace();
- }
- return readBooks;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement