java - Can't open Object Arraylist with fileio function -


I'm trying to use the function to open an array of objects with fileIO, but right now I'm stuck I think there is something wrong with my setter function (file test.txt already exists)

The following sections I am using to get the file work to work < / P>

Paslijst

  Public class Paslijst implies Serializable {Private ArrayList & lt; Pas & gt; Paslijst; Public Arrestist & lt; Pas & gt; Set Pastist (Array List and Lt; Pas & gt; Palestist) {this.paslijst = paslijst; Return petitionist; } This function opens a file that throws the Public Pellowship Open (String Fiction) IOException;  

File IOPAS

 Is ClassNotFoundException {FileInputStream FileInputStream = new file inputstream (filename); ObjectInputStream Object InputStream = New ObjectInputStream (fileInputStream); Return (Paslijst) objectInputStream.readObject (); }  main  

  public static zero major Paslijst paslijst = new Paslijst (); Try {paslijst.setPaslijst (fileiopas.openen ("test.txt")); } Hold (IOE EXPRESS E) {System.out.println ("Open the IO Open, want:" + E. T. String ()); } Catch (ClarusotfoException E) {System.out.println ("The class was not found:" + e.toString ()); }}  

You were making false arguments in paslijst.setPaslijst (). I have edited your class can help it

  public square key {public static zero main (string [] args) {FileIOPas fileiopas = new FileIopas (); Paslijst paslijst = New Paslijst (); Paslijst.setPaslijst (fileiopas.openen ("test.txt")); }} Public class filesyops {public array list & lieutenant; Pas & gt; Open (String Filename) {Try (File InputTream FileInputStream = New FileInputStream (Fiction); Object InputStream Object InputStream = New Object InputStream;) {Return (Array List & Lt; Pass & gt;) Object InputStream Read object (); } Hold (exception exception) {exception.printStackTrace (); } Return tap; }} Public Class Paslijst implies Serializable {Private ArrayList & lt; Pas & gt; Paslijst; Public Arrestist & lt; Pas & gt; GetPaslijst () {returns paslijst; } Public Zero Set Pastalist (Array List and Lt; Pas & gt; Palestist) {this.paslijst = paslijst; }}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -