public static InputStream getInputStream(URL url) throws IOException { if ("file".equals(url.getProtocol())) { String path = url.getFile().replace('/', File.separatorChar); path = ParseUtil.decode(path); return new FileInputStream(path); } else { return url.openStream(); } }
private static URL getFileURL(File file) { try { file = file.getCanonicalFile(); } catch (IOException e) {} try { return ParseUtil.fileToEncodedURL(file); } catch (MalformedURLException e) { // Should never happen since we specify the protocol... throw new InternalError(); } }
static String[] parseExtDirs(String codebase, int start) { String s = System.getProperty(EXTDIRS_PROPERTY); String globalPrefix = (start > 0 ? codebase.substring(0, start) : "file:"); int end = start + EXTDIRS_EXPANSION.length(); String globalSuffix = (end < codebase.length() ? codebase.substring(end) : (String) null); String[] dirs = null; String localSuffix; if (s != null) { StringTokenizer st = new StringTokenizer(s, File.pathSeparator); int count = st.countTokens(); dirs = new String[count]; for (int i = 0; i < count; i++) { File file = new File(st.nextToken()); dirs[i] = sun.net.www.ParseUtil.encodePath (file.getAbsolutePath()); if (!dirs[i].startsWith("/")) { dirs[i] = "/" + dirs[i]; } localSuffix = (globalSuffix == null ? (dirs[i].endsWith("/") ? "*" : "/*") : globalSuffix); dirs[i] = globalPrefix + dirs[i] + localSuffix; } } return dirs; }
public static InputStream getInputStream(URL url) throws IOException { if ("file".equals(url.getProtocol())) { String path = url.getFile().replace('/', File.separatorChar); path = ParseUtil.decode(path); return new FileInputStream(path); } else { return url.openStream(); } }
sun.net.www.ParseUtil.fileToEncodedURL(new File(name)).toString(); if (fromFile && !remove) { uncheckedPermissions = null;
static String[] parseExtDirs(String codebase, int start) { String s = System.getProperty(EXTDIRS_PROPERTY); String globalPrefix = (start > 0 ? codebase.substring(0, start) : "file:"); int end = start + EXTDIRS_EXPANSION.length(); String globalSuffix = (end < codebase.length() ? codebase.substring(end) : (String) null); String[] dirs = null; String localSuffix; if (s != null) { StringTokenizer st = new StringTokenizer(s, File.pathSeparator); int count = st.countTokens(); dirs = new String[count]; for (int i = 0; i < count; i++) { File file = new File(st.nextToken()); dirs[i] = sun.net.www.ParseUtil.encodePath (file.getAbsolutePath()); if (!dirs[i].startsWith("/")) { dirs[i] = "/" + dirs[i]; } localSuffix = (globalSuffix == null ? (dirs[i].endsWith("/") ? "*" : "/*") : globalSuffix); dirs[i] = globalPrefix + dirs[i] + localSuffix; } } return dirs; }
/** * Modified from java.net.JarURLConnection * * @param url URL to parse * @throws MalformedURLException */ private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); if (spec.startsWith("jar:")) { spec = spec.substring(4, spec.length()); } int separator = spec.indexOf("!/"); jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode(entryName); int subEntrySeparator = entryName.indexOf("!/"); if (subEntrySeparator != -1) { subEntryName = entryName.substring(subEntrySeparator + 2, entryName.length()); entryName = entryName.substring(0, subEntrySeparator); } } }
sun.net.www.ParseUtil.fileToEncodedURL(new File(name)).toString(); if (fromFile && !remove) { uncheckedPermissions = null;
/** * Modified from java.net.JarURLConnection * * @param url URL to parse * @throws MalformedURLException */ private void parseSpecs(URL url) throws MalformedURLException { String spec = url.getFile(); if (spec.startsWith("jar:")) { spec = spec.substring(4, spec.length()); } int separator = spec.indexOf("!/"); jarFileURL = new URL(spec.substring(0, separator++)); entryName = null; /* if ! is the last letter of the innerURL, entryName is null */ if (++separator != spec.length()) { entryName = spec.substring(separator, spec.length()); entryName = ParseUtil.decode(entryName); int subEntrySeparator = entryName.indexOf("!/"); if (subEntrySeparator != -1) { subEntryName = entryName.substring(subEntrySeparator + 2, entryName.length()); entryName = entryName.substring(0, subEntrySeparator); } } }
path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); policyFile = new File(path); found = policyFile.exists(); String path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); File policyFile = new File(path); if (policyFile.exists()) {
path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); policyFile = new File(path); found = policyFile.exists(); String path = policy_url.getFile(). replace('/', File.separatorChar); path = sun.net.www.ParseUtil.decode(path); File policyFile = new File(path); if (policyFile.exists()) {