private void copyRemaining(ByteBuffer src,OutputStream dest) throws IOException {
  byte[] b=new byte[src.remaining()];
  src.get(b);
  dest.write(b);
}

private void copyRemaining ( ByteBuffer src , OutputStream dest ) throws IOException { byte [ ] b = new byte [ src . remaining ( ) ] ; src . get ( b ) ; dest . write ( b ) ; }
copies remaining bytes from byte buffer to output stream .
