< prev index next >

src/java.base/share/classes/java/io/File.java

Print this page




2131      * @return  A hash code for this abstract pathname
2132      */
2133     public int hashCode() {
2134         return fs.hashCode(this);
2135     }
2136 
2137     /**
2138      * Returns the pathname string of this abstract pathname.  This is just the
2139      * string returned by the <code>{@link #getPath}</code> method.
2140      *
2141      * @return  The string form of this abstract pathname
2142      */
2143     public String toString() {
2144         return getPath();
2145     }
2146 
2147     /**
2148      * WriteObject is called to save this filename.
2149      * The separator character is saved also so it can be replaced
2150      * in case the path is reconstituted on a different host type.
2151      * <p>
2152      * @serialData  Default fields followed by separator character.
2153      */
2154     private synchronized void writeObject(java.io.ObjectOutputStream s)
2155         throws IOException
2156     {
2157         s.defaultWriteObject();
2158         s.writeChar(separatorChar); // Add the separator character
2159     }
2160 
2161     /**
2162      * readObject is called to restore this filename.
2163      * The original separator character is read.  If it is different
2164      * than the separator character on this system, then the old separator
2165      * is replaced by the local separator.
2166      */
2167     private synchronized void readObject(java.io.ObjectInputStream s)
2168          throws IOException, ClassNotFoundException
2169     {
2170         ObjectInputStream.GetField fields = s.readFields();
2171         String pathField = (String)fields.get("path", null);




2131      * @return  A hash code for this abstract pathname
2132      */
2133     public int hashCode() {
2134         return fs.hashCode(this);
2135     }
2136 
2137     /**
2138      * Returns the pathname string of this abstract pathname.  This is just the
2139      * string returned by the <code>{@link #getPath}</code> method.
2140      *
2141      * @return  The string form of this abstract pathname
2142      */
2143     public String toString() {
2144         return getPath();
2145     }
2146 
2147     /**
2148      * WriteObject is called to save this filename.
2149      * The separator character is saved also so it can be replaced
2150      * in case the path is reconstituted on a different host type.
2151      *
2152      * @serialData  Default fields followed by separator character.
2153      */
2154     private synchronized void writeObject(java.io.ObjectOutputStream s)
2155         throws IOException
2156     {
2157         s.defaultWriteObject();
2158         s.writeChar(separatorChar); // Add the separator character
2159     }
2160 
2161     /**
2162      * readObject is called to restore this filename.
2163      * The original separator character is read.  If it is different
2164      * than the separator character on this system, then the old separator
2165      * is replaced by the local separator.
2166      */
2167     private synchronized void readObject(java.io.ObjectInputStream s)
2168          throws IOException, ClassNotFoundException
2169     {
2170         ObjectInputStream.GetField fields = s.readFields();
2171         String pathField = (String)fields.get("path", null);


< prev index next >