wood burning stoves 2.0*
The moose likes I/O and Streams and the fly likes File attribute in a serialized Object. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "File attribute in a serialized Object." Watch "File attribute in a serialized Object." New topic
Author

File attribute in a serialized Object.

Santosh Kumar Nayak
Ranch Hand

Joined: Aug 02, 2011
Posts: 93
In a class which is implementing Serializable Interface there exists an attribute of a File type.

How do we handle such attribute ?
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2253
    
  48
Sorry but I don't understand what your problem is, can you provide more detail.
For example: Is your problem specifically to do with serialization? what do you mean "How do we handle such attribute"?
Santosh Kumar Nayak
Ranch Hand

Joined: Aug 02, 2011
Posts: 93
The object to be serialized has an attribute as File type.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1050
    
  10

Santosh Kumar Nayak wrote:The object to be serialized has an attribute as File type.


I don't really understand your problem since class java.io.File is serializable so an attribute of type File will be serialised when the containing class is serialised !
E Armitage
Rancher

Joined: Mar 17, 2012
Posts: 892
    
    9
Remember that a File is just an abstract representation of a file/directory pathname.
The File class already overrides writeObject and readObject to make the path system independent when serializing and de-serializing on different systems.
 
Consider Paul's rocket mass heater.
 
subject: File attribute in a serialized Object.