Class AbstractSink

  • All Implemented Interfaces:
    LogEnabled, Markup, Sink
    Direct Known Subclasses:
    SinkAdapter

    public abstract class AbstractSink
    extends java.lang.Object
    implements Sink, Markup
    An abstract base class that defines some convenience methods for sinks.
    Since:
    1.1
    Version:
    $Id: AbstractSink.java 1726411 2016-01-23 16:34:09Z hboutemy $
    Author:
    ltheussl, Vincent Siveton
    • Constructor Detail

      • AbstractSink

        public AbstractSink()
    • Method Detail

      • enableLogging

        public void enableLogging​(Log log)
        Enable a Doxia logger for this Doxia component.
        Specified by:
        enableLogging in interface LogEnabled
        Parameters:
        log - a Log.
      • getLog

        protected Log getLog()
        Returns a logger for this sink. If no logger has been configured, a new SystemStreamLog is returned.
        Returns:
        Log
      • unifyEOLs

        protected static java.lang.String unifyEOLs​(java.lang.String text)
        Parses the given String and replaces all occurrences of '\n', '\r' and '\r\n' with the system EOL. All Sinks should make sure that text output is filtered through this method.
        Parameters:
        text - the text to scan. May be null in which case null is returned.
        Returns:
        a String that contains only System EOLs.
      • init

        protected void init()
        This is called in Sink.head() or in Sink.close(), and can be used to set the sink into a clear state so it can be re-used.
        Since:
        1.1.2