public Long sort(byte[] key, SortParameters params, byte[] sortKey) {

    Object[] sort = SrpUtils.sortParams(params, sortKey);

    try {
      if (isPipelined()) {
        pipeline(pipeline.sort(key, sort));
        return null;
      }
      return ((Long) client.sort(key, sort).data());
    } catch (Exception ex) {
      throw convertSrpAccessException(ex);
    }
  }
  public List<byte[]> sort(byte[] key, SortParameters params) {

    Object[] sort = SrpUtils.sortParams(params);

    try {
      if (isPipelined()) {
        pipeline(pipeline.sort(key, sort));
        return null;
      }
      return SrpUtils.toBytesList((Reply[]) client.sort(key, sort).data());
    } catch (Exception ex) {
      throw convertSrpAccessException(ex);
    }
  }