jdk/src/java.base/share/classes/java/net/URI.java
changeset 32649 2ee9017c7597
parent 31471 ae27c6f1d8bf
child 34774 03b4e6dc367b
equal deleted inserted replaced
32648:1fa861caf840 32649:2ee9017c7597
   490     private transient String path;              // null ==> opaque
   490     private transient String path;              // null ==> opaque
   491     private transient String query;
   491     private transient String query;
   492 
   492 
   493     // The remaining fields may be computed on demand
   493     // The remaining fields may be computed on demand
   494 
   494 
   495     private volatile transient String schemeSpecificPart;
   495     private transient volatile String schemeSpecificPart;
   496     private volatile transient int hash;        // Zero ==> undefined
   496     private transient volatile int hash;        // Zero ==> undefined
   497 
   497 
   498     private volatile transient String decodedUserInfo = null;
   498     private transient volatile String decodedUserInfo = null;
   499     private volatile transient String decodedAuthority = null;
   499     private transient volatile String decodedAuthority = null;
   500     private volatile transient String decodedPath = null;
   500     private transient volatile String decodedPath = null;
   501     private volatile transient String decodedQuery = null;
   501     private transient volatile String decodedQuery = null;
   502     private volatile transient String decodedFragment = null;
   502     private transient volatile String decodedFragment = null;
   503     private volatile transient String decodedSchemeSpecificPart = null;
   503     private transient volatile String decodedSchemeSpecificPart = null;
   504 
   504 
   505     /**
   505     /**
   506      * The string form of this URI.
   506      * The string form of this URI.
   507      *
   507      *
   508      * @serial
   508      * @serial
  2173     // possible, otherwise return the number of segments found.
  2173     // possible, otherwise return the number of segments found.
  2174     //
  2174     //
  2175     // This method takes a string argument rather than a char array so that
  2175     // This method takes a string argument rather than a char array so that
  2176     // this test can be performed without invoking path.toCharArray().
  2176     // this test can be performed without invoking path.toCharArray().
  2177     //
  2177     //
  2178     static private int needsNormalization(String path) {
  2178     private static int needsNormalization(String path) {
  2179         boolean normal = true;
  2179         boolean normal = true;
  2180         int ns = 0;                     // Number of segments
  2180         int ns = 0;                     // Number of segments
  2181         int end = path.length() - 1;    // Index of last char in path
  2181         int end = path.length() - 1;    // Index of last char in path
  2182         int p = 0;                      // Index of next char in path
  2182         int p = 0;                      // Index of next char in path
  2183 
  2183 
  2230     //
  2230     //
  2231     // Postconditions:
  2231     // Postconditions:
  2232     //   All slashes in path replaced by '\0'
  2232     //   All slashes in path replaced by '\0'
  2233     //   segs[i] == Index of first char in segment i (0 <= i < segs.length)
  2233     //   segs[i] == Index of first char in segment i (0 <= i < segs.length)
  2234     //
  2234     //
  2235     static private void split(char[] path, int[] segs) {
  2235     private static void split(char[] path, int[] segs) {
  2236         int end = path.length - 1;      // Index of last char in path
  2236         int end = path.length - 1;      // Index of last char in path
  2237         int p = 0;                      // Index of next char in path
  2237         int p = 0;                      // Index of next char in path
  2238         int i = 0;                      // Index of current segment
  2238         int i = 0;                      // Index of current segment
  2239 
  2239 
  2240         // Skip initial slashes
  2240         // Skip initial slashes
  2279     //   path computed by split, as above, with '\0' having replaced '/'
  2279     //   path computed by split, as above, with '\0' having replaced '/'
  2280     //
  2280     //
  2281     // Postconditions:
  2281     // Postconditions:
  2282     //   path[0] .. path[return value] == Resulting path
  2282     //   path[0] .. path[return value] == Resulting path
  2283     //
  2283     //
  2284     static private int join(char[] path, int[] segs) {
  2284     private static int join(char[] path, int[] segs) {
  2285         int ns = segs.length;           // Number of segments
  2285         int ns = segs.length;           // Number of segments
  2286         int end = path.length - 1;      // Index of last char in path
  2286         int end = path.length - 1;      // Index of last char in path
  2287         int p = 0;                      // Index of next path char to write
  2287         int p = 0;                      // Index of next path char to write
  2288 
  2288 
  2289         if (path[p] == '\0') {
  2289         if (path[p] == '\0') {
  2643     private static final long H_SCOPE_ID
  2643     private static final long H_SCOPE_ID
  2644         = H_ALPHANUM | highMask("_.");
  2644         = H_ALPHANUM | highMask("_.");
  2645 
  2645 
  2646     // -- Escaping and encoding --
  2646     // -- Escaping and encoding --
  2647 
  2647 
  2648     private final static char[] hexDigits = {
  2648     private static final char[] hexDigits = {
  2649         '0', '1', '2', '3', '4', '5', '6', '7',
  2649         '0', '1', '2', '3', '4', '5', '6', '7',
  2650         '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
  2650         '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
  2651     };
  2651     };
  2652 
  2652 
  2653     private static void appendEscape(StringBuffer sb, byte b) {
  2653     private static void appendEscape(StringBuffer sb, byte b) {