v3.3.4 v2.11.1.1
gnosygnu 9 years ago
parent 4f43f51b18
commit b990ec409f

@ -8,20 +8,14 @@
<classpathentry kind="src" path="src_120_basicDataType"/>
<classpathentry kind="src" path="src_130_brys"/>
<classpathentry kind="src" path="src_140_list"/>
<classpathentry kind="src" path="src_150_text"/>
<classpathentry kind="src" path="src_160_hash"/>
<classpathentry kind="src" path="src_200_io"/>
<classpathentry kind="src" path="src_210_env"/>
<classpathentry kind="src" path="src_300_classXtn"/>
<classpathentry kind="src" path="src_310_gfoNde"/>
<classpathentry kind="src" path="src_311_gfoObj"/>
<classpathentry kind="src" path="src_330_store"/>
<classpathentry kind="src" path="src_340_dsv"/>
<classpathentry kind="src" path="src_400_gfs"/>
<classpathentry kind="src" path="src_410_gfoCfg"/>
<classpathentry kind="src" path="src_420_usrMsg"/>
<classpathentry kind="src" path="src_800_tst"/>
<classpathentry kind="src" path="src_900_xml"/>
<classpathentry kind="src" path="tst"/>
<classpathentry kind="src" path="xtn"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>

@ -51,10 +51,8 @@ public class Err_ {
return new Err(Bool_.Y, Trace_null, Type__gplx, "cast failed", "type", Type_adp_.NameOf_type(t), "obj", o_str);
}
public static String Message_lang(Exception e) {return e.getMessage();}
public static String Message_lang_error(Error e) {return e.getMessage();}
public static String Trace_lang(Exception e) {return Trace_lang_exec(e.getStackTrace());}
public static String Trace_lang(Error e) {return Trace_lang_exec(e.getStackTrace());}
public static String Message_lang(Throwable e) {return e.getMessage();}
public static String Trace_lang(Throwable e) {return Trace_lang_exec(e.getStackTrace());}
private static String Trace_lang_exec(StackTraceElement[] ary) {
String rv = "";
int len = ary.length;
@ -70,6 +68,6 @@ public class Err_ {
}
public static String Message_gplx_full(Exception e) {return cast_or_make(e).To_str__full();}
public static String Message_gplx_log(Exception e) {return cast_or_make(e).To_str__log();}
public static Err cast_or_make(Exception e) {return Type_adp_.Eq_typeSafe(e, Err.class) ? (Err)e : new Err(Bool_.N, Err_.Trace_lang(e), Type_adp_.NameOf_obj(e), Err_.Message_lang(e));}
public static Err cast_or_make(Throwable e) {return Type_adp_.Eq_typeSafe(e, Err.class) ? (Err)e : new Err(Bool_.N, Err_.Trace_lang(e), Type_adp_.NameOf_obj(e), Err_.Message_lang(e));}
public static final String Type__op_canceled = "gplx.op_canceled";
}

