1 /* 2 * $Id: ResponseOutputStream.java 10569 2008-01-28 14:41:05Z holger $ 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.impl; 12 13 import java.io.BufferedOutputStream; 14 import java.io.IOException; 15 import java.io.OutputStream; 16 import java.net.Socket; 17 18 /** 19 * <code>ResponseOutputStream</code> is an output stream associated with the 20 * currently received event. Note that if the stream is from a socket the socket is 21 * also available on this stream so that the socket state can be validated before 22 * writing. 23 */ 24 25 public class ResponseOutputStream extends BufferedOutputStream 26 { 27 private final Socket socket; 28 29 public ResponseOutputStream(OutputStream stream) 30 { 31 super(stream); 32 socket = null; 33 } 34 35 public ResponseOutputStream(Socket socket) throws IOException 36 { 37 super(socket.getOutputStream()); 38 this.socket = socket; 39 } 40 41 public Socket getSocket() 42 { 43 return socket; 44 } 45 }