code: public static final byte[] asByteArray(WsByteBuffer[] list, int[] positions, int[] limits) {
          if (null == list)
              return null;
          int size = 0;
          for (int i = 0; i < list.length && null != list[i]; i++) {
              size += limits[i] - positions[i];
          }
          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(positions[i]);
              list[i].get(output, offset, (limits[i] - positions[i]));
              offset += (limits[i] - positions[i]);
              list[i].position(position);
          }
          return output;
      }
docs: Converts a list of buffers to a byte[] using the input starting positions
  and
  ending limits. Buffers will remaining unchanged after this process. A null
  or
  empty list will return a null byte[]. This will also stop on the first null
  buffer.
  
  @param list
  @param positions
  @param limits
  @return byte[]