src/java.base/share/classes/java/io/File.java
changeset 57956 e0b8b019d2f5
parent 57816 a445d4305fad
child 58288 48e480e56aad
equal deleted inserted replaced
57955:18863bf3501f 57956:e0b8b019d2f5
  2215      * The separator character is saved also so it can be replaced
  2215      * The separator character is saved also so it can be replaced
  2216      * in case the path is reconstituted on a different host type.
  2216      * in case the path is reconstituted on a different host type.
  2217      *
  2217      *
  2218      * @serialData  Default fields followed by separator character.
  2218      * @serialData  Default fields followed by separator character.
  2219      */
  2219      */
       
  2220     @java.io.Serial
  2220     private synchronized void writeObject(java.io.ObjectOutputStream s)
  2221     private synchronized void writeObject(java.io.ObjectOutputStream s)
  2221         throws IOException
  2222         throws IOException
  2222     {
  2223     {
  2223         s.defaultWriteObject();
  2224         s.defaultWriteObject();
  2224         s.writeChar(separatorChar); // Add the separator character
  2225         s.writeChar(separatorChar); // Add the separator character
  2228      * readObject is called to restore this filename.
  2229      * readObject is called to restore this filename.
  2229      * The original separator character is read.  If it is different
  2230      * The original separator character is read.  If it is different
  2230      * than the separator character on this system, then the old separator
  2231      * than the separator character on this system, then the old separator
  2231      * is replaced by the local separator.
  2232      * is replaced by the local separator.
  2232      */
  2233      */
       
  2234     @java.io.Serial
  2233     private synchronized void readObject(java.io.ObjectInputStream s)
  2235     private synchronized void readObject(java.io.ObjectInputStream s)
  2234          throws IOException, ClassNotFoundException
  2236          throws IOException, ClassNotFoundException
  2235     {
  2237     {
  2236         ObjectInputStream.GetField fields = s.readFields();
  2238         ObjectInputStream.GetField fields = s.readFields();
  2237         String pathField = (String)fields.get("path", null);
  2239         String pathField = (String)fields.get("path", null);
  2249             = UNSAFE.objectFieldOffset(File.class, "path");
  2251             = UNSAFE.objectFieldOffset(File.class, "path");
  2250     private static final long PREFIX_LENGTH_OFFSET
  2252     private static final long PREFIX_LENGTH_OFFSET
  2251             = UNSAFE.objectFieldOffset(File.class, "prefixLength");
  2253             = UNSAFE.objectFieldOffset(File.class, "prefixLength");
  2252 
  2254 
  2253     /** use serialVersionUID from JDK 1.0.2 for interoperability */
  2255     /** use serialVersionUID from JDK 1.0.2 for interoperability */
       
  2256     @java.io.Serial
  2254     private static final long serialVersionUID = 301077366599181567L;
  2257     private static final long serialVersionUID = 301077366599181567L;
  2255 
  2258 
  2256     // -- Integration with java.nio.file --
  2259     // -- Integration with java.nio.file --
  2257 
  2260 
  2258     private transient volatile Path filePath;
  2261     private transient volatile Path filePath;