File tree Expand file tree Collapse file tree
docker-java-transport/src/main/java/com/github/dockerjava/transport Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66import java .net .Socket ;
77import java .net .SocketAddress ;
88import java .net .SocketException ;
9+ import java .nio .ByteBuffer ;
910import java .nio .channels .Channels ;
1011import java .nio .channels .SocketChannel ;
12+ import java .nio .channels .WritableByteChannel ;
1113
1214public class UnixSocket extends AbstractSocket {
1315
@@ -67,7 +69,7 @@ public OutputStream getOutputStream() throws IOException {
6769 throw new SocketException ("Socket output is shutdown" );
6870 }
6971
70- return Channels .newOutputStream (socketChannel );
72+ return Channels .newOutputStream (new WrappedWritableByteChannel () );
7173 }
7274
7375 @ Override
@@ -85,4 +87,22 @@ public void close() throws IOException {
8587 super .close ();
8688 this .socketChannel .close ();
8789 }
90+
91+ private class WrappedWritableByteChannel implements WritableByteChannel {
92+
93+ @ Override
94+ public int write (ByteBuffer src ) throws IOException {
95+ return UnixSocket .this .socketChannel .write (src );
96+ }
97+
98+ @ Override
99+ public boolean isOpen () {
100+ return UnixSocket .this .socketChannel .isOpen ();
101+ }
102+
103+ @ Override
104+ public void close () throws IOException {
105+ UnixSocket .this .socketChannel .close ();
106+ }
107+ }
88108}
You can’t perform that action at this time.
0 commit comments