Package org.geotools.coverage.io.impl

Examples of org.geotools.coverage.io.impl.DefaultFileDriver


    @Test
    public void geoToolsReader() throws IllegalArgumentException, IOException, NoSuchAuthorityCodeException {
        boolean isInteractiveTest = TestData.isInteractiveTest();

        // create a base driver
        final DefaultFileDriver driver = new NetCDFDriver();
        final File[] files = TestData.file(this, ".").listFiles(new FileFilter(){

            @Override
            public boolean accept(File pathname) {
                return FilenameUtils.getName(pathname.getAbsolutePath()).equalsIgnoreCase("O3-NO2.nc");
            }

          
        });

        for( File f : files ) {
           
            // move to test directory
            final File file = new File(testDirectory,"O3-NO2.nc");
            FileUtils.copyFile(f, file);

            // get the file
            final URL source = file.toURI().toURL();
            assertTrue(driver.canProcess(DriverCapabilities.CONNECT, source, null));
           
            LOGGER.info("ACCEPTED: " + source.toString());

            // getting access to the file
            CoverageAccess access = null;

            try {
                access = driver.process(DriverCapabilities.CONNECT, source, null, null, null);
                if (access == null) {
                    throw new IOException("Unable to connect");
                }
                // get the names
                final List<Name> names = access.getNames(null);
View Full Code Here


            NoSuchAuthorityCodeException {
//        boolean isInteractiveTest = TestData.isInteractiveTest();
      boolean isInteractiveTest = false;
       
        // create a base driver
        final DefaultFileDriver driver = new HDF4Driver();
        File testDir = TestData.file(this,".");
        final String[] files = testDir.list(new FilenameFilter(){

      public boolean accept(File dir, String name) {
        return name.endsWith("hdf") || name.endsWith("hdf4") ;
      }});
        if (files==null||files.length==0){
            LOGGER.warning("Test files not found:\n Tests are skipped");
                     return;
        }
       
        for(String filePath:files){
          final File file= new File(testDir,filePath);
          final URL source = file.toURI().toURL();
          if (driver.canProcess(DriverOperation.CONNECT, source,null)) {
            LOGGER.info("ACCEPTED: "+source.toString());
 
              // getting access to the file
              final CoverageAccess access = driver.process(DriverOperation.CONNECT,source, null, null,null);
              if (access == null)
                  throw new IOException("Unable to connect");
 
              // get the names
              final List<Name> names = access.getNames(null);
View Full Code Here

TOP

Related Classes of org.geotools.coverage.io.impl.DefaultFileDriver

Copyright © 2018 www.massapicom. 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.