Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Update Serializable Object

 
Amit Bathla
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sir i want to know how to update object that i have written in file..
that is serialized object..
please help me sir
thanks
Amit
 
Amit Bathla
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just tell me how to delete one or more objects from a file that i have written into file....
Amit
 
karthikeyan Chockalingam
Ranch Hand
Posts: 259
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have provided a sample code to serialize and deserialize.


 
Amit Bathla
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
that i know sir..
but how to delete or update an object from file???
Amit
 
Garrett Rowe
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You'll have to explain a bit further what you're trying to do. Does your file conatain an array of objects, and you want to delete one. Or does your file contain just one object and you want to erase it. (Although it seem you could do that by just deleting the file).
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the objects are written sequentially to the file, the only way you're going to update it is to read all of the objects from the file into memory, and then write the updated objects to the file.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic