Read lines list.

@param resourceClasspath the resource classpath
@param charsetName       the charset name
@return the list
12172
public static List<String> readLines(String resourceClasspath,
            String charsetName) {
        return JMInputStream
                .readLines(getResourceInputStream(resourceClasspath),
                        charsetName);
    }
925123
public static List<String> readFileFromClassPathAsList(String _fileName) {
    	List<String> result = readFileFromClassPathAsList(_fileName, Charset.defaultCharset(), false);
        return result == null ? new ArrayList<String>() : result;
    }
930866
@SuppressWarnings("unchecked")
	@Override
	public Set<String> getResourceNames(String path) {
		Set<String> paths = context.getResourcePaths(path);
		Set<String> names = new HashSet<>();
		int length = path.length();
		if (null != paths) {
			for (String resourcePath : paths) {
				names.add(resourcePath.substring(length, resourcePath.length()));
			}
		}
		return names;
	}
779657
public static String readStringFromResources(InputStream _stream, String _charset) {
        if (_stream == null) {
            LOGGER.error("Error: null-Stream received!");
            return null;
        }

        StringBuilder sb = new StringBuilder(100);

        BufferedReader br;
        try {
            br = new BufferedReader(new InputStreamReader(_stream, _charset));
            for (int c = br.read(); c != -1; c = br.read()) {
                sb.append((char) c);
            }
        } catch (IOException _ex) {
            LOGGER.error("Error while reading resource to string: ", _ex);
        }

        return sb.toString();
    }
626175
public static String readResource(String path) {
        try {
            File file = ResourceUtil.getResourceFile(path);
            return ResourceUtil.readFromFileIntoString(file);
        } catch (Exception e) {
            throw new DataUtilException("Failed to load resource", e);
        }
    }
272868
protected List<CmsResource> readTree(String rootPath) throws CmsException {

        rootPath = CmsFileUtil.removeTrailingSeparator(rootPath);
        CmsResource base = m_cms.readResource(rootPath);

        I_CmsResourceType resType = OpenCms.getResourceManager().getResourceType(base);
        List<CmsResource> result = new ArrayList<CmsResource>();
        if (resType.isFolder()) {
            rootPath = CmsStringUtil.joinPaths(rootPath, "/");
            List<CmsResource> subResources = m_cms.readResources(rootPath, CmsResourceFilter.ALL, true);
            result.add(base);
            result.addAll(subResources);
        } else {
            result.add(base);
        }
        for (CmsResource resource : result) {
            m_cachedResources.put(resource.getStructureId(), resource);
        }

        return result;
    }
1087641
public static List<String> readLines(File targetFile, String charsetName) {
        return readLines(targetFile.toPath(), charsetName);
    }
765542
private void loadFile(String resourcePath) {
		InputStream stream = getClass().getResourceAsStream(resourcePath);
		if (stream == null) {
			throw new IllegalArgumentException(resourcePath + " is missing");
		}
		BufferedReader lineReader = null;
		try {
			lineReader = new BufferedReader(new InputStreamReader(new GZIPInputStream(stream)));
			stream = null;
			// skip the first line header
			lineReader.readLine();
			while (true) {
				String line = lineReader.readLine();
				if (line == null) {
					break;
				}
				// parse the CSV file. The CSV file contains three elements per row
				String[] parsed = line.split(",");
				if (parsed.length < 3) {
					// ignore invalid entries
					continue;
				}
				String name = parsed[0];
				String mimeType = parsed[1];
				if (mimeType.isEmpty()) {
					continue;
				}
				String reference = parsed[2];
				// fix problem in the CSV file provided by IANA such as G719,audio/G719,"[RFC5404][RFC Errata 3245]"
				if (reference.startsWith("\"")) {
					String nextLine = lineReader.readLine();
					nextLine = nextLine.replaceAll("\\s+", "");
					reference += nextLine;
				}
				IanaEntry ianaEntry = new IanaEntry(name, mimeType, parseReference(reference));
				entryMap.put(mimeType, ianaEntry);
			}
		} catch (IOException ioe) {
			throw new RuntimeException("Error when loading " + resourcePath, ioe);
		} finally {
			closeQuietly(lineReader);
			closeQuietly(stream);
		}
	}
