class MessageOutputStream implements AutoCloseable {

	public OutputStream asStream() throws StreamingException {
		if (requestStream instanceof OutputStream) {
			if (log.isDebugEnabled()) log.debug(getLogPrefix() + "returning OutputStream as OutputStream");
			return (OutputStream) requestStream;
		}
		if (requestStream instanceof Writer) {
			if (log.isDebugEnabled()) log.debug(getLogPrefix() + "returning Writer as OutputStream");
			return new WriterOutputStream((Writer) requestStream, StreamUtil.DEFAULT_INPUT_STREAM_ENCODING);
		}
		if (requestStream instanceof ContentHandler) {
			if (log.isDebugEnabled()) log.debug(getLogPrefix() + "returning ContentHandler as OutputStream");
			return new ContentHandlerOutputStream((ContentHandler) requestStream, threadConnector);
		}
		return null;
	}

	protected  MessageOutputStream(INamedObject owner, IForwardTarget next);
	protected  MessageOutputStream(INamedObject owner, MessageOutputStream nextStream);
	public  MessageOutputStream(INamedObject owner, OutputStream stream, IForwardTarget next);
	public  MessageOutputStream(INamedObject owner, OutputStream stream, MessageOutputStream nextStream);
	public  MessageOutputStream(INamedObject owner, Writer writer, IForwardTarget next);
	public  MessageOutputStream(INamedObject owner, Writer writer, MessageOutputStream nextStream);
	public  MessageOutputStream(INamedObject owner, ContentHandler handler, IForwardTarget next, ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener, IPipeLineSession session);
	public  MessageOutputStream(INamedObject owner, ContentHandler handler, MessageOutputStream nextStream, ThreadLifeCycleEventListener<Object> threadLifeCycleEventListener, IPipeLineSession session);

}