transform an ARCLocation into a Resource. Be sure to call close() on it
when processing is finished.
@param path to ARC file
@param offset within file where record begins
@return the Resource for the location
@throws IOException for usual reasons
171878
public Resource getResource(String path, long offset) throws IOException {
		File arc = new File(path);
		if(!arc.exists()) {
			String base = arc.getName();
			arc = new File(arcDir,base);
			if(!arc.exists()) {
				if(base.endsWith(ArchiveFileConstants.OCCUPIED_SUFFIX)) {
					String newBase = base.substring(0,base.length() -
							ArchiveFileConstants.OCCUPIED_SUFFIX.length());
					arc = new File(arcDir,newBase);
				}
			}
		}
		LOGGER.info("Retrieving record at " + offset + " in " + 
				arc.getAbsolutePath()); 
		try {
			return ResourceFactory.getResource(arc, offset);
		} catch (ResourceNotAvailableException e1) {
			throw new IOException(e1.getMessage());
		}
	}
208513
public ListenableFuture<Boolean> moveToTrashFuture(final Path path) {
    return this.executor.submit(new Callable<Boolean>() {
      @Override
      public Boolean call() throws IOException {
        return AsyncTrash.this.innerTrash.moveToTrash(path);
      }
    });
  }
628375
private static void fsyncLineage(final Path path) throws IOException {
        Path cursor = path.toRealPath();
        while (cursor != null) {
            fsync(cursor);
            cursor = cursor.getParent();
        }
    }
973070
public static Object getByPath(Object target, List<String> path) {
        Object obj = target;

        for (String field : path) {
            if (obj == null) {
                return null;
            }
            obj = evaluate(obj, trimType(field));
        }

        return obj;
    }
614661
public ArchiveRecord get(long offset) throws IOException {
        cleanupCurrentRecord();
        long posn = positionForRecord(in); 
        if(offset>=posn) {
            in.skip(offset-posn); 
        } else {
            throw new UnsupportedOperationException("no reverse seeking: at "+posn+" requested "+offset); 
        }
        return createArchiveRecord(this.in, offset);
    }
1064868
@Nonnull
  public File createDestinationFileForPath(@Nonnull final String path) {
    assertNotNull("Path is null", path);

    if (path.isEmpty()) {
      throw makeException("File name is empty", null);
    }

    return new File(this.getTarget(), path);
  }
501717
@Pure
	GP createPath(AStarNode<ST, PT> startPoint, PT endPoint, List<AStarNode<ST, PT>> closeList) {
		int idx;
		ST segment;
		PT point;
		AStarNode<ST, PT> node;
		GP path = null;
		final CloseComparator<ST, PT> cComparator = new CloseComparator<>();

		node = newAStarNode(endPoint, Double.NaN, Double.NaN, null);
		idx = ListUtil.indexOf(closeList, cComparator, node);

		if (idx >= 0) {
			node = closeList.remove(idx);
			point = node.getGraphPoint();
			segment = node.getArrivalConnection();
			if (point != null && segment != null) {
				final LinkedList<ST> pathSegments = new LinkedList<>();
				pathSegments.add(segment);
				do {
					point = segment.getOtherSidePoint(point);
					node = newAStarNode(point, Double.NaN, Double.NaN, null);
					idx = ListUtil.indexOf(closeList, cComparator, node);
					if (idx >= 0) {
						node = closeList.remove(idx);
						segment = node.getArrivalConnection();
						if (segment != null) {
							pathSegments.add(segment);
						}
					} else {
						point = null;
						segment = null;
					}
				}
				while (point != null && segment != null);

				// Building of the path is done is a second step
				// because the oriented graph cannot enable to
				// built it during the previous step loop:
				// isConnectedSegment replies false when tested
				// with an arrival segment and cannot
				// enable to go backward along the path.
				final Iterator<ST> iterator = pathSegments.descendingIterator();
				if (iterator.hasNext()) {
					segment = iterator.next();
					if (startPoint.getGraphPoint().isConnectedSegment(segment)) {
						path = newPath(startPoint.getGraphPoint(), segment);
						while (iterator.hasNext()) {
							addToPath(path, iterator.next());
						}
					}
				}
			}
		}

		return path;
	}
1197980
public static SimpleFeatureCollection readNMEAfile( String path ) throws IOException {

        OmsNmeaFeatureReader reader = new OmsNmeaFeatureReader();
        reader.file = path;
        reader.readFeatureCollection();

        return reader.geodata;
    }
1268876
private void createDirAndFile(Path path) throws IOException {
			// create dir and file first if dir/file not exist
			File file = new File(path.toAbsolutePath().toString());
			File dir = file.getParentFile();
			if (dir != null && !dir.exists()) {
				dir.mkdirs();
			}
			if (!file.exists()) {
				file.createNewFile();
			}
	}
172202
@Override
	public Set<InputStream> getResourcesAsStream(final String path) throws IOException
	{
		// For local paths, try to resolve the path relative to the folder of the master file
		// N.B. Assumes paths are sensible, not .//someFile.xml
		if (path.startsWith("./"))
		{
			final Set<InputStream> streams = inner.getResourcesAsStream(folder + path.substring(2));

			if (streams != null && !streams.isEmpty())
				return streams;
		}

		return inner.getResourcesAsStream(path);
	}
