java - What is the difference between the object serialization and Filewriter? -
i going through head first java,and have reached serialization topic,it states if if data used java,program generated use serialization or else if data used other programs write plain text file.
but have read serialization of object jvm independent. when serialize object,the data gets saved when use filewriter , filereader print gets stored in file,different serialization right?
also when bufferedreader used,how use in cse filewriter.
serialization 1 (of various) concepts describes how achieve persistence java objects. term refers protocol used turn object stream of bits , bytes.
what do stream of bits , bytes depends ... on well; want it.
a filewriter on other hand; unrelated "concept" - part of io framework java offers resolve tasks "reading or writing from/to file system".
in other words: can use serialization turn java objects bits , bytes. can use filewriter; or 1 of many specific subclasses bits , bytes ... memory file lives on disc.
for other parts of question - wholeheartedly recommend study many many online resources yourself. intention of site help programming problems; not teach things can find in zillions of books or web sites.
to address comments: if dealing java object, can call methods. if dealing raw bits , bytes ... can write somewhere; or read them somewhere. , can take bytes, , re-constitute java object them. on can call methods again. taking money bank account: when "persist" money, information numbers stored somewhere (but nobody keeps your coins , bills in your account). can come later on, information looked up; , receive new coins when doing withdrawal. maybe helps ..
Comments
Post a Comment