1254860
public static List<String> getResourceLines(String resourceName) throws IOException {
        InputStreamReader isreader = null;
        BufferedReader reader = null;
        try {
            isreader = new InputStreamReader(Util.class.getResourceAsStream(resourceName));
            reader = new BufferedReader(isreader);
            List<String> lines = new ArrayList<String>();
            String tmp;
            while ((tmp = reader.readLine()) != null) {
                lines.add(tmp);
            }
            return lines;
        } finally {
            closeQuietly(reader);
            closeQuietly(isreader);
        }
    }
1003171
public static List<String> readLines(Path targetPath, String charsetName) {
        try {
            return Files.readAllLines(targetPath, Charset.forName(charsetName));
        } catch (IOException e) {
            return JMExceptionManager.handleExceptionAndReturnNull(log, e,
                    "readLines", targetPath, charsetName);
        }
    }
446235
public static Action resourceContent(String resourcePath, String charset) {
        URL resource = Action.class.getClassLoader().getResource(resourcePath);
        if (resource == null) {
            throw new IllegalArgumentException(String.format("Resource %s not found.", resourcePath));
        }
        Action charsetAction = charset == null ? noop() : charset(Charset.forName(charset));
        return composite(resourceContent(resource), charsetAction);
    }
439780
public static InputStream readResource(String name) {
        String classpath = System.getProperty("java.class.path");
        LOGGER.trace("Reading {} from classpath={}", name, classpath);
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            throw new IllegalStateException("Can not obtain classloader instance from current thread");
        }
        return classLoader.getResourceAsStream(name);
    }
534388
public static List<String> toLines(Class<?> contextClass, String resourceName) throws IOException {
		return Resources.readLines(Resources.getResource(contextClass, resourceName), Charsets.UTF_8);
	}
1310665
public static BufferedReader newBufferedReader(Path path, Charset charset) throws IOException {
        return new BufferedReader(new InputStreamReader(newInputStream(path), charset));
    }
1278165
public static Reader resource(String resourceName) {
        if (resourceName == null) {
            throw new NullPointerException("'null' passed instead of resource name");
        }

        final InputStream resourceStream = ClassLoader.getSystemResourceAsStream(resourceName);
        if (resourceStream == null) {
            throw new IllegalArgumentException(format("resource '%s' not found", resourceName));
        }

        return new BufferedReader(new InputStreamReader(resourceStream));
    }
1318896
public static String getStringWithClasspathOrFilePath(
            String classpathOrFilePath, String charsetName) {
        return getStringAsOptWithClasspath(classpathOrFilePath, charsetName)
                .orElseGet(() -> getStringAsOptWithFilePath
                        (classpathOrFilePath, charsetName).orElse(null));
    }
331035
public static Enumeration<URL> getResources(String resourcePath, Object source) {

		// Try the current classloader
		Enumeration<URL> urls = null;

		ClassLoader cl = source.getClass().getClassLoader();
		try {
			if (null != cl) {
				urls = cl.getResources(resourcePath);
			}

			// If current classloader failed, try with the Threads context
			// classloader. If that fails ott, the resource is either not on the
			// classpath or inaccessible from the current context.

			if (null == urls) {
				urls = Thread.currentThread().getContextClassLoader().getResources(resourcePath);
			}

			// Last chance, hack in the classloader
			if (null == urls) {
				ClassLoader threadClassLoader = Thread.currentThread().getContextClassLoader();
				try {
					Thread.currentThread().setContextClassLoader(source.getClass().getClassLoader());
					if (Thread.currentThread().getContextClassLoader() != null) {

						urls = Thread.currentThread().getContextClassLoader().getResources(resourcePath);
					}
				} finally {
					Thread.currentThread().setContextClassLoader(threadClassLoader);
				}
			}
		} catch (IOException e) {
			LOGGER.warn("Unable to load " + resourcePath, e);
		}

		return urls;
	}