@Nullable public static CSSDeclarationList readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromReader (new NonBlockingStringReader (sCSS), new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler) .setCustomExceptionHandler (aCustomExceptionHandler)); }
/** * Read the CSS from the passed File. * * @param aFile * The file containing the CSS to be parsed. May not be * <code>null</code>. * @param aFallbackCharset * The charset to be used 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 use. May not be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. */ @Nullable public static CascadingStyleSheet readFromFile (@Nonnull final File aFile, @Nonnull final Charset aFallbackCharset, @Nonnull final ECSSVersion eVersion) { return readFromFile (aFile, new CSSReaderSettings ().setFallbackCharset (aFallbackCharset).setCSSVersion (eVersion)); }
@Nullable public static CSSDeclarationList readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromReader (new NonBlockingStringReader (sCSS), new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomExceptionHandler (aCustomExceptionHandler)); }
@Nullable public static CSSDeclarationList readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler) { return readFromReader (new NonBlockingStringReader (sCSS), new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler)); }
final URL baseUrl = triple.getMiddle(); final Charset charset = triple.getRight(); final CSSReaderSettings readerSettings = new CSSReaderSettings() .setBrowserCompliantMode(true) .setFallbackCharset(charset) .setCSSVersion(ECSSVersion.CSS30) .setCustomErrorHandler(new LoggingCSSParseErrorHandler()) .setCustomExceptionHandler( new CSSParseExceptionCallback(baseUrl)); if (IGNORE_ALL_CSS_ERRORS) { readerSettings .setInterpretErrorHandler(new DoNothingCSSInterpretErrorHandler());
@Nullable public static CSSDeclarationList readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { return readFromReader (new NonBlockingStringReader (sCSS), new CSSReaderSettings ().setCSSVersion (eVersion)); }
final ECSSVersion eVersion = aSettings.getCSSVersion (); try aCharStream.setTabSize (aSettings.getTabSize ()); ICSSParseErrorHandler aRealParseErrorHandler = aSettings.getCustomErrorHandler (); if (aRealParseErrorHandler == null) aRealParseErrorHandler = getDefaultParseErrorHandler (); ICSSParseExceptionCallback aRealParseExceptionHandler = aSettings.getCustomExceptionHandler (); if (aRealParseExceptionHandler == null) aRealParseExceptionHandler = getDefaultParseExceptionHandler (); final boolean bBrowserCompliantMode = aSettings.isBrowserCompliantMode (); ICSSInterpretErrorHandler aRealInterpretErrorHandler = aSettings.getInterpretErrorHandler (); if (aRealInterpretErrorHandler == null) aRealInterpretErrorHandler = getDefaultInterpretErrorHandler ();
ValueEnforcer.notNull (aSettings, "Settings"); final ECSSVersion eVersion = aSettings.getCSSVersion (); try ICSSParseErrorHandler aRealParseErrorHandler = aSettings.getCustomErrorHandler (); if (aRealParseErrorHandler == null) aRealParseErrorHandler = getDefaultParseErrorHandler (); ICSSParseExceptionCallback aRealParseExceptionHandler = aSettings.getCustomExceptionHandler (); if (aRealParseExceptionHandler == null) aRealParseExceptionHandler = getDefaultParseExceptionHandler (); ICSSInterpretErrorHandler aRealInterpretErrorHandler = aSettings.getInterpretErrorHandler (); if (aRealInterpretErrorHandler == null) aRealInterpretErrorHandler = getDefaultInterpretErrorHandler ();
@Nonnull public CSSReaderSettings getClone () { return new CSSReaderSettings (this); }
@Nullable public static CSSDeclarationList readFromFile (@Nonnull final File aFile, @Nonnull final Charset aCharset, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromReader (new FileSystemResource (aFile).getReader (aCharset), new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomExceptionHandler (aCustomExceptionHandler)); }
@Nullable public static CSSDeclarationList readFromFile (@Nonnull final File aFile, @Nonnull final Charset aCharset, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler) { return readFromReader (new FileSystemResource (aFile).getReader (aCharset), new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler)); }
/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion)); }
aCharsetToUse = aSettings.getFallbackCharset (); final ECSSVersion eVersion = aSettings.getCSSVersion (); try aCharStream.setTabSize (aSettings.getTabSize ()); ICSSParseErrorHandler aRealParseErrorHandler = aSettings.getCustomErrorHandler (); if (aRealParseErrorHandler == null) aRealParseErrorHandler = getDefaultParseErrorHandler (); ICSSParseExceptionCallback aRealParseExceptionHandler = aSettings.getCustomExceptionHandler (); if (aRealParseExceptionHandler == null) aRealParseExceptionHandler = getDefaultParseExceptionHandler (); final boolean bBrowserCompliantMode = aSettings.isBrowserCompliantMode (); ICSSInterpretErrorHandler aRealInterpretErrorHandler = aSettings.getInterpretErrorHandler (); if (aRealInterpretErrorHandler == null) aRealInterpretErrorHandler = getDefaultInterpretErrorHandler ();
@Nullable public static CSSDeclarationList readFromFile (@Nonnull final File aFile, @Nonnull final Charset aCharset, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromReader (new FileSystemResource (aFile).getReader (aCharset), new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler) .setCustomExceptionHandler (aCustomExceptionHandler)); }
/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @param aCustomExceptionHandler * An optional custom exception handler that can be used to collect the * unrecoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomExceptionHandler (aCustomExceptionHandler)); }
/** * Read the CSS from the passed String using a character stream. An eventually * contained <code>@charset</code> rule is ignored. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @param aCustomErrorHandler * An optional custom error handler that can be used to collect the * recoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. * @since 3.7.3 */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseErrorHandler aCustomErrorHandler) { return readFromStringReader (sCSS, new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomErrorHandler (aCustomErrorHandler)); }
/** * Read the CSS from the passed String using a byte stream. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param aFallbackCharset * The charset to be used 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 use. May not be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final Charset aFallbackCharset, @Nonnull final ECSSVersion eVersion) { return readFromStringStream (sCSS, new CSSReaderSettings ().setFallbackCharset (aFallbackCharset) .setCSSVersion (eVersion)); }
@Nullable public static CSSDeclarationList readFromFile (@Nonnull final File aFile, @Nonnull final Charset aCharset, @Nonnull final ECSSVersion eVersion) { return readFromReader (new FileSystemResource (aFile).getReader (aCharset), new CSSReaderSettings ().setCSSVersion (eVersion)); }
/** * Read the CSS from the passed String using a byte stream. * * @param sCSS * The source string containing the CSS to be parsed. May not be * <code>null</code>. * @param aFallbackCharset * The charset to be used 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 use. May not be <code>null</code>. * @param aCustomExceptionHandler * An optional custom exception handler that can be used to collect the * unrecoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. */ @Nullable public static CascadingStyleSheet readFromString (@Nonnull final String sCSS, @Nonnull final Charset aFallbackCharset, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromStringStream (sCSS, new CSSReaderSettings ().setFallbackCharset (aFallbackCharset) .setCSSVersion (eVersion) .setCustomExceptionHandler (aCustomExceptionHandler)); }
/** * Read the CSS from the passed {@link Reader}. * * @param aReader * The reader to use. Will be closed automatically after reading - * independent of success or error. May not be <code>null</code>. * @param eVersion * The CSS version to use. May not be <code>null</code>. * @param aCustomExceptionHandler * An optional custom exception handler that can be used to collect the * unrecoverable parsing errors. May be <code>null</code>. * @return <code>null</code> if reading failed, the CSS declarations * otherwise. */ @Nullable public static CSSDeclarationList readFromReader (@Nonnull @WillClose final Reader aReader, @Nonnull final ECSSVersion eVersion, @Nullable final ICSSParseExceptionCallback aCustomExceptionHandler) { return readFromReader (aReader, new CSSReaderSettings ().setCSSVersion (eVersion) .setCustomExceptionHandler (aCustomExceptionHandler)); }