Question :The object serialization classes are stream oriented. How do I write
objects to a random access file? (CoreJava)
Answer :Currently there is no direct way to write objects to a random access file.
You can use the ByteArray I/O streams as an intermediate place to write
and read bytes to/from the random access file and create Object I/O
streams from the byte streams to write/read the objects. You just have to
make sure that you have the entire object in the byte stream or
reading/writing the object will fail.
For example, java.io.ByteArrayOutputStream can be used to receive the
bytes of ObjectOutputStream. From it you can get a byte[] of the result
which, in turn, can be used with ByteArrayInputStream as input to
ObjectInput.
www.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.
Thursday, March 12, 2009
The object serialization classes are stream oriented. How do I write
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment