@Nonnull
  private String _readAndParseCSS (@Nonnull final IHasInputStream aISP,
                                   @Nonnull @Nonempty final String sBasePath,
                                   final boolean bRegular)
  {
    final CascadingStyleSheet aCSS = CSSReader.readFromStream (aISP, m_aCharset, ECSSVersion.CSS30);
    if (aCSS == null)
    {
      LOGGER.error ("Failed to parse CSS. Returning 'as-is'");
      return StreamHelper.getAllBytesAsString (aISP, m_aCharset);
    }
    CSSVisitor.visitCSSUrl (aCSS, new AbstractModifyingCSSUrlVisitor ()
    {
      @Override
      protected String getModifiedURI (@Nonnull final String sURI)
      {
        if (LinkHelper.hasKnownProtocol (sURI))
        {
          // If e.g. an external resource is includes.
          // Example: https://fonts.googleapis.com/css
          return sURI;
        }
        return FilenameHelper.getCleanConcatenatedUrlPath (sBasePath, sURI);
      }
    });

    // Write again after modification
    return new CSSWriter (ECSSVersion.CSS30, !bRegular).setWriteHeaderText (false)
                                                       .setWriteFooterText (false)
                                                       .getCSSAsString (aCSS);
  }
@ Nonnull private String _readAndParseCSS ( @ Nonnull final IHasInputStream aISP , @ Nonnull @ Nonempty final String sBasePath , final boolean bRegular ) { final CascadingStyleSheet aCSS = CSSReader . readFromStream ( aISP , m_aCharset , ECSSVersion . CSS30 ) ; if ( aCSS == null ) { LOGGER . error ( "Failed to parse CSS. Returning 'as-is'" ) ; return StreamHelper . getAllBytesAsString ( aISP , m_aCharset ) ; } CSSVisitor . visitCSSUrl ( aCSS , new AbstractModifyingCSSUrlVisitor ( ) { @ Override protected String getModifiedURI ( @ Nonnull final String sURI ) { if ( LinkHelper . hasKnownProtocol ( sURI ) ) { return sURI ; } return FilenameHelper . getCleanConcatenatedUrlPath ( sBasePath , sURI ) ; } } ) ; return new CSSWriter ( ECSSVersion . CSS30 , ! bRegular ) . setWriteHeaderText ( false ) . setWriteFooterText ( false ) . getCSSAsString ( aCSS ) ; }
Unify all paths in a CSS relative to the passed base path.

@param aISP
Input stream provider.
@param sBasePath
The base path, where the source CSS is read from.
@param bRegular
<code>true</code> for normal output, <code>false</code> for minified
output.
@return The modified String.