Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //моя функция сериализации, в цикле из main передаётся производный от абстрактного класса Composition объект
- public void writeToFile(Composition c) throws IOException{
- ObjectOutputStream objectOutputStream=new ObjectOutputStream(new FileOutputStream("Com.bin",true));
- objectOutputStream.writeObject(c);
- }
- //функция десериализации, не работает
- public Composition[] readFile() throws IOException, ClassNotFoundException{
- Composition[] vid;
- try (ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream("Com.bin"))) {
- vid = (Composition[]) objectInputStream.readObject();
- }
- return vid;
- }
Advertisement
Add Comment
Please, Sign In to add comment