Here you can find the source of URIToFilename(String str)
Parameter | Description |
---|---|
str | The string to fix. |
public static final String URIToFilename(String str)
//package com.java2s; public class Main { /**/*from w w w .j a v a2s . c o m*/ * Fixes a platform dependent filename to standard URI form. * * @param str The string to fix. * * @return Returns the fixed URI string. */ public static final String URIToFilename(String str) { // Windows fix if (str.length() >= 3) { if (str.charAt(0) == '/' && str.charAt(2) == ':') { char ch1 = Character.toUpperCase(str.charAt(1)); if (ch1 >= 'A' && ch1 <= 'Z') str = str.substring(1); } } // handle platform dependent strings str = str.replace('/', java.io.File.separatorChar); return str; } }