269457
public static CheckpointStorageLocationReference encodePathAsReference(Path path) {
		byte[] refBytes = path.toString().getBytes(StandardCharsets.UTF_8);
		byte[] bytes = new byte[REFERENCE_MAGIC_NUMBER.length + refBytes.length];

		System.arraycopy(REFERENCE_MAGIC_NUMBER, 0, bytes, 0, REFERENCE_MAGIC_NUMBER.length);
		System.arraycopy(refBytes, 0, bytes, REFERENCE_MAGIC_NUMBER.length, refBytes.length);

		return new CheckpointStorageLocationReference(bytes);
	}
312548
public URL getResource(String path) throws MalformedURLException {
		Result<URL,MalformedURLException> result = getResourceCache.get(path, getResourceRefresher);
		MalformedURLException exception = result.getException();
		if(exception != null) throw exception;
		return result.getValue();
	}
430370
public void formatRegion(XtextResource resource, int offset, int length) {
		assert resource != null;
		assert offset >= 0;
		assert length >= 0;
		final String result = formatResourceRegion(resource, offset, length);
		// Write back to the resource
		try (StringInputStream stringInputStream = new StringInputStream(result)) {
			resource.load(stringInputStream, Collections.emptyMap());
		} catch (Exception exception) {
			throw Exceptions.sneakyThrow(exception);
		}
	}
1089387
public void readResources(String path) throws IOException {
		Enumeration<URL> resources =
				getClass().getClassLoader().getResources(path);

		if (!resources.hasMoreElements()) {
			throw new IllegalArgumentException(String.format("File %s was not found on classpath", path));
		}

		Yaml yaml = new Yaml();
		while (resources.hasMoreElements()) {
			appendData(yaml.loadAs(resources.nextElement().openStream(), Data.class));
		}
	}
1352118
@Requires("location != null")
  public void setLocation(Location location, List<? extends File> path)
      throws IOException {
    fileManager.setLocation(location, path);
  }
872999
protected ResourceEntry findResourceInternal(final String name, final String path) {

        checkStateForResourceLoading(name);

        if (name == null || path == null) {
            return null;
        }

        ResourceEntry entry = resourceEntries.get(path);
        if (entry != null) {
            return entry;
        }

        boolean isClassResource = path.endsWith(CLASS_FILE_SUFFIX);
        boolean isCacheable = isClassResource;
        if (!isCacheable) {
             isCacheable = path.startsWith(SERVICES_PREFIX);
        }

        WebResource resource = null;

        boolean fileNeedConvert = false;

        resource = resources.getClassLoaderResource(path);

        if (!resource.exists()) {
            return null;
        }

        entry = new ResourceEntry();
        entry.source = resource.getURL();
        entry.codeBase = resource.getCodeBase();
        entry.lastModified = resource.getLastModified();

        if (needConvert && path.endsWith(".properties")) {
            fileNeedConvert = true;
        }

        /* Only cache the binary content if there is some content
         * available one of the following is true:
         * a) It is a class file since the binary content is only cached
         *    until the class has been loaded
         *    or
         * b) The file needs conversion to address encoding issues (see
         *    below)
         *    or
         * c) The resource is a service provider configuration file located
         *    under META=INF/services
         *
         * In all other cases do not cache the content to prevent
         * excessive memory usage if large resources are present (see
         * https://issues.apache.org/bugzilla/show_bug.cgi?id=53081).
         */
        if (isCacheable || fileNeedConvert) {
            byte[] binaryContent = resource.getContent();
            if (binaryContent != null) {
                 if (fileNeedConvert) {
                    // Workaround for certain files on platforms that use
                    // EBCDIC encoding, when they are read through FileInputStream.
                    // See commit message of rev.303915 for details
                    // http://svn.apache.org/viewvc?view=revision&revision=303915
                    String str = new String(binaryContent);
                    try {
                        binaryContent = str.getBytes(StandardCharsets.UTF_8);
                    } catch (Exception e) {
                        return null;
                    }
                }
                entry.binaryContent = binaryContent;
                // The certificates and manifest are made available as a side
                // effect of reading the binary content
                entry.certificates = resource.getCertificates();
            }
        }
        entry.manifest = resource.getManifest();

//        if (isClassResource && entry.binaryContent != null &&
//                this.transformers.size() > 0) {
//            // If the resource is a class just being loaded, decorate it
//            // with any attached transformers
//            String className = name.endsWith(CLASS_FILE_SUFFIX) ?
//                    name.substring(0, name.length() - CLASS_FILE_SUFFIX.length()) : name;
//            String internalName = className.replace(".", "/");
//
//            for (ClassFileTransformer transformer : this.transformers) {
//                try {
//                    byte[] transformed = transformer.transform(
//                            this, internalName, null, null, entry.binaryContent
//                    );
//                    if (transformed != null) {
//                        entry.binaryContent = transformed;
//                    }
//                } catch (IllegalClassFormatException e) {
//                    log.error(sm.getString("webappClassLoader.transformError", name), e);
//                    return null;
//                }
//            }
//        }

        // Add the entry in the local resource repository
        synchronized (resourceEntries) {
            // Ensures that all the threads which may be in a race to load
            // a particular class all end up with the same ResourceEntry
            // instance
            ResourceEntry entry2 = resourceEntries.get(path);
            if (entry2 == null) {
                resourceEntries.put(path, entry);
            } else {
                entry = entry2;
            }
        }

        return entry;
    }
359543
public boolean moveToTrashAsOwner(Path path) throws IOException {
    String owner = this.fs.getFileStatus(path).getOwner();
    return moveToTrashAsUser(path, owner);
  }