Package java.io

Examples of java.io.File.toURI()


//    String res4Name = "/thredds/catalog/testInvDsScan.dsScanRefactorWithDirExclude.resultNAM.xml";

    File inFile = new File( filePath, inFileName );

    InvCatalogFactory fac = InvCatalogFactory.getDefaultFactory( false );
    InvCatalogImpl catalog = fac.readXML( inFile.toURI() );

    assertTrue( "Read resulted in null catalog.",
                catalog != null);

    String baseURI = catalog.getBaseURI().toString();
View Full Code Here


    assertTrue( "Read resulted in null catalog.",
                catalog != null);

    String baseURI = catalog.getBaseURI().toString();
    String expectedBaseURI = inFile.toURI().toString();
    assertTrue( "Base URI <" + baseURI + "> not as expected <" + expectedBaseURI + ">.",
                baseURI.equals( expectedBaseURI ));

    String targetDsId = "myGridDataID";
    InvDataset targetDs = catalog.findDatasetByID( targetDsId );
View Full Code Here

        List<URL> clUser = new ArrayList<URL>();
        StringTokenizer tokenizer = new StringTokenizer(this.classpath, sep);
        while (tokenizer.hasMoreTokens()) {
            File file = new File(tokenizer.nextToken());
            try {
                clUser.add(file.toURI().toURL());
            } catch (MalformedURLException uue) {
                logger.log(Level.WARNING, "Cannot transform to URL the file : '" + file + "'", uue);
            }
        }
        return clUser.toArray(new URL[0]);
View Full Code Here

        } catch (URISyntaxException e) {
            File f = new File(uri);
            if (!f.exists()) {
                throw new IllegalArgumentException("Invalid URI/file " + uri, e);
            }
            return f.toURI();
        }
    }


 
View Full Code Here

                // dump stream
                FileOutputStream fos = new FileOutputStream(urlFile);
                fos.write(bytes);
                fos.close();
                url = urlFile.toURI().toURL();
                break;
            case ProtocolConstants.RESOURCE_NOT_FOUND:
                url = null;
                break;
            default:
View Full Code Here

        } catch (URISyntaxException e) {
            File f = new File(uri);
            if (!f.exists()) {
                throw new IllegalArgumentException("Invalid URI/file " + uri, e);
            }
            return f.toURI();
        }
    }
    public VideoComponent getVideoComponent() {
        return videoComponent;
    }
View Full Code Here

        } catch (URISyntaxException e) {
            File f = new File(uri);
            if (!f.exists()) {
                throw new IllegalArgumentException("Invalid URI/file " + uri, e);
            }
            return f.toURI();
        }
    }
}
View Full Code Here

    /* 2.) Check if ImageDescriptor exists in File System */
    File favicon = getImageFile(bookmark.getId());
    if (favicon != null && favicon.exists()) {
      try {
        descriptor = new FavIconImageDescriptor(favicon, ImageDescriptor.createFromURL(favicon.toURI().toURL()));
        FAVICO_CACHE.put(bookmark.getId(), descriptor);
        return descriptor;
      } catch (MalformedURLException e) {
        Activator.getDefault().logError(e.getMessage(), e);
      }
View Full Code Here

            if (!f.canRead()) {
                s_log.info(
                    "For driver '"+driverName+"', the JVM says the file can't be read: "+
                    fileNames[i]);
            }
            urls[i] = f.toURI().toURL();
           
    }
    return urls;
  }
}
View Full Code Here

    if (f.exists()) {
      System.out.println("File ("+args[0]+") exists");
    } else {
      System.out.println("File ("+args[0]+") does not exist");
    }
    URL url = f.toURI().toURL();
   
    // BAD - Converting a URL to a file this way is problematic when the file path contains spaces
    File f2 = new File(url.getFile());
    if (f2.exists()) {
      System.out.println("File from URI ("+url.getFile()+") exists");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.