com.rubecula.darwin.domain.helper
Class Sink_

java.lang.Object
  extended by com.rubecula.darwin.domain.helper.Sink_
All Implemented Interfaces:
Sink, java.io.Closeable, java.io.Flushable, java.lang.Appendable
Direct Known Subclasses:
Census_Sink, Sink_Bucket, Sink_Log

public abstract class Sink_
extends java.lang.Object
implements Sink

Author:
Robin Hillyard

Field Summary
protected static org.apache.commons.logging.Log LOG
           
 
Fields inherited from interface com.rubecula.darwin.domain.helper.Sink
NEWLINE
 
Constructor Summary
protected Sink_()
           
 
Method Summary
 java.lang.Appendable append(char c)
           
 java.lang.Appendable append(java.lang.CharSequence csq, int start, int end)
           
 void close()
          Do nothing
 void flush()
          Do nothing
static void sinkOrLog(java.lang.String message, java.lang.Appendable sink, org.apache.commons.logging.Log log)
          This utility method sends a message to the given sink (if non-null) otherwise it logs it using the info method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Appendable
append
 

Field Detail

LOG

protected static final org.apache.commons.logging.Log LOG
Constructor Detail

Sink_

protected Sink_()
Method Detail

sinkOrLog

public static void sinkOrLog(java.lang.String message,
                             java.lang.Appendable sink,
                             org.apache.commons.logging.Log log)
This utility method sends a message to the given sink (if non-null) otherwise it logs it using the info method. In the event that appends it to the sink, it will additionally log it using the debug method, providing that info is not enabled. TODO why not just send it to debug?

Parameters:
message - the message to output
sink - the sink to which the message will be sent (may be null)
log - the logger of the calling class

append

public java.lang.Appendable append(char c)
                            throws java.io.IOException
Specified by:
append in interface java.lang.Appendable
Returns:
result of calling Appendable.append(CharSequence) with parameter c + "".
Throws:
java.io.IOException
See Also:
Appendable.append(char)

append

public java.lang.Appendable append(java.lang.CharSequence csq,
                                   int start,
                                   int end)
                            throws java.io.IOException
Specified by:
append in interface java.lang.Appendable
Returns:
result of calling Appendable.append(CharSequence) with parameter csq.subSequence(start, end).
Throws:
java.io.IOException
See Also:
Appendable.append(java.lang.CharSequence, int, int)

close

public void close()
           throws java.io.IOException
Do nothing

Specified by:
close in interface java.io.Closeable
Throws:
java.io.IOException
See Also:
Closeable.close()

flush

public void flush()
           throws java.io.IOException
Do nothing

Specified by:
flush in interface java.io.Flushable
Throws:
java.io.IOException
See Also:
Flushable.flush()


Copyright © 2010 Rubecula Software, LLC. All Rights Reserved.