public ProxyAutoConfigHelper (@Nonnull final IReadableResource aPACRes) throws ScriptException { m_aPACRes = ValueEnforcer.notNull (aPACRes, "PACResource"); m_sPACCode = null; s_aScriptEngine.eval (m_aPACRes.getReader (ScriptHelper.DEFAULT_SCRIPT_CHARSET)); }
@Nonnull public MarkdownProcessingResult process (@Nonnull final IReadableResource aRes) throws IOException { ValueEnforcer.notNull (aRes, "Resource"); return process (aRes.getReader (m_aConfig.getEncoding ())); }
/** * Parses the specified resource and uses it to construct a populated * Homoglyph object. * * @param aRes * the path to a file containing a list of homoglyphs (see the bundled * char_codes.txt file for an example of the required format) * @return a Homoglyph object populated using the contents of the specified * file * @throws IOException * if the specified file cannot be read */ @Nonnull public static Homoglyph build (@Nonnull final IReadableResource aRes) throws IOException { ValueEnforcer.notNull (aRes, "Resource"); return build (aRes.getReader (StandardCharsets.ISO_8859_1)); }
/** * Check if the passed CSS resource can be parsed without error * * @param aRes * The resource to be parsed. May not be <code>null</code>. * @param aFallbackCharset * The charset to be used for reading the CSS file in case neither a * <code>@charset</code> rule nor a BOM is present. May not be * <code>null</code>. * @param eVersion * The CSS version to be used for scanning. May not be * <code>null</code>. * @return <code>true</code> if the file can be parsed without error, * <code>false</code> if not */ public static boolean isValidCSS (@Nonnull final IReadableResource aRes, @Nonnull final Charset aFallbackCharset, @Nonnull final ECSSVersion eVersion) { ValueEnforcer.notNull (aRes, "Resource"); ValueEnforcer.notNull (aFallbackCharset, "FallbackCharset"); ValueEnforcer.notNull (eVersion, "Version"); final Reader aReader = aRes.getReader (aFallbackCharset); if (aReader == null) { LOGGER.warn ("Failed to open CSS reader " + aRes); return false; } return isValidCSS (aReader, eVersion); }
/** * Check if the passed CSS resource can be parsed without error * * @param aRes * The resource to be parsed. May not be <code>null</code>. * @param aCharset * The charset to be used for reading the CSS file. May not be * <code>null</code>. * @param eVersion * The CSS version to be used for scanning. May not be * <code>null</code>. * @return <code>true</code> if the file can be parsed without error, * <code>false</code> if not */ public static boolean isValidCSS (@Nonnull final IReadableResource aRes, @Nonnull final Charset aCharset, @Nonnull final ECSSVersion eVersion) { ValueEnforcer.notNull (aRes, "Resource"); ValueEnforcer.notNull (aCharset, "Charset"); ValueEnforcer.notNull (eVersion, "Version"); final Reader aReader = aRes.getReader (aCharset); if (aReader == null) { LOGGER.warn ("Failed to open CSS reader " + aRes); return false; } return isValidCSS (aReader, eVersion); }