Reputation: 5960
java.io.File
's prefixLength
can be used as an identifier for what type of path the File
contains. Why is the prefixLength
field transient
?
Upvotes: 1
Views: 226
Reputation: 3238
transient
is used to indicate the field will be ignored by the standard java serialisation process. In this case it is handled explicitly by the readObject()
method instead. This, and path
are both handled in the same way.
This is so that when objects are serialised between JVMs running on different platforms (Windows, Linux, etc) the path
can be normalised using the platforms file system.
Upvotes: 4