HI i am using this syntax to store arraylist to inventory.dat file.When i store, it give a scattered output on the .dat file like this.....
sr Carsguimainexecution.SaleinfoEWf L productsalest Ljava/util/ArrayList;xpsr java.util.ArrayListxa I sizexp w
sr Carsguimainexecution.SalesubZ㾝 xr Carsguimainexecution.SaleProducti>2q I CarnumberD pricesoldI
productNumberD stockD unitsoldL Carbuyert Ljava/lang/String;L Carnameq ~ xp t Defaultq ~ sq ~ @I @@ @$ t dsdggsdrft fgsgsfsq ~ @@ @| @& t dfgdrht gyjgyjsq ~ @@ @p @( t dfsbt fddndfsq ~ @@ @È @$ t sdfsdft sdfsfsfsq ~ @$ @y @D t dsdgrght hdhdhsq ~ @$ @@ @Y t fbdfbt dfbdfbsq ~ @$ @Y @$ t defaultt defaultsq ~ t Defaultt Defaultx
Is the output an error or its correct,and if its correct how can i load this information back to an arraylist.
To Store,this is what i use excluding the try and catch:-
Code :File f = new File( "C:\\data\\inventory.dat" ); FileOutputStream out = new FileOutputStream( f ); ObjectOutputStream objectOut = new ObjectOutputStream( out ); objectOut.writeObject( inv );
This is a sample of how my arraylist looks like;
Code :products.add( new CarsSubProduct( "FordMustang",1,1000,10000 ) );
Please any advice will be really helpful.
