Exemple #1
0
class Io_line_rdr_fxt {
  Io_line_rdr rdr;
  List_adp lines = List_adp_.new_();
  Bry_bfr tmp = Bry_bfr.new_();

  public Io_line_rdr_fxt(Io_url... urls) {
    rdr = new Io_line_rdr(Gfo_usr_dlg_.Test(), urls);
  }

  public Io_line_rdr_fxt Load_len_lines_(int v) {
    return Load_len_(v * 3);
  } // 3: 2=##, 1=\n

  public Io_line_rdr_fxt Load_len_(int v) {
    rdr.Load_len_(v);
    return this;
  }

  public Io_line_rdr_fxt File_lines_(int count) {
    for (int i = 0; i < count; i++) tmp.Add_int_fixed(i, 2).Add_byte_nl();
    Io_mgr.I.SaveFilBry(rdr.Urls()[0], tmp.Xto_bry_and_clear());
    return this;
  }
  //	public Io_url[] Src_fils() {return src_fils;} public Io_line_rdr_fxt Src_fils_(Io_url[] v)
  // {src_fils = v; return this;} Io_url[] src_fils;
  public Io_line_rdr_fxt tst_Match(String match, String expd) {
    rdr.Key_gen_(Io_line_rdr_key_gen_.first_pipe);
    boolean match_v = rdr.Match(Bry_.new_u8(match));
    String actl = match_v ? String_.new_u8(rdr.Bfr(), rdr.Key_pos_bgn(), rdr.Key_pos_end()) : "";
    Tfds.Eq(expd, actl);
    return this;
  }

  public Io_line_rdr_fxt File_lines_pipe_(int count) {
    for (int i = 0; i < count; i++) tmp.Add_int_fixed(i, 2).Add_byte(Byte_ascii.Pipe).Add_byte_nl();
    Io_mgr.I.SaveFilBry(rdr.Urls()[0], tmp.Xto_bry_and_clear());
    return this;
  }

  public Io_line_rdr_fxt File_lines_(int fil_idx, int bgn, int end) {
    for (int i = bgn; i < end; i++) tmp.Add_int_fixed(i, 2).Add_byte_nl();
    Io_mgr.I.SaveFilBry(rdr.Urls()[fil_idx], tmp.Xto_bry_and_clear());
    return this;
  }

  public Io_line_rdr_fxt Clear() {
    rdr.Clear();
    return this;
  }

  public Io_line_rdr_fxt tst_Read_til_lines(int count, String... expd) {
    lines.Clear();
    for (int i = 0; i < expd.length; i++) expd[i] = expd[i] + Op_sys.Lnx.Nl_str();
    for (int i = 0; i < count; i++) {
      if (rdr.Read_next())
        lines.Add(String_.new_u8(rdr.Bfr(), rdr.Itm_pos_bgn(), rdr.Itm_pos_end()));
      else break;
    }
    Tfds.Eq_ary_str(expd, lines.To_str_ary());
    return this;
  }
}
Exemple #2
0
 public Io_line_rdr_fxt File_lines_(int count) {
   for (int i = 0; i < count; i++) tmp.Add_int_fixed(i, 2).Add_byte_nl();
   Io_mgr.I.SaveFilBry(rdr.Urls()[0], tmp.Xto_bry_and_clear());
   return this;
 }
Exemple #3
0
 public Io_line_rdr_fxt File_lines_(int fil_idx, int bgn, int end) {
   for (int i = bgn; i < end; i++) tmp.Add_int_fixed(i, 2).Add_byte_nl();
   Io_mgr.I.SaveFilBry(rdr.Urls()[fil_idx], tmp.Xto_bry_and_clear());
   return this;
 }