UnixUriUtils.java revision 3497
403N/A * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved. 56N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 56N/A * This code is free software; you can redistribute it and/or modify it 56N/A * under the terms of the GNU General Public License version 2 only, as 56N/A * published by the Free Software Foundation. Oracle designates this 56N/A * particular file as subject to the "Classpath" exception as provided 56N/A * by Oracle in the LICENSE file that accompanied this code. 56N/A * This code is distributed in the hope that it will be useful, but WITHOUT 56N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 56N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 56N/A * version 2 for more details (a copy is included in the LICENSE file that 56N/A * accompanied this code). 56N/A * You should have received a copy of the GNU General Public License version 56N/A * 2 along with this work; if not, write to the Free Software Foundation, 56N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 56N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 56N/A * or visit www.oracle.com if you need additional information or have any 56N/A * Unix specific Path <--> URI conversion 56N/A // compatability with java.io.File 56N/A // transformation use raw path 102N/A // transform escaped octets and unescaped characters to bytes 56N/A * Converts Path to URI 399N/A // trailing slash if directory 414N/A // The following is copied from java.net.URI 414N/A // Compute the low-order mask for the characters in the given string 414N/A for (
int i =
0; i < n; i++) {
414N/A // Compute the high-order mask for the characters in the given string 414N/A for (
int i =
0; i < n; i++) {
56N/A if ((c >=
64) && (c <
128))
56N/A m |= (
1L << (c -
64));
56N/A // Compute a low-order mask for the characters 56N/A // between first and last, inclusive 56N/A for (
int i = f; i <= l; i++)
56N/A // Compute a high-order mask for the characters 56N/A // between first and last, inclusive 56N/A for (
int i = f; i <= l; i++)
56N/A // Tell whether the given character is permitted by the given mask pair 414N/A if ((c >=
'0') && (c <=
'9'))
414N/A if ((c >=
'a') && (c <=
'f'))
414N/A if ((c >=
'A') && (c <=
'F'))
414N/A // digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | 414N/A // upalpha = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | 56N/A // "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | 102N/A // "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" 102N/A // lowalpha = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | 56N/A // "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | 414N/A // "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" 414N/A // alpha = lowalpha | upalpha 414N/A // alphanum = alpha | digit 423N/A // mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | 423N/A // unreserved = alphanum | mark 423N/A // pchar = unreserved | escaped | 414N/A // ":" | "@" | "&" | "=" | "+" | "$" | "," 414N/A // All valid path characters 414N/A '0',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
414N/A '8',
'9',
'A',
'B',
'C',
'D',
'E',
'F'