1
0
mirror of https://github.com/gnosygnu/xowa.git synced 2026-03-02 03:49:30 +00:00
This commit is contained in:
gnosygnu
2015-07-19 23:16:49 -04:00
parent 794b5a232f
commit 8e041d6e06
834 changed files with 4749 additions and 4461 deletions

View File

@@ -21,9 +21,9 @@ public class Io_buffer_rdr implements RlsAble {
private Io_stream_rdr rdr;
Io_buffer_rdr(Io_stream_rdr rdr, Io_url url, int bfr_len) {
this.rdr = rdr; this.url = url;
if (bfr_len <= 0) throw Exc_.new_("bfr_len must be > 0", "bfr_len", bfr_len);
if (bfr_len <= 0) throw Err_.new_wo_type("bfr_len must be > 0", "bfr_len", bfr_len);
bfr = new byte[bfr_len]; this.bfr_len = bfr_len;
IoItmFil fil = Io_mgr.I.QueryFil(url); if (!fil.Exists()) throw Exc_.new_("fil does not exist", "url", url);
IoItmFil fil = Io_mgr.I.QueryFil(url); if (!fil.Exists()) throw Err_.new_wo_type("fil does not exist", "url", url);
fil_len = fil.Size();
fil_pos = 0;
fil_eof = false;
@@ -36,7 +36,7 @@ public class Io_buffer_rdr implements RlsAble {
public boolean Fil_eof() {return fil_eof;} private boolean fil_eof;
public boolean Bfr_load_all() {return Bfr_load(0, bfr_len);}
public boolean Bfr_load_from(int bfr_pos) {
if (bfr_pos < 0 || bfr_pos > bfr_len) throw Exc_.new_("invalid bfr_pos", "bfr_pos", bfr_pos, "bfr_len", bfr_len);
if (bfr_pos < 0 || bfr_pos > bfr_len) throw Err_.new_wo_type("invalid bfr_pos", "bfr_pos", bfr_pos, "bfr_len", bfr_len);
for (int i = bfr_pos; i < bfr_len; i++) // shift end of bfr to bgn; EX: bfr[10] and load_from(8); [8] -> [0]; [9] -> [1];
bfr[i - bfr_pos] = bfr[i];
return Bfr_load(bfr_len - bfr_pos, bfr_pos); // fill rest of bfr; EX: [2]... will come from file

View File

@@ -42,7 +42,7 @@ public class Io_line_rdr {
public Io_line_rdr_key_gen Key_gen() {return key_gen;} public Io_line_rdr Key_gen_(Io_line_rdr_key_gen v) {key_gen = v; return this;} Io_line_rdr_key_gen key_gen = Io_line_rdr_key_gen_.first_pipe;
public void Truncate(int pos) {
this.Read_next();
int end = Bry_finder.Find_fwd(bfr, Byte_ascii.Nil); if (end == -1) end = bfr.length;
int end = Bry_finder.Find_fwd(bfr, Byte_ascii.Null); if (end == -1) end = bfr.length;
bfr = Bry_.Mid(bfr, pos, end);
bfr_len = bfr.length;
bfr_last_read = 0;

View File

@@ -46,7 +46,7 @@ public class Io_sort {
return (Io_url[])rv.To_ary(Io_url.class);
}
public void Merge(Gfo_usr_dlg usr_dlg, Io_url[] src_ary, ComparerAble comparer, Io_line_rdr_key_gen key_gen, Io_sort_cmd cmd) {
BinaryHeap_Io_line_rdr heap = load_(usr_dlg, src_ary, comparer, key_gen, memory_max); if (heap.Len() == 0) return;//throw Err_.new_(Array_.XtoStr(src_ary));
BinaryHeap_Io_line_rdr heap = load_(usr_dlg, src_ary, comparer, key_gen, memory_max); if (heap.Len() == 0) return;//throw Err_.new_wo_type(Array_.XtoStr(src_ary));
Io_line_rdr stream = null;
cmd.Sort_bgn();
while (true) {