Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get current root object after pause to copy to disk  RSS feed

Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi everybody

I am struck at a point where i am tring to copy the objects from a pipe to a module.The module has a pause method which stops the process of copying from the pipe for some fixed time,but i want to safeguard the records in progress and save them to disk.I am writing the following code to write the record and read it back by two methods ie pause() and resume().I want to get the root object after the pause method.can any one help me out

below is the code

public void pause(){

Object pobj = new Object();
boolean status=true;
while (status)
try {

//get the root object at the time of pause and then save all in to disk
Record rootobject = (Record)pobj.get();
//saving the record objects to disk
FileOutputStream fsave = new FileOutputStream("c:\\store\\pauseobj.ser");
ObjectOutputStream oos = new ObjectOutputStream(fsave);
//here have to write the root object
fsave.write( rootobject );
}catch(InterruptedException e){};

};//end of pause()

public void resume(){
FileInputStream fis = new FileInputStream( "c:\\store\\pasueobj.ser");
ObjectInputStream oos = new ObjectInputStream( fis );
Object rootobject = oos.readObject();

};//end of resume()

thanking you in advance

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!