@ -16,8 +16,8 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
import gplx.core.primitives.*; import gplx.ios.*; /*IoItmFil, IoItmDir..*/
public class Io_mgr { // exists primarily to gather all cmds under gplx namespace; otherwise need to use gplx.ios whenever copying/deleting file
import gplx.core.primitives.*; import gplx.core.ios.*; /*IoItmFil, IoItmDir..*/
public class Io_mgr { // exists primarily to gather all cmds under gplx namespace; otherwise need to use gplx.core.ios whenever copying/deleting file
public boolean Exists(Io_url url) {return url.Type_dir() ? ExistsDir(url) : ExistsFil(url);}
public boolean ExistsFil(Io_url url) {return IoEnginePool.Instance.Get_by(url.Info().EngineKey()).ExistsFil_api(url);}
public void ExistsFilOrFail(Io_url url) {if (!ExistsFil(url)) throw Err_.new_wo_type("could not find file", "url", url);}

@ -151,7 +151,7 @@ public class Tfds { // URL:doc/gplx.tfds/Tfds.txt
}
static final String EmptyStr = TfdsMsgBldr.EmptyStr;
static TfdsMsgBldr msgBldr = TfdsMsgBldr.new_();
public static final Io_url RscDir = Io_url_.Usr().GenSubDir_nest("xowa", "dev", "tst");
public static final Io_url RscDir = Io_url_.Usr().GenSubDir_nest("000", "200_dev", "190_tst");
public static DateAdp Now_time0_add_min(int minutes) {return time0.Add_minute(minutes);}
@gplx.Internal protected static boolean Now_enabled() {return now_enabled;} private static boolean now_enabled; private static boolean now_freeze;
public static void Now_enabled_n_() {now_enabled = false; now_freeze = false;}

@ -48,6 +48,7 @@ public class Btrie_slim_mgr implements Btrie_mgr {
public Btrie_slim_mgr Add_bry(String key, String val) {return (Btrie_slim_mgr)Add_obj(Bry_.new_u8(key), Bry_.new_u8(val));}
public Btrie_slim_mgr Add_bry(String key, byte[] val) {return (Btrie_slim_mgr)Add_obj(Bry_.new_u8(key), val);}
public Btrie_slim_mgr Add_bry(byte[] v) {return (Btrie_slim_mgr)Add_obj(v, v);}
public Btrie_slim_mgr Add_str_str(String key, String val) {return (Btrie_slim_mgr)Add_obj(Bry_.new_u8(key), Bry_.new_u8(val));}
public Btrie_slim_mgr Add_bry_bry(byte[] key, byte[] val) {return (Btrie_slim_mgr)Add_obj(key, val);}
public Btrie_slim_mgr Add_bry_byte(byte b, byte val) {return (Btrie_slim_mgr)Add_obj(new byte[] {b}, Byte_obj_val.new_(val));}
public Btrie_slim_mgr Add_bry_byte(byte[] bry, byte val) {return (Btrie_slim_mgr)Add_obj(bry, Byte_obj_val.new_(val));}

@ -40,7 +40,7 @@ class Btrie_u8_itm {
else { // itm has asymmetric_bry; EX: "İ" was added to trie, must match "İ" and "i";
if (called_by_match) { // called by mgr.Match
return
( Bry_.Eq(src, c_bgn, c_end, rv.key) // key matches src; EX: "aİ"
( Bry_.Eq(src, c_bgn, c_end, rv.key) // key matches src; EX: "aİ"
|| Bry_.Eq(src, c_bgn, c_end, rv.asymmetric_bry) // asymmetric_bry matches src; EX: "ai"; note that "aI" won't match
)
? rv : null;

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.criterias; import gplx.*; import gplx.core.*;
import gplx.texts.*; /*RegxPatn_cls_like*/
import gplx.core.texts.*; /*RegxPatn_cls_like*/
public class Criteria_ {
public static final Criteria All = new Criteria_const(true);
public static final Criteria None = new Criteria_const(false);

@ -17,7 +17,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.criterias; import gplx.*; import gplx.core.*;
import org.junit.*;
import gplx.ios.*;
import gplx.core.ios.*;
public class Criteria_ioItm_tst {
IoItmFil fil; Criteria crt; IoItm_fxt fx = IoItm_fxt.new_();
@Test public void IoType() {

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.criterias; import gplx.*; import gplx.core.*;
import gplx.texts.*;
import gplx.core.texts.*;
public class Criteria_ioMatch implements Criteria { // EX: url IOMATCH '*.xml|*.txt'
public Criteria_ioMatch(boolean match, RegxPatn_cls_ioMatch pattern) {this.match = match; this.pattern = pattern;}
public byte Tid() {return Criteria_.Tid_iomatch;}

@ -16,7 +16,7 @@ You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.criterias; import gplx.*; import gplx.core.*;
import gplx.texts.*; /*RegxPatn_cls_like*/
import gplx.core.texts.*; /*RegxPatn_cls_like*/
public class Criteria_like implements Criteria {
@gplx.Internal protected Criteria_like(boolean negated, RegxPatn_cls_like pattern) {
this.negated = negated; this.pattern = pattern;

@ -0,0 +1,65 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.encoders; import gplx.*; import gplx.core.*;
public class Base85_ {
public static String To_str(int val, int min_len) {return String_.new_u8(Set_bry(val, null, 0, min_len));}
public static byte[] To_bry(int val, int min_len) {return Set_bry(val, null, 0, min_len);}
public static byte[] Set_bry(int val, byte[] ary, int ary_pos, int min_len) {
int val_len = Bry_len(val);
int ary_len = val_len, pad_len = 0;
boolean pad = ary_len < min_len;
if (pad) {
pad_len = min_len - ary_len;
ary_len = min_len;
}
if (ary == null) ary = new byte[ary_len];
if (pad) {
for (int i = 0; i < pad_len; i++) // fill ary with pad_len
ary[i + ary_pos] = A7_offset;
}
for (int i = ary_len - pad_len; i > 0; i--) {
int div = Pow85[i - 1];
byte tmp = (byte)(val / div);
ary[ary_pos + ary_len - i] = (byte)(tmp + A7_offset);
val -= tmp * div;
}
return ary;
}
public static int To_int_by_str(String s) {
byte[] ary = Bry_.new_u8(s);
return To_int_by_bry(ary, 0, ary.length - 1);
}
public static int To_int_by_bry(byte[] ary, int bgn, int end) {
int rv = 0, factor = 1;
for (int i = end; i >= bgn; i--) {
rv += (ary[i] - A7_offset) * factor;
factor *= Radix;
}
return rv;
}
public static int Bry_len(int v) {
if (v == 0) return 1;
for (int i = Pow85_last; i > -1; i--)
if (v >= Pow85[i]) return i + 1;
throw Err_.new_wo_type("neg number not allowed", "v", v);
}
public static final int Len_int = 5;
private static final int Pow85_last = 4, Radix = 85; private static final byte A7_offset = 33;
public static final int Pow85_0 = 1, Pow85_1 = 85, Pow85_2 = 7225, Pow85_3 = 614125, Pow85_4 = 52200625;
public static int[] Pow85 = new int[]{Pow85_0, Pow85_1, Pow85_2, Pow85_3, Pow85_4}; // NOTE: ary constructed to match index to exponent; Pow85[1] = 85^1
}

@ -0,0 +1,61 @@
/*
XOWA: the XOWA Offline Wiki Application
Copyright (C) 2012 gnosygnu@gmail.com
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.core.encoders; import gplx.*; import gplx.core.*;
import org.junit.*;
public class Base85__tst {
private final Base85__fxt fxt = new Base85__fxt();
@Test public void Log() {
fxt.Test_log( 0, 1);
fxt.Test_log( 84, 1);
fxt.Test_log( 85, 2);
fxt.Test_log( 7224, 2);
fxt.Test_log( 7225, 3);
fxt.Test_log( 614124, 3);
fxt.Test_log( 614125, 4);
fxt.Test_log( 52200624, 4);
fxt.Test_log( 52200625, 5);
fxt.Test_log(Int_.Max_value, 5);
}
@Test public void To_str() {
fxt.Test_to_str( 0, "!");
fxt.Test_to_str( 84, "u");
fxt.Test_to_str( 85, "\"!");
fxt.Test_to_str( 7224, "uu");
fxt.Test_to_str( 7225, "\"!!");
fxt.Test_to_str( 614124, "uuu");
fxt.Test_to_str( 614125, "\"!!!");
fxt.Test_to_str( 52200624, "uuuu");
fxt.Test_to_str( 52200625, "\"!!!!");
}
@Test public void XtoStrAry() {
byte[] ary = new byte[9];
fxt.Exec_to_str(ary, 0, 2); // !!#
fxt.Exec_to_str(ary, 3, 173); // !#$
fxt.Exec_to_str(ary, 6, 14709); // #$%
Tfds.Eq("!!#!#$#$%", String_.new_u8(ary));
}
}
class Base85__fxt {
public void Test_log(int val, int expd) {Tfds.Eq(expd, Base85_.Bry_len(val));}
public void Test_to_str(int val, String expd) {
String actl = Base85_.To_str(val, 0);
Tfds.Eq(expd, actl);
Tfds.Eq(val, Base85_.To_int_by_str(expd));
}
public void Exec_to_str(byte[] ary, int aryPos, int val) {Base85_.Set_bry(val, ary, aryPos, 3);}
}

@ -53,7 +53,7 @@ public class Utf16_ {
public static byte[] Encode_hex_to_bry(String raw) {return Encode_hex_to_bry(Bry_.new_a7(raw));}
public static byte[] Encode_hex_to_bry(byte[] raw) {
if (raw == null) return null;
int int_val = gplx.texts.HexDecUtl.parse_or(raw, Int_.Min_value);
int int_val = gplx.core.texts.HexDecUtl.parse_or(raw, Int_.Min_value);
return int_val == Int_.Min_value ? null : Encode_int_to_bry(int_val);
}
public static byte[] Encode_int_to_bry(int c) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.consoles.*; import gplx.core.criterias.*;
public interface IoEngine {
String Key();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEnginePool {
private final Hash_adp hash = Hash_adp_.new_();
public void Add_if_dupe_use_nth(IoEngine engine) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_ {
public static final String SysKey = "sys";
public static final String MemKey = "mem";

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public abstract class IoEngine_base implements IoEngine {
public abstract String Key();
public abstract boolean ExistsFil_api(Io_url url);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_memory extends IoEngine_base {
@Override public String Key() {return key;} private String key = IoEngine_.MemKey;
@Override public boolean ExistsFil_api(Io_url url) {return FetchFil(url) != IoItmFil_mem.Null;}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
@ -493,9 +493,9 @@ public class IoEngine_system extends IoEngine_base {
class IoEngineArgs {
public int LoadFilStr_BufferSize = 4096 * 256;
public String LoadFilStr_Encoding = "UTF-8";
public String Err_ReadonlyFileNotWritable = "gplx.ios.ReadonlyFileNotWritable";
public String Err_FileNotFound = "gplx.ios.FileNotFound";
public String Err_IoException = "gplx.ios.IoException";
public String Err_ReadonlyFileNotWritable = "gplx.core.ios.ReadonlyFileNotWritable";
public String Err_FileNotFound = "gplx.core.ios.FileNotFound";
public String Err_IoException = "gplx.core.ios.IoException";
public static final IoEngineArgs Instance = new IoEngineArgs();
}
class IoEngine_system_xtn {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.consoles.*; import gplx.core.criterias.*;
public class IoEngine_xrg_deleteDir {
public Io_url Url() {return url;} public IoEngine_xrg_deleteDir Url_(Io_url val) {url = val; return this;} Io_url url;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_xrg_deleteFil extends IoEngine_xrg_fil_affects1_base {
@gplx.New public IoEngine_xrg_deleteFil Url_(Io_url val) {Url_set(val); return this;}
public IoEngine_xrg_deleteFil ReadOnlyFails_off() {return ReadOnlyFails_(false);} public IoEngine_xrg_deleteFil ReadOnlyFails_(boolean v) {ReadOnlyFails_set(v); return this;}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_xrg_downloadFil {
public String Src() {return src;} public IoEngine_xrg_downloadFil Src_(String v) {src = v; return this;} private String src;
public Io_url Trg() {return trg;} public IoEngine_xrg_downloadFil Trg_(Io_url v) {trg = v; return this;} private Io_url trg;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_xrg_fil_affects1_base {
public Io_url Url() {return url;} public void Url_set(Io_url v) {url = v;} Io_url url;
public IoEngine_xrg_fil_affects1_base Url_(Io_url v) {url = v; return this;}

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
import gplx.texts.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.texts.*;
public class IoEngine_xrg_loadFilStr {
public Io_url Url() {return url;} public IoEngine_xrg_loadFilStr Url_(Io_url val) {url = val; return this;} Io_url url;
public boolean MissingIgnored() {return missingIgnored;} public IoEngine_xrg_loadFilStr MissingIgnored_() {return MissingIgnored_(true);} public IoEngine_xrg_loadFilStr MissingIgnored_(boolean v) {missingIgnored = v; return this;} private boolean missingIgnored = false;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_xrg_openRead {
public Io_url Url() {return url;} Io_url url;
public String ErrMsg() {return errMsg;} private String errMsg;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_xrg_openWrite {
public Io_url Url() {return url;} public IoEngine_xrg_openWrite Url_(Io_url val) {url = val; return this;} Io_url url;
public boolean ReadOnlyIgnored() {return readOnlyIgnored;} public IoEngine_xrg_openWrite ReadOnlyIgnored_() {return ReadOnlyIgnored_(true);} public IoEngine_xrg_openWrite ReadOnlyIgnored_(boolean v) {readOnlyIgnored = v; return this;} private boolean readOnlyIgnored = false;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.consoles.*; import gplx.core.criterias.*;
public class IoEngine_xrg_queryDir {
public Io_url Url() {return url;} public IoEngine_xrg_queryDir Url_(Io_url val) {url = val; return this;} Io_url url;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
public class IoEngine_xrg_recycleFil extends IoEngine_xrg_fil_affects1_base {
public IoEngine_xrg_recycleFil MissingFails_off() {return MissingFails_(false);} public IoEngine_xrg_recycleFil MissingFails_(boolean v) {MissingFails_set(v); return this;}

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
import gplx.texts.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.texts.*;
public class IoEngine_xrg_saveFilStr {
public Io_url Url() {return url;} public IoEngine_xrg_saveFilStr Url_(Io_url val) {url = val; return this;} Io_url url;
public String Text() {return text;} public IoEngine_xrg_saveFilStr Text_(String val) {text = val; return this;} private String text = "";

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.criterias.*;
public class IoEngine_xrg_xferDir {
public boolean Type_move() {return move;} public boolean Type_copy() {return !move;} private boolean move = false;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoEngine_xrg_xferFil {
public boolean Type_move() {return move;} private boolean move = false;
public Io_url Src() {return src;} Io_url src;

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoErr {
public static String Namespace = "gplx.ios.";
public static String Namespace = "gplx.core.ios.";
public static String FileIsReadOnly_key = Namespace + "FileIsReadOnlyError";
public static String FileNotFound_key = Namespace + "FileNotFoundError";
public static Err FileIsReadOnly(Io_url url) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItmAttrib {
public boolean ReadOnly() {return readOnly;} public IoItmAttrib ReadOnly_() {return ReadOnly_(true);} public IoItmAttrib ReadOnly_(boolean val) {readOnly = val; return this;} private boolean readOnly;
public boolean Hidden() {return hidden;} public IoItmAttrib Hidden_() {return Hidden_(true);} public IoItmAttrib Hidden_(boolean val) {hidden = val; return this;} private boolean hidden;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItmClassXtn extends ClassXtn_base implements ClassXtn {
public String Key() {return Key_const;} public static final String Key_const = "ioItemType";
@Override public Class<?> UnderClass() {return int.class;}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.criterias.*;
public class IoItmDir extends IoItm_base {
public boolean Exists() {return exists;} public void Exists_set(boolean v) {exists = v;} private boolean exists = true;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItmDir_ {
public static IoItmDir as_(Object obj) {return obj instanceof IoItmDir ? (IoItmDir)obj : null;}
public static final IoItmDir Null = null_();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItmFil extends IoItm_base {
@Override public int TypeId() {return IoItmFil.Type_Fil;} @Override public boolean Type_dir() {return false;} @Override public boolean Type_fil() {return true;} public static final int Type_Fil = 2;
public boolean Exists() {return size != Size_invalid;} // NOTE: questionable logic, but preserved for historical reasons; requires that length be set to -1 if !.exists

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItmFil_ {
public static IoItmFil as_(Object obj) {return obj instanceof IoItmFil ? (IoItmFil)obj : null;}
public static final String

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
import gplx.ios.*; /*IoStream_mem*/ import gplx.texts.*; /*Encoding_*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.ios.*; /*IoStream_mem*/ import gplx.core.texts.*; /*Encoding_*/
class IoItmFil_mem extends IoItmFil { public static IoItmFil_mem as_(Object obj) {return obj instanceof IoItmFil_mem ? (IoItmFil_mem)obj : null;}
@gplx.Internal protected IoStream_mem Stream() {return stream;} IoStream_mem stream; // NOTE: using stream instead of Text, b/c no events for IoStream.Dispose; ex: stream.OpenStreamWrite; stream.Write("hi"); stream.Dispose(); "hi" would not be saved if Text is member variable
@Override public long Size() {return (int)stream.Len();}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItmHash extends Ordered_hash_base {
public Io_url Url() {return url;} Io_url url;
public void Add(IoItm_base itm) {Add_base(MakeKey(itm.Url()), itm);}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.lists.*; /*Ordered_hash_base*/
public class IoItmList extends Ordered_hash_base {
public boolean Has(Io_url url) {return Has_base(MakeKey(url));}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public abstract class IoItm_base implements GfoInvkAble, CompareAble {
public abstract int TypeId(); public abstract boolean Type_dir(); public abstract boolean Type_fil();
public Io_url Url() {return ownerDir == null ? url : ownerDir.Url().GenSubFil(name); /*NOTE: must call .Url*/} Io_url url;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoItm_base_ {
public static IoItm_base as_(Object obj) {return obj instanceof IoItm_base ? (IoItm_base)obj : null;}
public static final String

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
public class IoRecycleBin {
public void Send(Io_url url) {Send_xrg(url).Exec();}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public interface IoStream extends RlsAble {
Object UnderRdr();
Io_url Url();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
import gplx.texts.*; /*Encoding_*/
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.texts.*; /*Encoding_*/
class IoStream_mem extends IoStream_base {
@Override public Io_url Url() {return url;} Io_url url;
@Override public Object UnderRdr() {throw Err_.new_unimplemented();} // NOTE: should not use System.IO.MemoryStream, b/c resized data will not be captured in this instance's buffer

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import org.junit.*; //using System.IO; /*Stream*/
public class IoStream_mem_tst {
@Test public void Write() { // confirm that changes written to Stream acquired via .AdpObj are written to IoStream_mem.Buffer

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoStream_mock implements IoStream {
public byte[] Data_bry() {return data_bry;} public IoStream_mock Data_bry_(byte[] v) {data_bry = v; data_bry_len = v.length; return this;} private byte[] data_bry; int data_bry_len;
public int Data_bry_pos() {return data_bry_pos;} int data_bry_pos;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import org.junit.*;
public class IoStream_mock_tst {
@Before public void init() {fxt.Clear();} IoStream_mock_fxt fxt = new IoStream_mock_fxt();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoStream_stream_rdr implements IoStream {
public int Read(byte[] bfr, int bfr_bgn, int bfr_len) {
try {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public interface IoUrlInfo {
String Key();
byte DirSpr_byte();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoUrlInfoRegy implements GfoInvkAble {
public void Reg(IoUrlInfo info) {hash.Add_if_dupe_use_nth(info.Key(), info);}
public IoUrlInfo Match(String raw) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class IoUrlInfo_ {
public static final IoUrlInfo Nil = IoUrlInfo_nil.Instance;
public static final IoUrlInfo Wnt = IoUrlInfo_wnt.Instance;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
public class IoUrlTypeRegy implements GfoInvkAble {
public String[] FetchAryOr(String key, String... or) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.stores.*; /*GfoNdeRdr_*/
public class IoZipWkr {
public Io_url ExeUrl() {return (Io_url)GfoRegy.Instance.FetchValOrFail(Regy_ExeUrl);}
@ -30,7 +30,7 @@ public class IoZipWkr {
}
ProcessAdp process = new ProcessAdp();
public static IoZipWkr regy_() {return new IoZipWkr();}
static final String Regy_ExeUrl = "gplx.ios.IoZipWkr.ExeUrl", Regy_ExeArgFmt = "gplx.ios.IoZipWkr.ExeArgFmt";
static final String Regy_ExeUrl = "gplx.core.ios.IoZipWkr.ExeUrl", Regy_ExeArgFmt = "gplx.core.ios.IoZipWkr.ExeArgFmt";
public static IoZipWkr new_(Io_url exeUrl, String expandArgs) {
GfoRegy.Instance.RegObj(Regy_ExeUrl, exeUrl);
GfoRegy.Instance.RegObj(Regy_ExeArgFmt, expandArgs);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import org.junit.*;
public class IoZipWkr_tst {
@Test public void Basic() {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import gplx.brys.*;
public class Io_download_fmt {
private final Io_size_fmtr_arg size_fmtr_arg = new Io_size_fmtr_arg(), rate_fmtr_arg = new Io_size_fmtr_arg().Suffix_(Bry_.new_a7("ps"));

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import org.junit.*;
public class Io_download_fmt_tst {
Io_download_fmt_fxt fxt = new Io_download_fmt_fxt();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_fil implements gplx.CompareAble {
public Io_fil(Io_url url, String data) {this.url = url; this.data = data;}
public Io_url Url() {return url;} public Io_fil Url_(Io_url v) {url = v; return this;} Io_url url;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_fil_mkr {
private final List_adp list = List_adp_.new_();
public Io_fil_mkr Add(String url, String data) {return Add(Io_url_.mem_fil_(url), data);}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_size_ {
public static String To_str(long val) {
long cur = val; int pow = 0;
@ -109,7 +109,7 @@ class Io_size_fmtr_arg implements Bry_fmtr_arg {
}
long div = (long)Math_.Pow((long)1024, (long)pow);
Decimal_adp val_decimal = Decimal_adp_.divide_(val, div);
bfr.Add_str(val_decimal.To_str("#,###.000")).Add_byte(Byte_ascii.Space).Add(gplx.ios.Io_size_.Units_bry[pow]);
bfr.Add_str_a7(val_decimal.To_str("#,###.000")).Add_byte(Byte_ascii.Space).Add(gplx.core.ios.Io_size_.Units_bry[pow]);
if (suffix != null)
bfr.Add(suffix);
}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import org.junit.*;
public class Io_size__tst {
private Io_size__fxt fxt = new Io_size__fxt();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_stream_ { // SERIALIZED
public static final byte Tid_null = 0, Tid_raw = 1, Tid_zip = 2, Tid_gzip = 3, Tid_bzip2 = 4;
public static final String Ext_zip = ".zip", Ext_gz = ".gz", Ext_bz2 = ".bz2";

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public interface Io_stream_rdr extends RlsAble {
byte Tid();
boolean Exists();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_stream_rdr_ {
public static Io_stream_rdr file_(Io_url url) {return new Io_stream_rdr_file().Url_(url);}
public static Io_stream_rdr file_(java.io.InputStream strm) {return new Io_stream_rdr_file().Under_(strm);}
@ -24,10 +24,10 @@ public class Io_stream_rdr_ {
public static Io_stream_rdr bzip2_(Io_url url) {return new Io_stream_rdr_bzip2().Url_(url);}
public static Io_stream_rdr new_by_url_(Io_url url) {
String ext = url.Ext();
if (String_.Eq(ext, Io_stream_.Ext_zip)) return gplx.ios.Io_stream_rdr_.zip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_gz)) return gplx.ios.Io_stream_rdr_.gzip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_bz2)) return gplx.ios.Io_stream_rdr_.bzip2_(url);
else return gplx.ios.Io_stream_rdr_.file_(url);
if (String_.Eq(ext, Io_stream_.Ext_zip)) return gplx.core.ios.Io_stream_rdr_.zip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_gz)) return gplx.core.ios.Io_stream_rdr_.gzip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_bz2)) return gplx.core.ios.Io_stream_rdr_.bzip2_(url);
else return gplx.core.ios.Io_stream_rdr_.file_(url);
}
public static Io_stream_rdr new_by_tid_(byte tid) {
switch (tid) {
@ -58,7 +58,7 @@ public class Io_stream_rdr_ {
byte[] bry = new byte[4096];
while (true) {
int read = rdr.Read(bry, 0, 4096);
if (read < gplx.ios.Io_stream_rdr_.Read_done_compare) break;
if (read < gplx.core.ios.Io_stream_rdr_.Read_done_compare) break;
rv.Add_mid(bry, 0, read);
}
} finally {rdr.Rls();}
@ -95,7 +95,7 @@ public class Io_stream_rdr_ {
bry_len = end - cur;
if (cur == end) break; // no more bytes needed; break; EX: 8 kb bry passed; 1st pass is 8kb; 2nd pass is 0 and cur == end
int read = stream.read(bry, cur, bry_len);
if (read == gplx.ios.Io_stream_rdr_.Read_done) // read done; end
if (read == gplx.core.ios.Io_stream_rdr_.Read_done) // read done; end
break;
rv += read;
cur += read;
@ -179,7 +179,7 @@ class Io_stream_rdr_file extends Io_stream_rdr_base {
if (!Io_mgr.Instance.Exists(url))
stream = Wrap_stream(new java.io.ByteArrayInputStream(Bry_.Empty));
else {
if (url.Info().EngineKey() == gplx.ios.IoEngine_.MemKey)
if (url.Info().EngineKey() == IoEngine_.MemKey)
stream = Wrap_stream(new java.io.ByteArrayInputStream(Io_mgr.Instance.LoadFilBry(url.Xto_api())));
else
stream = Wrap_stream(new java.io.FileInputStream(url.Xto_api()));
@ -210,9 +210,9 @@ class Io_stream_rdr_zip implements Io_stream_rdr {
try {
while (true){
int read = zip_stream.read(bry, bgn, len);
if (read == gplx.ios.Io_stream_rdr_.Read_done) {
if (read == Io_stream_rdr_.Read_done) {
if (zip_stream.getNextEntry() == null)
return gplx.ios.Io_stream_rdr_.Read_done;
return Io_stream_rdr_.Read_done;
}
else
return read;
@ -236,13 +236,13 @@ class Io_stream_rdr_gzip extends Io_stream_rdr_base {
int total_read = 0;
while (true) { // NOTE: the gz stream reads partially; (request 100; only get back 10); keep reading until entire bfr is full or -1
int read = stream.read(bry, bgn, len);
if (read == gplx.ios.Io_stream_rdr_.Read_done) break;
if (read == Io_stream_rdr_.Read_done) break;
total_read += read;
if (total_read >= len) break; // entire bfr full; stop
bgn += read; // increase bgn by amount read
len -= read; // decrease len by amount read
}
return total_read == 0 ? gplx.ios.Io_stream_rdr_.Read_done : total_read; // gzip seems to allow 0 bytes read (bz2 and zip return -1 instead); normalize return to -1;
return total_read == 0 ? Io_stream_rdr_.Read_done : total_read; // gzip seems to allow 0 bytes read (bz2 and zip return -1 instead); normalize return to -1;
}
catch (Exception e) {
throw Err_.new_exc(e, "io", "read failed", "bgn", bgn, "len", len);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
import org.junit.*;
public class Io_stream_rdr_tst {
@Before public void init() {fxt.Clear();} private Io_stream_rdr_fxt fxt = new Io_stream_rdr_fxt();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public interface Io_stream_wtr extends RlsAble {
byte Tid();
Io_url Url(); Io_stream_wtr Url_(Io_url v);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_stream_wtr_ {
public static Io_stream_wtr bzip2_(Io_url url) {return new Io_stream_wtr_bzip2().Url_(url);}
public static Io_stream_wtr gzip_(Io_url url) {return new Io_stream_wtr_gzip().Url_(url);}
@ -23,10 +23,10 @@ public class Io_stream_wtr_ {
public static Io_stream_wtr file_(Io_url url) {return new Io_stream_wtr_file().Url_(url);}
public static Io_stream_wtr new_by_url_(Io_url url) {
String ext = url.Ext();
if (String_.Eq(ext, Io_stream_.Ext_zip)) return gplx.ios.Io_stream_wtr_.zip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_gz)) return gplx.ios.Io_stream_wtr_.gzip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_bz2)) return gplx.ios.Io_stream_wtr_.bzip2_(url);
else return gplx.ios.Io_stream_wtr_.file_(url);
if (String_.Eq(ext, Io_stream_.Ext_zip)) return gplx.core.ios.Io_stream_wtr_.zip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_gz)) return gplx.core.ios.Io_stream_wtr_.gzip_(url);
else if (String_.Eq(ext, Io_stream_.Ext_bz2)) return gplx.core.ios.Io_stream_wtr_.bzip2_(url);
else return gplx.core.ios.Io_stream_wtr_.file_(url);
}
public static Io_stream_wtr new_by_mem(Bry_bfr bfr, byte tid) {
Io_stream_wtr wtr = new_by_tid_(tid).Url_(Io_url_.Empty);
@ -35,10 +35,10 @@ public class Io_stream_wtr_ {
}
public static Io_stream_wtr new_by_tid_(byte v) {
switch (v) {
case gplx.ios.Io_stream_.Tid_raw : return new Io_stream_wtr_file();
case gplx.ios.Io_stream_.Tid_zip : return new Io_stream_wtr_zip();
case gplx.ios.Io_stream_.Tid_gzip : return new Io_stream_wtr_gzip();
case gplx.ios.Io_stream_.Tid_bzip2 : return new Io_stream_wtr_bzip2();
case gplx.core.ios.Io_stream_.Tid_raw : return new Io_stream_wtr_file();
case gplx.core.ios.Io_stream_.Tid_zip : return new Io_stream_wtr_zip();
case gplx.core.ios.Io_stream_.Tid_gzip : return new Io_stream_wtr_gzip();
case gplx.core.ios.Io_stream_.Tid_bzip2 : return new Io_stream_wtr_bzip2();
default : throw Err_.new_unhandled(v);
}
}
@ -60,7 +60,7 @@ public class Io_stream_wtr_ {
download_progress.Bgn(rdr.Len());
while (true) {
int read = rdr.Read(bry, 0, 4096);
if (read < gplx.ios.Io_stream_rdr_.Read_done_compare) break;
if (read < gplx.core.ios.Io_stream_rdr_.Read_done_compare) break;
if (download_progress != Io_download_fmt.Null)
download_progress.Prog(read);
wtr.Write(bry, 0, read);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.ios; import gplx.*;
package gplx.core.ios; import gplx.*; import gplx.core.*;
public class Io_url_obj_ref {
public Io_url Val() {return val;} public Io_url_obj_ref Val_(Io_url v) {val = v; return this;} private Io_url val;
public String Val_as_str() {return val.Raw();}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_data {
public int Uid() {return uid;} int uid = uid_next++;
public Gfo_msg_itm Item() {return item;} Gfo_msg_itm item;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_grp implements Gfo_msg_obj {
public Gfo_msg_grp(Gfo_msg_grp owner, int uid, byte[] key) {
this.owner = owner; this.uid = uid; this.key = key; this.key_str = String_.new_a7(key);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_grp_ {
public static final Gfo_msg_grp Root_gplx = new Gfo_msg_grp(null, Gfo_msg_grp_.Uid_next(), Bry_.new_a7("gplx"));
public static final Gfo_msg_grp Root = new Gfo_msg_grp(null, Gfo_msg_grp_.Uid_next(), Bry_.Empty);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_itm implements Gfo_msg_obj {
public Gfo_msg_itm(Gfo_msg_grp owner, int uid, byte cmd, byte[] key_bry, byte[] fmt, boolean add_to_owner) {
this.owner = owner; this.uid = uid; this.cmd = cmd; this.key_bry = key_bry; this.fmt = fmt;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_itm_ {
public static final byte Cmd_null = 0, Cmd_log = 1, Cmd_note = 2, Cmd_warn = 3, Cmd_stop = 4, Cmd_fail = 5;
public static final byte[][] CmdBry = new byte[][] {Object_.Bry__null, Bry_.new_a7("log"), Bry_.new_a7("note"), Bry_.new_a7("warn"), Bry_.new_a7("stop"), Bry_.new_a7("fail")};

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_log {
public Gfo_msg_log(String root_key) {root = new Gfo_msg_root(root_key);} Gfo_msg_root root;
public int Ary_len() {return ary_idx;}

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public interface Gfo_msg_obj {
String Key_str();
Gfo_msg_obj Subs_get_by_key(String sub_key);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
public class Gfo_msg_root {
public Gfo_msg_root(String root_key) {
this.root_key = root_key;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.log_msgs; import gplx.*; import gplx.core.*;
import org.junit.*;
public class Gfo_msg_root_tst {
Gfo_msg_root_fxt fxt = new Gfo_msg_root_fxt();

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
package gplx.core.security; import gplx.*; import gplx.core.*;
import gplx.core.consoles.*;
import gplx.ios.*; /*IoStream*/
import gplx.core.ios.*; /*IoStream*/
public interface HashAlgo {
String Key();
String CalcHash(Console_adp dialog, IoStream stream);

@ -15,12 +15,12 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
package gplx.core.security; import gplx.*; import gplx.core.*;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import gplx.core.consoles.*;
import gplx.ios.*; /*IoStream*/import gplx.texts.*; /*Base32Converter*/
import gplx.core.ios.*; /*IoStream*/import gplx.core.texts.*; /*Base32Converter*/
public class HashAlgo_ {
public static final HashAlgo Null = new HashAlgo_null();
public static final HashAlgo Sha1 = HashAlgo_sha1.new_();
@ -41,18 +41,18 @@ public class HashAlgo_ {
}
class HashAlgo_null implements HashAlgo {
public String Key() {return "HashAlgo_null";}
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, gplx.ios.IoStream_.ary_(v)));}
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, gplx.core.ios.IoStream_.ary_(v)));}
public String CalcHash(Console_adp dialog, IoStream stream) {return "NullAlgoHash";}
}
class HashAlgo_md5 implements HashAlgo {
public String Key() {return KEY;} public static final String KEY = "md5";
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, gplx.ios.IoStream_.ary_(v)));}
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, IoStream_.ary_(v)));}
public String CalcHash(Console_adp dialog, IoStream stream) {return HashAlgoUtl.CalcHashAsString(dialog, stream, "MD5");}
public static HashAlgo_md5 new_() {return new HashAlgo_md5();} HashAlgo_md5() {}
}
class HashAlgo_sha1 implements HashAlgo {
public String Key() {return KEY;} public static final String KEY = "sha1";
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, gplx.ios.IoStream_.ary_(v)));}
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, IoStream_.ary_(v)));}
public String CalcHash(Console_adp dialog, IoStream stream) {return HashAlgoUtl.CalcHashAsString(dialog, stream, "SHA1");}
public static HashAlgo_sha1 new_() {return new HashAlgo_sha1();} HashAlgo_sha1() {}
}

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
package gplx.core.security; import gplx.*; import gplx.core.*;
import org.junit.*;
import gplx.core.consoles.*; import gplx.ios.*; /*IoStream*/
import gplx.core.consoles.*; import gplx.core.ios.*; /*IoStream*/
public class HashAlgo_md5_tst {
@Test public void Empty() {
tst_CalcBase16FromString("", "d41d8cd98f00b204e9800998ecf8427e");

@ -15,9 +15,9 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
package gplx.core.security; import gplx.*; import gplx.core.*;
import org.junit.*;
import gplx.core.consoles.*; import gplx.ios.*; /*IoStream*/
import gplx.core.consoles.*; import gplx.core.ios.*; /*IoStream*/
public class HashAlgo_sha1_tst {
@Test public void Empty() {
tst_CalcBase16FromString("", "da39a3ee5e6b4b0d3255bfef95601890afd80709");

@ -15,13 +15,13 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
package gplx.core.security; import gplx.*; import gplx.core.*;
import gplx.core.consoles.*;
import gplx.ios.*; /*IoStream*/
import gplx.core.ios.*; /*IoStream*/
public class HashAlgo_tth192 implements HashAlgo {
public String Key() {return KEY;} public static final String KEY = "tth192";
public int BlockSize() {return blockSize;} public void BlockSize_set(int v) {blockSize = v;} int blockSize = 1024;
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, gplx.ios.IoStream_.ary_(v)));}
public byte[] Calc_hash_bry(byte[] v) {return Bry_.new_a7(CalcHash(Console_adp_.Noop, gplx.core.ios.IoStream_.ary_(v)));}
public String CalcHash(Console_adp dialog, IoStream stream) {
int leafCount = (int)(stream.Len() / blockSize);
HashDlgWtr dialogWtr = HashDlgWtr_.Current;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
package gplx.core.security; import gplx.*; import gplx.core.*;
import org.junit.*;
public class HashAlgo_tth192_tree_tst {
@Test public void CalcRecursiveHalves() {

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
import org.junit.*; import gplx.core.consoles.*; import gplx.ios.*; /*IoStream*/
package gplx.core.security; import gplx.*; import gplx.core.*;
import org.junit.*; import gplx.core.consoles.*; import gplx.core.ios.*; /*IoStream*/
public class HashAlgo_tth192_tst {
@Test public void Char0000() {tst_CalcBase32FromString("", "LWPNACQDBZRYXW3VHJVCJ64QBZNGHOHHHZWCLNQ");}
@Test public void Char0001() {tst_CalcBase32FromString("\0", "VK54ZIEEVTWNAUI5D5RDFIL37LX2IQNSTAXFKSA");}

@ -15,8 +15,8 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.security; import gplx.*;
import org.junit.*; import gplx.core.consoles.*; import gplx.ios.*; /*IoStream*/
package gplx.core.security; import gplx.*; import gplx.core.*;
import org.junit.*; import gplx.core.consoles.*; import gplx.core.ios.*; /*IoStream*/
public class HashDlgWtr_tst {
@Before public void setup() {
HashAlgo_tth192 algo = HashAlgo_tth192.new_();

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx;
package gplx.core.tests; import gplx.*; import gplx.core.*;
import gplx.core.strings.*;
public class PerfLogMgr_fxt {
public void Init(Io_url url, String text) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
public class Base32Converter {
public static String EncodeString(String orig) {return Encode(Bry_.new_u8(orig));}
public static String Encode(byte[] raw) {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
public class Base64Converter {
private final static char[] ALPHABET = String_.XtoCharAry("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
private static int[] toInt = null;//new int[128];

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
import org.junit.*;
public class BaseXXConverter_tst {
@Test public void Base32() {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
public class CharStream {
public char[] Ary() {return ary;} char[] ary;
public int Len() {return len;} int len;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
import org.junit.*;
public class CharStream_tst {
@Before public void setup() {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
public class HexDecUtl {
public static int parse_or(String raw, int or) {
int rv = 0; int digit; int factor = 1, rawLen = String_.Len(raw);

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
import org.junit.*;
public class HexDecUtl_tst {
@Test public void XtoInt() {

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
import gplx.langs.regxs.*;
public class RegxPatn_cls_ioMatch {
public String Raw() {return raw;} private String raw;

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
import gplx.core.strings.*; import gplx.langs.regxs.*;
public class RegxPatn_cls_ioMatch_ {
public static final String Wildcard = "*";

@ -15,7 +15,7 @@ GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package gplx.texts; import gplx.*;
package gplx.core.texts; import gplx.*; import gplx.core.*;
import org.junit.*;
public class RegxPatn_cls_ioMatch_tst {
@Test public void SimpleMatches() {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save