KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > maverick > multiplex > channels > SocketWrappedChannel


1 package com.maverick.multiplex.channels;
2
3 import java.io.IOException JavaDoc;
4 import java.io.InputStream JavaDoc;
5 import java.io.OutputStream JavaDoc;
6 import java.net.Socket JavaDoc;
7
8 import com.maverick.multiplex.Channel;
9
10 /**
11  * Use this class in places where an application is passed a Socket. This
12  * class simply wraps a forwarding channel in a Socket implementation.
13  * @author lee
14  *
15  */

16 public class SocketWrappedChannel extends Socket JavaDoc {
17     Channel channel;
18     
19     public SocketWrappedChannel(Channel channel) {
20         this.channel = channel;
21     }
22     
23     public InputStream JavaDoc getInputStream() {
24         return channel.getInputStream();
25     }
26     
27     public OutputStream JavaDoc getOutputStream() {
28         return channel.getOutputStream();
29     }
30     
31     public void close() throws IOException JavaDoc {
32         channel.close();
33     }
34 }
Popular Tags