File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
docker-java-transport/src/main/java/com/github/dockerjava/transport Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 6
6
import java .net .Socket ;
7
7
import java .net .SocketAddress ;
8
8
import java .net .SocketException ;
9
+ import java .nio .ByteBuffer ;
9
10
import java .nio .channels .Channels ;
10
11
import java .nio .channels .SocketChannel ;
12
+ import java .nio .channels .WritableByteChannel ;
11
13
12
14
public class UnixSocket extends AbstractSocket {
13
15
@@ -67,7 +69,7 @@ public OutputStream getOutputStream() throws IOException {
67
69
throw new SocketException ("Socket output is shutdown" );
68
70
}
69
71
70
- return Channels .newOutputStream (socketChannel );
72
+ return Channels .newOutputStream (new WrappedWritableByteChannel () );
71
73
}
72
74
73
75
@ Override
@@ -85,4 +87,22 @@ public void close() throws IOException {
85
87
super .close ();
86
88
this .socketChannel .close ();
87
89
}
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
+ }
88
108
}
You can’t perform that action at this time.
0 commit comments