List of utility methods to do ByteBuffer to OutputStream
OutputStream | newOutputStream(final ByteBuffer buf) new Output Stream return new OutputStream() { public synchronized void write(int b) throws IOException { try { buf.put((byte) b); } catch (BufferOverflowException e) { throw new IOException(e); public synchronized void write(byte[] bytes, int off, int len) throws IOException { try { buf.put(bytes, off, len); } catch (BufferOverflowException e) { throw new IOException(e); }; |
OutputStream | newOutputStream(final ByteBuffer dst) new Output Stream return new OutputStream() { public void write(int b) throws IOException { dst.put((byte) b); public void write(byte[] bytes, int off, int len) throws IOException { dst.put(bytes, off, len); }; ... |