File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File attribute in a serialized Object.

 
Santosh Kumar Nayak
Ranch Hand
Posts: 141
Eclipse IDE IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 2878
59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 141
Eclipse IDE IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The object to be serialized has an attribute as File type.
 
Richard Tookey
Bartender
Pie
Posts: 1166
17
Java Linux Netbeans IDE
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 989
9
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic