Revision 2220
org.gvsig.tools/library/trunk/org.gvsig.tools/org.gvsig.tools.lib/src/main/java/org/gvsig/tools/util/URLUtils.java | ||
---|---|---|
54 | 54 |
if( protocol==null || path==null || path.isEmpty() || !protocol.equalsIgnoreCase("file") ) { |
55 | 55 |
return null; |
56 | 56 |
} |
57 |
File f = new File(path); |
|
57 |
String host = url.getHost(); |
|
58 |
if (host==null || host.length()!=1){ |
|
59 |
return null; |
|
60 |
} |
|
61 |
|
|
62 |
File f = new File(host+":"+path); |
|
58 | 63 |
FileInputStream is; |
59 | 64 |
try { |
60 | 65 |
is = new FileInputStream(f); |
... | ... | |
65 | 70 |
} |
66 | 71 |
|
67 | 72 |
public static void main(String[] args) throws MalformedURLException { |
68 |
File f = new File("/tmp/test.txt");
|
|
73 |
File f = new File("C:\\Users\\jolic\\gvSIG\\plugins\\org.gvsig.scripting.app.mainplugin\\2.5.1\\scripts\\addons\\Arena2Reader\\i18n\\text.properties");
|
|
69 | 74 |
URLUtils.openStream(f.toURI().toURL()); |
70 | 75 |
} |
71 | 76 |
} |
Also available in: Unified diff