01: package vicazh.hyperpool.stream.net;
02:
03: import java.io.*;
04: import vicazh.hyperpool.stream.Connection;
05:
06: /**
07: * This class is the superclass of net streams
08: *
09: * @author Victor Zhigunov
10: * @version 0.4.0
11: */
12: public class Stream extends vicazh.hyperpool.stream.Stream {
13: public Stream() {
14: }
15:
16: /**
17: * @param connection
18: * parent connection
19: * @param outputstream
20: * linked output stream
21: */
22: public Stream(Connection connection, OutputStream outputstream) {
23: super (connection, outputstream);
24: }
25:
26: /**
27: * Return socket
28: *
29: * @return socket
30: */
31: public Socket getSocket() {
32: OutputStream stream = outputstream;
33: while (stream != null
34: && stream instanceof vicazh.hyperpool.stream.NullStream) {
35: if (stream instanceof Stream)
36: return ((Stream) stream).getSocket();
37: stream = ((vicazh.hyperpool.stream.NullStream) stream).outputstream;
38: }
39: return null;
40: }
41: }
|