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.SaleinfoÕE£ñWfö L productsalest Ljava/util/ArrayList;xpsr java.util.ArrayListxÒ™Ça I sizexp w
sr Carsguimainexecution.SalesubZã¾ÓÅ xr Carsguimainexecution.SaleProductøié>‘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:-
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;
products.add( new CarsSubProduct( "FordMustang",1,1000,10000 ) );
Please any advice will be really helpful.