[英]Why is java.io.File's prefixLength transient?
java.io.File
's prefixLength
can be used as an identifier for what type of path the File
contains. java.io.File
的prefixLength
可用作File
包含的路径类型的标识符。 Why is the prefixLength
field transient
? 为什么
prefixLength
字段是transient
?
transient
is used to indicate the field will be ignored by the standard java serialisation process. transient
用于指示标准Java序列化过程将忽略该字段。 In this case it is handled explicitly by the readObject()
method instead. 在这种情况下,它由
readObject()
方法显式处理。 This, and path
are both handled in the same way. 这和
path
都以相同的方式处理。
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. 这样,当在不同平台(Windows,Linux等)上运行的JVM之间对对象进行序列化时,可以使用平台文件系统对
path
进行规范化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.