| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TCPSocketImpl |
|
| 1.0;1 |
| 1 | /* | |
| 2 | * Created on Jul 3, 2004 | |
| 3 | * | |
| 4 | * To change the template for this generated file go to | |
| 5 | * Window - Preferences - Java - Code Generation - Code and Comments | |
| 6 | */ | |
| 7 | package biz.xsoftware.examples.socket; | |
| 8 | ||
| 9 | import java.io.IOException; | |
| 10 | import java.net.Socket; | |
| 11 | import java.nio.ByteBuffer; | |
| 12 | ||
| 13 | /** | |
| 14 | * The real implementation behind TCPSocket. | |
| 15 | * | |
| 16 | * @author Dean Hiller | |
| 17 | */ | |
| 18 | public class TCPSocketImpl implements TCPSocket { | |
| 19 | ||
| 20 | private Socket socket; | |
| 21 | /** | |
| 22 | * @showcode | |
| 23 | */ | |
| 24 | 0 | public TCPSocketImpl(Socket s) { |
| 25 | 0 | socket = s; |
| 26 | 0 | } |
| 27 | ||
| 28 | /** | |
| 29 | * @see biz.xsoftware.examples.socket.TCPSocket#read(java.nio.ByteBuffer) | |
| 30 | * @showcode | |
| 31 | */ | |
| 32 | public int read(ByteBuffer b) throws IOException { | |
| 33 | 0 | return socket.getChannel().read(b); |
| 34 | } | |
| 35 | ||
| 36 | /** | |
| 37 | * @see biz.xsoftware.examples.socket.TCPSocket#write(java.nio.ByteBuffer) | |
| 38 | * @showcode | |
| 39 | */ | |
| 40 | public int write(ByteBuffer b) throws IOException { | |
| 41 | 0 | return socket.getChannel().write(b); |
| 42 | } | |
| 43 | } |