View Javadoc

1   /*
2    * $Id: OutputHandler.java 10489 2008-01-23 17:53:38Z dfeist $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.api.transport;
12  
13  import org.mule.api.MuleEvent;
14  
15  import java.io.IOException;
16  import java.io.OutputStream;
17  
18  /**
19   * The OutputHandler is a strategy class that is set on the StreamMessageAdapter to
20   * defer the writing of the message payload until there is a stream available to
21   * write it to.
22   * 
23   * @see org.mule.transport.streaming.StreamMessageAdapter
24   */
25  public interface OutputHandler
26  {
27  
28      /**
29       * Write the event payload to the stream. Depending on the underlying transport,
30       * attachements and message properties may be written to the stream here too.
31       * 
32       * @param event the current event
33       * @param out the output stream to write to
34       * @throws IOException
35       */
36      void write(MuleEvent event, OutputStream out) throws IOException;
37  
38  }