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 Murach's Java Servlets and JSP this week in the Servlets 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: 92
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: 2170
    
  47
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: 92
The object to be serialized has an attribute as File type.
Richard Tookey
Ranch Hand

Joined: Aug 27, 2012
Posts: 1035
    
  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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: File attribute in a serialized Object.
 
Similar Threads
Cannot load applet
How to read a property from a properties file in Ant?
JAD
how to do
How to configure log4j.xml to log only WARN and above logs in JBOSS?