/** * Get the contents of this object as a serialized CSS string for writing to * an output using the default writer settings. * * @return The content of this object as CSS string. Never <code>null</code>. * @see #getAsCSSString(ICSSWriterSettings, int) * @since 6.0.0 */ @Nonnull default String getAsCSSString () { return getAsCSSString (CSSWriterSettings.DEFAULT_SETTINGS); }
/** * Get the contents of this object as a serialized CSS string for writing to * an output. * * @param aSettings * The settings to be used to format the output. May not be * <code>null</code>. * @return The content of this object as CSS string. Never <code>null</code>. * @see #getAsCSSString(ICSSWriterSettings, int) * @since 5.0.4 */ @Nonnull default String getAsCSSString (@Nonnull final ICSSWriterSettings aSettings) { return getAsCSSString (aSettings, 0); }
aSB.append (get (0).getAsCSSString (aSettings, nIndentLevel)); aSB.append (aSettings.getIndent (nIndentLevel + 1)); aSB.append (aElement.getAsCSSString (aSettings, nIndentLevel + 1));
/** * Write the CSS content to the passed writer. No specific charset is used. * * @param aCSS * The CSS to write. May not be <code>null</code>. * @param aWriter * The write to write the text to. May not be <code>null</code>. Is * automatically closed after the writing! * @throws IOException * In case writing fails. * @throws IllegalStateException * In case some elements cannot be written in the version supplied in * the constructor. * @see #getCSSAsString(ICSSWriteable) */ public void writeCSS (@Nonnull final ICSSWriteable aCSS, @Nonnull @WillClose final Writer aWriter) throws IOException { ValueEnforcer.notNull (aCSS, "CSS"); ValueEnforcer.notNull (aWriter, "Writer"); try { aWriter.write (aCSS.getAsCSSString (m_aSettings)); } finally { StreamHelper.close (aWriter); } }