示例#1
0
 /**
  * Get the file path object for the given path. Windows-style '\' is replaced with '/'.
  *
  * @param path the path
  * @return the file path object
  */
 public static FilePath get(String path) {
   path = path.replace('\\', '/');
   int index = path.indexOf(':');
   registerDefaultProviders();
   if (index < 2) {
     // use the default provider if no prefix or
     // only a single character (drive name)
     return defaultProvider.getPath(path);
   }
   String scheme = path.substring(0, index);
   FilePath p = providers.get(scheme);
   if (p == null) {
     // provider not found - use the default
     p = defaultProvider;
   }
   return p.getPath(path);
 }
示例#2
0
 /**
  * Register a file provider.
  *
  * @param provider the file provider
  */
 public static void register(FilePath provider) {
   registerDefaultProviders();
   providers.put(provider.getScheme(), provider);
 }
示例#3
0
 /**
  * Unregister a file provider.
  *
  * @param provider the file provider
  */
 public static void unregister(FilePath provider) {
   registerDefaultProviders();
   providers.remove(provider.getScheme());
 }