In this post I will be giving you syntax to read write java object to a file stream
for distributed programming
How to write a java object to a FileOutPutStream
You may need to write a java object to a file FileOutPutStream
for distributed programming.
The syntax is as below:
FileOutPutStream MyFileStream = new FileOutPutStream("temp");
ObjectOutPutStream MyOutput = new ObjectOutPutStream(MyFileStream);
MyOutput.writeObject("Today");
MyOutput.Close();
How to read a java object from a FileInputStream
You may need to read a java object using FileInputStream
for distributed programming.
The syntax is as below:
FileInputStream MyFileStream = new FileInputStream(filename);
ObjectInPutStream MyInput = new ObjectInPutStream(MyFileStream);
Object obj = MyInput.readObject();
MyInput.Close();
Thus we can serialize and construct the object again from file stream
for distributed programming
How to write a java object to a FileOutPutStream
You may need to write a java object to a file FileOutPutStream
for distributed programming.
The syntax is as below:
FileOutPutStream MyFileStream = new FileOutPutStream("temp");
ObjectOutPutStream MyOutput = new ObjectOutPutStream(MyFileStream);
MyOutput.writeObject("Today");
MyOutput.Close();
How to read a java object from a FileInputStream
You may need to read a java object using FileInputStream
for distributed programming.
The syntax is as below:
FileInputStream MyFileStream = new FileInputStream(filename);
ObjectInPutStream MyInput = new ObjectInPutStream(MyFileStream);
Object obj = MyInput.readObject();
MyInput.Close();
Thus we can serialize and construct the object again from file stream
No comments:
Post a Comment