publicObjectMatch_bgn(byte[]src,intbgn_pos,intend_pos){returnbgn_pos <end_pos?Match_bgn_w_byte(src[bgn_pos],src,bgn_pos,end_pos):null;}// handle out of bounds gracefully; EX: Match_bgn("abc", 3, 3) should return null not fail
?Int_.Xto_str(v_as_int)// convert to int, and call print String to eliminate any trailing decimal places
:Float_.Xto_str((float)v);// calling ((float)v).toString is better at removing trailing 0s than String.format("%g", v). note that .net .toString() handles it better; EX:2449.600000000000d; DATE:2014-07-29
?Int_.To_str(v_as_int)// convert to int, and call print String to eliminate any trailing decimal places
:Float_.To_str((float)v);// calling ((float)v).toString is better at removing trailing 0s than String.format("%g", v). note that .net .toString() handles it better; EX:2449.600000000000d; DATE:2014-07-29
publicBry_bfr_mkr_mgr(bytemgr_id,intreset){// NOTE: random IndexOutOfBounds errors in Get around free[--free_len] with free_len being -1; put member variable initialization within thread_lock to try to avoid; DATE:2014-09-21
thread_lock=newObject();
synchronized(thread_lock){
this.mgr_id=mgr_id;
this.reset=reset;
@ -72,7 +69,7 @@ class Bry_bfr_mkr_mgr {
for(inti=0;i<ary_max;i++){
Bry_bfritm=ary[i];
if(itm!=null){
if(!itm.Mkr_idx_is_null())throwErr_.new_wo_type("failed to clear bfr","idx",Int_.Xto_str(i));
if(!itm.Mkr_idx_is_null())throwErr_.new_wo_type("failed to clear bfr","idx",Int_.To_str(i));
itm.Clear();
}
ary[i]=null;
@ -132,18 +129,6 @@ class Bry_bfr_mkr_mgr {
Array_.Copy_to(free,0,new_free,0,free_len);
free=new_free;
}
// public void Rls(Bry_bfr v) {
// synchronized (thread_lock) {
// int idx = v.Mkr_itm();
// if (idx == -1) throw Err_mgr._.fmt_("gplx.Bry_bfr", "rls_failed", "rls called on bfr that was not created by factory");
// int new_ary_len = nxt_idx - 1;
// if (idx == new_ary_len)
// nxt_idx = new_ary_len;
// else
// free[free_len++] = idx;
// v.Mkr_(null, -1);
// }
// }
publicvoidRls(intidx){
synchronized(thread_lock){
if(idx==-1)throwErr_.new_wo_type("rls called on bfr that was not created by factory");
Io_mgr.I.CreateDir(xrg.Trg().OwnerDir());// dir must exist for OpenStreamWrite; create dir at last possible moment in case stream does not exist.
Io_mgr.Instance.CreateDir(xrg.Trg().OwnerDir());// dir must exist for OpenStreamWrite; create dir at last possible moment in case stream does not exist.
}
byte[]download_bfr=newbyte[Download_bfr_len];// NOTE: download_bfr was originally member variable; DATE:2013-05-03
xfer_fmt.Bgn(content_length);
@ -423,7 +423,7 @@ public class IoEngine_system extends IoEngine_base {
if(xrg.Prog_cancel()){
src_stream.close();
trg_stream.Rls();
Io_mgr.I.DeleteFil(xrg.Trg());
Io_mgr.Instance.DeleteFil(xrg.Trg());
}
xfer_fmt.Prog(count);
trg_stream.Write(download_bfr,0,count);
@ -467,7 +467,7 @@ public class IoEngine_system extends IoEngine_base {
Io_mgr.I.CreateDir(xrg.Trg().OwnerDir());// dir must exist for OpenStreamWrite; create dir at last possible moment in case stream does not exist.
trg_stream=Io_mgr.I.OpenStreamWrite(xrg.Trg());
Io_mgr.Instance.CreateDir(xrg.Trg().OwnerDir());// dir must exist for OpenStreamWrite; create dir at last possible moment in case stream does not exist.