Example #1
0
  public static Io_stream_rdr Get_rdr_or_null(
      Io_url src_fil, Io_url src_dir, Io_stream_unzip_mgr unzip_mgr, String... filter_ary) {
    IoItmFil src_itm = null;
    if (src_fil != null) src_itm = Io_mgr.I.QueryFil(src_fil);

    // specified file doesn't exist; try to find similar file based on filter
    if (src_itm == null || !src_itm.Exists()) {
      src_itm = Get_itm_by_filters(src_dir, filter_ary);
      if (src_itm == null) return null;
    }

    // return rdr
    Io_url src_itm_url = src_itm.Url();
    Io_stream_rdr rv =
        unzip_mgr.Handles(src_itm_url)
            ? unzip_mgr.New_rdr(src_itm_url)
            : Io_stream_rdr_.file_(src_itm_url);
    rv.Len_(src_itm.Size());
    return rv;
  }
Example #2
0
 public Io_stream_rdr New_rdr(Io_url url) {
   return stdout_enabled
       ? Io_stream_rdr_process.new_(
           stdout_process.Exe_url(), url, stdout_process.Xto_process_bldr_args(url.Raw()))
       : Io_stream_rdr_.bzip2_(url);
 }