Returns a ClassFileReader instance of a given path.
3760
public static ClassFileReader newInstance(Path path) throws IOException {
        if (!Files.exists(path)) {
            throw new FileNotFoundException(path.toString());
        }

        if (Files.isDirectory(path)) {
            return new DirectoryReader(path);
        } else if (path.getFileName().toString().endsWith(".jar")) {
            return new JarFileReader(path);
        } else {
            return new ClassFileReader(path);
        }
    }
754000
private static InputStream getStreamFromClasspath(String fileName)
    {
        String path = fileName;
        InputStream dtdStream = PersistenceXMLLoader.class.getClassLoader().getResourceAsStream(path);
        return dtdStream;
    }
1062927
def read_json_file(cls, path):
        
        with open(path, 'r') as f:
            return cls.from_dict(json.load(f))
397833
public CFile getFile( CPath path )
    {
        Headers headers = headOrNull( path );
        if ( headers == null ) {
            return null;
        }
        if ( !headers.contains( "Content-Type" ) ) {
            LOGGER.warn( "{} object has no content type ?!", path );
            return null;
        }
        CFile file;
        if ( !CONTENT_TYPE_DIRECTORY.equals( headers.getHeaderValue( "Content-Type" ) ) ) {
            file = new CBlob( path,
                              Long.parseLong( headers.getHeaderValue( "Content-Length" ) ),
                              headers.getHeaderValue( "Content-Type" ),
                              parseTimestamp( headers ),
                              parseMetaHeaders( headers ) );
        } else {
            file = new CFolder( path,
                                parseTimestamp( headers ),
                                parseMetaHeaders( headers ) );
        }
        return file;
    }
651092
public static FileDescriptor from(String path) throws IOException {
        checkNotNull(path, "path");
        int res = open(path);
        if (res < 0) {
            throw newIOException("open", res);
        }
        return new FileDescriptor(res);
    }
442856
public static HttpFileBuilder ofResource(String path) {
        requireNonNull(path, "path");
        return ofResource(HttpFile.class.getClassLoader(), path);
    }
587523
def read_json_file(cls, path):
        
        with open(path, 'r') as f:
            json_string = f.read()
        return cls.from_json(json_string)
566412
def read(path):
    
    data = None
    with open(path, 'r') as f:
        data = f.read()
    f.close()
    return data
999017
public static SimpleFeatureCollection readJsonfile( String path ) throws Exception {

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

        return reader.geodata;
    }
273753
public static Properties loadClasspath(String path) throws IOException {
		InputStream input = PropUtils.class.getClassLoader().getResourceAsStream(path);
		Properties prop = null;
		try {
			prop = load(input);
		} finally {
			IOUtils.close(input);
		}
		return prop;
	}
1338256
private FileReader createFileReader(Path file)
          throws IOException {
    if(readerType.equalsIgnoreCase(Configs.SEQ)) {
      return new SequenceFileReader(this.hdfs, file, conf);
    }
    if(readerType.equalsIgnoreCase(Configs.TEXT)) {
      return new TextFileReader(this.hdfs, file, conf);
    }
    try {
      Class<?> clsType = Class.forName(readerType);
      Constructor<?> constructor = clsType.getConstructor(FileSystem.class, Path.class, Map.class);
      return (FileReader) constructor.newInstance(this.hdfs, file, conf);
    } catch (Exception e) {
      LOG.error(e.getMessage(), e);
      throw new RuntimeException("Unable to instantiate " + readerType + " reader", e);
    }
  }
232618
public static String readResource(String path) {
        final long start = System.nanoTime();
        try (InputStream is = UScale.class.getClassLoader().getResourceAsStream(path);) {
            int len = 0;
            byte[] buffer = new byte[2048];
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            while ((len = is.read(buffer)) >= 0) {
                baos.write(buffer, 0, len);
            }
            return new String(baos.toByteArray(), StandardCharsets.UTF_8);
        } catch (IOException e) {
            LOGGER.log(Level.WARNING, e, () -> "IOException loading resource " + path);
            throw new IllegalStateException("Unable to read class loaded stream " + path, e);
        } catch (RuntimeException re) {
            LOGGER.log(Level.WARNING, re, () -> "Unexpected exception loading resource " + path);
            throw re;
        } finally {
            LOGGER.fine(() -> String.format("Loaded resource %s in %.3fms", path,
                    (System.nanoTime() - start) / 1000000.0));
        }
    }
1336555
public static ClassFileReader newInstance(Path path, JarFile jf) throws IOException {
        return new JarFileReader(path, jf);
    }
179555
public static Resource getResourceObj(String path) {
		if(StrUtil.isNotBlank(path)) {
			if(path.startsWith(URLUtil.FILE_URL_PREFIX) || FileUtil.isAbsolutePath(path)) {
				return new FileResource(path);
			}
		}
		return new ClassPathResource(path);
	}
513713
def read(path, encoding="utf-8"):
    
    is_gzip = is_gzip_file(path)

    with open(path, "rb") as f:
        if is_gzip:
            return zlib.decompress(f.read()).decode(encoding)
        else:
            return f.read().decode(encoding)
272388
def read_file(fpath):
    """"""
    with io.open(os.path.join(PATH_BASE, fpath)) as f:
        return f.read()
1325853
public static PrototypeMeasurementFilterSpecification loadFromPath(String path)
      throws IOException {
    byte[] jsonData = Files.readAllBytes(Paths.get(path));
    ObjectMapper objectMapper = new ObjectMapper();
    return objectMapper.readValue(
        jsonData, PrototypeMeasurementFilterSpecification.class);
  }