-
- final static class InputChannel implements ReadableByteChannel {
-
- final private InputStream stream;
-
- public InputChannel(InputStream stream) {
- this.stream = stream;
- }
-
- @Override
- public boolean isOpen() {
- return true;
- }
-
- @Override
- public void close() throws IOException {
- }
-
- @Override
- public int read(ByteBuffer dst) throws IOException {
- int pos = dst.position();
- int limit = dst.limit();
- int i=stream.read(dst.array(), pos, limit-pos);
- return i;
- }
-
- }