public Location(String pathname) { LOGGER.trace("Location({})", pathname); if (pathname.contains("://")) { // Avoid expensive exception handling in case when path is // obviously not an URL try { url = new URL(getMappedId(pathname)); } catch (MalformedURLException e) { LOGGER.trace("Location is not a URL", e); isURL = false; } } else { LOGGER.trace("Location is not a URL"); isURL = false; } if (!isURL) file = new File(getMappedId(pathname)); }
private void init() throws IOException { String currentId = Location.getMappedId(currentFile); PrintStream outStream = System.out; PrintStream throwaway = new PrintStream( new ByteArrayOutputStream(), false /*auto-flush*/, Constants.ENCODING) { @Override public void print(String s) { } }; System.setOut(throwaway); throwaway.close(); netCDFFile = NetcdfFile.open(currentId); System.setOut(outStream); root = netCDFFile.getRootGroup(); }
private void init() throws IOException { String currentId = Location.getMappedId(currentFile); PrintStream outStream = System.out; PrintStream throwaway = new PrintStream( new ByteArrayOutputStream(), false /*auto-flush*/, Constants.ENCODING) { @Override public void print(String s) { } }; System.setOut(throwaway); throwaway.close(); netCDFFile = NetcdfFile.open(currentId); System.setOut(outStream); root = netCDFFile.getRootGroup(); }
private IRandomAccess getFileHandle(String flexFile) throws IOException { if (Location.getMappedFile(flexFile) != null) { return Location.getMappedFile(flexFile); } return new NIOFileHandle(new File(Location.getMappedId(flexFile)), "r", 16); }
/** * Returns whether or not the pathname exists. * If the pathname is a URL, then existence is determined based on whether * or not we can successfully read content from the URL. * * @return true if there is a way to read bytes from this Location's name * @see java.io.File#exists() */ public boolean exists() { if (isURL) { LOGGER.trace("exists(url)"); if (cachedProperties == null) { cachedProperties = new URLLocationProperties(this); } return cachedProperties.exists; } LOGGER.trace("exists(file)"); if (file.exists()) return true; if (getMappedFile(file.getPath()) != null) return true; String mappedId = getMappedId(file.getPath()); return mappedId != null && new File(mappedId).exists(); }
/** * Returns whether or not the pathname exists. * If the pathname is a URL, then existence is determined based on whether * or not we can successfully read content from the URL. * * @see java.io.File#exists() */ public boolean exists() { LOGGER.trace("exists()"); if (isURL) { try { url.getContent(); return true; } catch (IOException e) { LOGGER.trace("Failed to retrieve content from URL", e); return false; } } if (file.exists()) return true; if (getMappedFile(file.getPath()) != null) return true; String mappedId = getMappedId(file.getPath()); return mappedId != null && new File(mappedId).exists(); }
private IRandomAccess getFileHandle(String flexFile) throws IOException { if (Location.getMappedFile(flexFile) != null) { return Location.getMappedFile(flexFile); } return new NIOFileHandle(new File(Location.getMappedId(flexFile)), "r", 16); }
@Override public void initialize(String filename) throws IOException { boundValues = new Vector<Holder>(); mem.mdb_init(); File dbfile = new File(Location.getMappedId(filename)); mdb = file.mdb_open(dbfile); Catalog.mdb_read_catalog(mdb, Constants.MDB_TABLE); }
if (handle == null) { String mapId = Location.getMappedId(id); BufferedReader in = new BufferedReader( new InputStreamReader(new FileInputStream(mapId), Constants.ENCODING));
@Override public void initialize(String filename) throws IOException { boundValues = new Vector<Holder>(); mem.mdb_init(); File dbfile = new File(Location.getMappedId(filename)); mdb = file.mdb_open(dbfile); Catalog.mdb_read_catalog(mdb, Constants.MDB_TABLE); }
if (handle == null) { LOGGER.trace("no handle was mapped for this ID"); String mapId = getMappedId(id);
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new FormatException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new FormatException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new FormatException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new MissingLibraryException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new FormatException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new FormatException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new FormatException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
private void initPOIService() throws FormatException, IOException { try { ServiceFactory factory = new ServiceFactory(); poi = factory.getInstance(POIService.class); } catch (DependencyException de) { throw new MissingLibraryException("POI library not found", de); } poi.initialize(Location.getMappedId(getCurrentFile())); }
String path = Location.getMappedId(currentId); FileInputStream fis = new FileInputStream(path); skip(fis, dataOffset);