Results 1 to 4 of 4
Thread: Serializing Arrays
- 11-06-2007, 07:29 PM #1
Member
- Join Date
- Nov 2007
- Posts
- 97
- Rep Power
- 0
Serializing Arrays
We can serialize objects of classes which implement Serializable interface.
I also understand that we can serialize Vectors as they also implement Serializable interface. Can we serialize arrays? If yes, then of which type?Java Code:import java.io.Serializable; public class MyClass implements Serializable{ ... }
Thanks in advance.
- 11-06-2007, 08:11 PM #2
Can we serialize arrays?
You could create an ArrayList with an array. ArrayList is also serializable.
Otherwise, probably.
If yes, then of which type?
Possibly most any.
You might be able to make a class (implementing Serializable) to do the serializing for you; it could specify the array type and include the necessary methods to read and write the array. Or you could have the array (whose type implements Serializable) and the methods included in another class. This is speculation: I have never tried these.
Object Streams
- 11-08-2007, 09:00 AM #3
Member
- Join Date
- Nov 2007
- Posts
- 97
- Rep Power
- 0
Ok thanks. What I understood is that if we have an Array of a type A (where A can be Integer, String etc), and A implements Serializable, then it can also be serialized.
I will try this.
- 11-08-2007, 09:09 AM #4
Member
- Join Date
- Nov 2007
- Posts
- 97
- Rep Power
- 0
Similar Threads
-
new to arrays
By jimJohnson in forum New To JavaReplies: 1Last Post: 04-08-2008, 02:45 PM -
2D-Arrays
By kbyrne in forum New To JavaReplies: 1Last Post: 02-07-2008, 10:08 PM -
arrays help
By Warren in forum New To JavaReplies: 6Last Post: 11-23-2007, 07:23 PM -
How do I omit an object when serializing?
By Hasan in forum Advanced JavaReplies: 1Last Post: 05-31-2007, 04:18 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks