Loads a resource as {@link InputStreamReader} relative to {@link #getConfigDir()}.

@param resource
The resource to be loaded.
@param encoding
The encoding to use
@return The reader
189755
public static InputStreamReader getConfigInputStreamReader(final String resource, final String encoding) throws IOException {
		return new InputStreamReader(getConfigInputStream(resource), encoding);
	}
261083
public static <T extends AnnotationTagger> T read(@NonNull Resource resource) throws Exception {
      return resource.readObject();
   }
729948
public static Provider resourceProvider(ClassLoader classLoader, String pathToResource, Charset encoding) throws IOException {
        InputStream resourceAsStream = classLoader.getResourceAsStream(pathToResource);
        if (resourceAsStream == null) {
            throw new IOException("Cannot find " + pathToResource);
        }
        return provider(resourceAsStream, encoding);
    }
787909
private static Reader loadInputStream(InputStream propertiesStream) throws IOException {
        StringBuilder buff = new StringBuilder();

        try (InputStreamReader isr = new InputStreamReader(propertiesStream, Charset.defaultCharset());
                BufferedReader reader = new BufferedReader(isr)) {
            String line;
            while ((line = reader.readLine()) != null) {
                buff.append(line).append("\n");
            }
        }

        return new StringReader(StrSubstitutor.replaceSystemProperties(buff.toString()));
    }
729967
@Override
	public Reader getResourceAsReader(String resourceName) throws IOException {

		try {
			return rsHandler.getResource(null, resourceName, true);
		} catch (ResourceNotFoundException e) {
			throw new IOException("The resource '" + resourceName + "' was not found.");
		}
	}
465554
public static String read(URL url, String encoding) throws IOException {
        Reader reader = getReader(url, encoding);
        String source;
        try {
            source = read(reader);
        } finally {
            reader.close();
        }
        return source;
    }
319618
public InputStreamReader getFileStream(String filename, String encoding)
			throws NoSuchPathException, UnmarshalException{
		try {
			return new InputStreamReader(new FileInputStream(filename), encoding);
		} catch (FileNotFoundException e) {
			throw new NoSuchPathException(e);
		} catch (UnsupportedEncodingException e){
			throw new UnmarshalException(e);
		}
	}
671187
public static String readToString(Resource resource, Charset charset) throws IOException {
        if (simulationMode) {
            if (resource instanceof ClassPathResource) {
                return ((ClassPathResource) resource).getPath();
            } else if (resource instanceof FileSystemResource) {
                return ((FileSystemResource) resource).getPath();
            } else {
                return resource.getFilename();
            }
        }

        if (log.isDebugEnabled()) {
            log.debug(String.format("Reading file resource: '%s' (encoding is '%s')", resource.getFilename(), charset.displayName()));
        }
        return readToString(resource.getInputStream(), charset);
    }
217280
public void load(final InputStream is, final String encoding) throws IOException {
		load(new InputStreamReader(is, encoding));
	}
909054
public static InputStream getResourceAsStream(String resource) throws IOException {
    InputStream in = null;
    ClassLoader loader = ResourcesUtils.class.getClassLoader();
    if (loader != null) {
      in = loader.getResourceAsStream(resource);
    }
    if (in == null) {
      in = ClassLoader.getSystemResourceAsStream(resource);
    }
    if (in == null) {
      throw new IOException("Could not find resource " + resource);
    }
    return in;
  }
273305
protected InputStream getResourceInputStream(final Resource resource, final String entityId) throws IOException {
        LOGGER.debug("Locating metadata resource from input stream.");
        if (!resource.exists() || !resource.isReadable()) {
            throw new FileNotFoundException("Resource does not exist or is unreadable");
        }
        return resource.getInputStream();
    }
910696
public static List<String> readConfigIntoLines(final String resource) throws IOException {
		BufferedReader br = null;
		try {
			br = ResourceLoader.getConfigBufferedReader(resource);
			return doReadIntoLines(br);
		} finally {
			IOUtils.closeQuietly(br);
		}
	}
1059432
public static Reader getInputStreamReader(InputStream in, String charset) {
    try {
      return new InputStreamReader(in, charset);
    }
    catch (UnsupportedEncodingException ex) {
      throw new RuntimeException(ex); // shouldn't happen since UTF-8 is supported by all JVMs per spec
    }
  }
544220
public static Reader createReader(InputStream inputStream,String encoding)
    {
        //get encoding
        String updatedEncoding=IOHelper.getEncodingToUse(encoding);
        
        //create reader
        Reader reader=null;
        try
        {
            reader=new InputStreamReader(inputStream,updatedEncoding);
        }
        catch(UnsupportedEncodingException exception)
        {
            throw new FaxException("Unable to create reader, unsupported encoding: "+encoding,exception);
        }
        
        return reader;
    }
1129370
public static String readContentAsString(URL url, String encoding) {
        try {
            return readContentAsString(url.openStream(), encoding);
        } catch (IOException e) {
            throw E.ioException(e);
        }
    }
713113
@Override
	public Reader getResource(String resourceName) throws ResourceNotFoundException {

		return getResource(null, resourceName, false);
	}
662475
private Resource loadResource(String name, Locale locale, String encoding) throws IOException {
        Resource resource;
        if (stringLoader.exists(name, locale)) {
            resource = stringLoader.load(name, locale, encoding);
        } else {
            resource = loader.load(name, locale, encoding);
        }
        if (resource == null) {
            throw new FileNotFoundException("Not found resource " + name);
        }
        return resource;
    }