code: public static final byte[] asByteArray(WsByteBuffer[] list) {
          if (null == list)
              return null;
          int size = 0;
          for (int i = 0; i < list.length && null != list[i]; i++) {
              size += list[i].limit();
          }
          if (0 == size)
              return null;
          byte[] output = new byte[size];
          int offset = 0;
          int position = 0;
          for (int i = 0; i < list.length && null != list[i]; i++) {
              position = list[i].position();
              list[i].position(0);
              list[i].get(output, offset, list[i].limit());
              offset += list[i].limit();
              list[i].position(position);
          }
          return output;
      }
docs: Convert an array of buffers to a byte array. The buffers will remain
  unchanged
  by this conversion. This will stop on the first null buffer. A null or
  empty
  list will return a null byte[].
  
  @param list
  @return byte[]