| 112 | } |
| 113 | |
| 114 | private static class OutputStreamChannel implements WritableByteChannel { |
| 115 | private OutputStream stream; |
| 116 | |
| 117 | public OutputStreamChannel(OutputStream stream) { |
| 118 | this.stream = stream; |
| 119 | } |
| 120 | |
| 121 | public void close() throws IOException { |
| 122 | if (stream != null) { |
| 123 | stream.close(); |
| 124 | stream = null; |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | public boolean isOpen() { |
| 129 | return stream != null; |
| 130 | } |
| 131 | |
| 132 | public int write(ByteBuffer b) throws IOException { |
| 133 | stream.write(b.array(), b.arrayOffset() + b.position(), b.remaining()); |
| 134 | |
| 135 | int c = b.remaining(); |
| 136 | |
| 137 | b.position(b.limit()); |
| 138 | |
| 139 | return c; |
| 140 | } |
| 141 | } |
| 142 | } |
nothing calls this directly
no outgoing calls
no test coverage detected