🌈 搜索
📅  最后修改于: 2022-03-11 14:48:27.956000             🧑  作者: Mango
FileInputStream fis = new FileInputStream("outputFile"); ArrayList objectsList = new ArrayList<>(); boolean cont = true; while (cont) { try (ObjectInputStream input = new ObjectInputStream(fis)) { Object obj = input.readObject(); if (obj != null) { objectsList.add(obj); } else { cont = false; } } catch (Exception e) { // System.out.println(e.printStackTrace()); } }