mirror of
https://github.com/gnosygnu/xowa.git
synced 2026-03-02 03:49:30 +00:00
Xomw: Add commafy
This commit is contained in:
@@ -302,6 +302,11 @@ public class Bry_ {
|
||||
for (int i = src_bgn; i < src_end; i++)
|
||||
trg[i + trg_adj] = src[i];
|
||||
}
|
||||
public static void Copy_by_pos_reversed(byte[] src, int src_bgn, int src_end, byte[] trg, int trg_bgn) {
|
||||
int len = src_end - src_bgn;
|
||||
for (int i = 0; i < len; i++)
|
||||
trg[trg_bgn + i] = src[src_end - i - 1];
|
||||
}
|
||||
private static void Copy_by_len(byte[] src, int src_bgn, int src_len, byte[] trg, int trg_bgn) {
|
||||
for (int i = 0; i < src_len; i++)
|
||||
trg[i + trg_bgn] = src[i + src_bgn];
|
||||
|
||||
@@ -93,6 +93,15 @@ public class Bry_bfr {
|
||||
bfr_len += len;
|
||||
return this;
|
||||
}
|
||||
public Bry_bfr Add_reverse_mid(byte[] val, int bgn, int end) {
|
||||
int len = end - bgn;
|
||||
if (len < 0) throw Err_.new_wo_type("negative len", "bgn", bgn, "end", end, "excerpt", String_.new_u8__by_len(val, bgn, bgn + 16)); // NOTE: check for invalid end < bgn, else difficult to debug errors later; DATE:2014-05-11
|
||||
if (bfr_len + len > bfr_max) Resize((bfr_max + len) * 2);
|
||||
Bry_.Copy_by_pos_reversed(val, bgn, end, bfr, bfr_len);
|
||||
// Array_.Copy_to(val, bgn, bfr, bfr_len, len);
|
||||
bfr_len += len;
|
||||
return this;
|
||||
}
|
||||
public Bry_bfr Add_mid_w_swap(byte[] val, int bgn, int end, byte swap_src, byte swap_trg) {
|
||||
int len = end - bgn;
|
||||
if (len < 0) throw Err_.new_wo_type("negative len", "bgn", bgn, "end", end, "excerpt", String_.new_u8__by_len(val, bgn, bgn + 16)); // NOTE: check for invalid end < bgn, else difficult to debug errors later; DATE:2014-05-11
|
||||
@@ -589,6 +598,16 @@ public class Bry_bfr {
|
||||
this.Mkr_rls();
|
||||
return rv;
|
||||
}
|
||||
public byte[] To_reversed_bry_and_clear() {
|
||||
int len = this.Len();
|
||||
byte[] rv = new byte[len];
|
||||
for (int i = 0; i < len; i++) {
|
||||
rv[len - i - 1] = bfr[i];
|
||||
}
|
||||
this.Clear();
|
||||
if (reset > 0) Reset_if_gt(reset);
|
||||
return rv;
|
||||
}
|
||||
public String To_str() {return String_.new_u8(To_bry());}
|
||||
public String To_str_by_pos(int bgn, int end) {return String_.new_u8(To_bry(), bgn, end);}
|
||||
public String To_str_and_clear() {return String_.new_u8(To_bry_and_clear());}
|
||||
|
||||
Reference in New Issue
Block a user