| 1 package org.sapia.ubik.net.mplex; 2 3 import java.io.BufferedInputStream ; 4 import java.io.IOException ; 5 import java.io.InputStream ; 6 import java.io.PushbackInputStream ; 7 8 import java.net.Socket ; 9 import java.net.SocketException ; 10 import java.net.SocketImpl ; 11 12 13 32 public class MultiplexSocket extends Socket { 33 34 private PushbackInputStream _theInput; 35 36 37 private int _thePushbackBufferSize; 38 39 46 public MultiplexSocket(SocketImpl impl, int bufferSize) 47 throws SocketException { 48 super(impl); 49 _thePushbackBufferSize = bufferSize; 50 } 51 52 60 public InputStream getInputStream() throws IOException { 61 if (_theInput == null) { 62 _theInput = new PushbackInputStream (new BufferedInputStream ( 63 super.getInputStream()), 256); 64 } 65 66 return _theInput; 67 } 68 69 74 public PushbackInputStream getPushbackInputStream() throws IOException { 75 return (PushbackInputStream ) getInputStream(); 76 } 77 78 84 public String toString() { 85 StringBuffer aBuffer = new StringBuffer (); 86 aBuffer.append("MultiplexSocket[").append(super.toString()).append("]"); 87 88 return aBuffer.toString(); 89 } 90 } 91 | Popular Tags |