xlang v4.0 Release
程序设计语言基础库文档
载入中...
搜索中...
未找到
System.xcs
浏览该文件的文档.
1
5@Declare
6class _system_{
10 public static long currentTimeMillis();
11
15 public static void exit();
16
20 public static void gc();
21
32 public static void arrayCopy(Object[] src,long srcpos, Object[] dst,long dstpos, long length);
33
40 public static long openFile(String filepath,String mode);
41
49 public static bool closeFile(long handle);
50
58 public static long fileLength(long handle);
59
66 public static long getFileSize(String filepath);
67
68
79 public static long readFile(long handle, byte[] buffer,long offset, long length);
80
81
92 public static long writeFile(long handle, byte[] buffer,long offset, long length);
93
100 public static bool deleteFile(String filepath);
101
108 public static bool fileExists(String filepath);
109
110
115 public static void sleep(long milliSecond);
116
120 public static void createConsole();
121
128 public static long consoleWrite(String text);
129
138 public static long consoleRead(byte[] buffer,long offset, long length);
139
143 public static String getAppPath();
144
148 public static String getAppDirector();
149
153 public static String getWorkDirector();
154
155
159 public static bool mkdir(String path);
160
161
165 public static bool rmdir(String path);
166
167
171 public static bool rename(String oldname, String newname);
172
173
184 public static int getPlatformId();
185
186
197 public static int getArchId();
198
203 public static int getOSBit();
204
205
210 public static String getDefaultEncoding();
211
212
217 public static long createPipe(String name, bool forOpen);
218
224 public static bool openPipe(long pipe, bool forRead);
225
230 public static bool closePipe(long pipe);
231
240 public static long readPipe(long pipe, byte [] buffer, long offset, long length);
241
242
251 public static long writePipe(long pipe, byte [] buffer, long offset, long length);
252
256 public static bool setupLogSource(String eventName);
257
261 public static bool chmod(String path, int mode);
262
267 public static bool registryCrashHandler(ICrashHandler handle);
268
272 public static long getAppVersion();
273
277 public static long getAppTimestamp();
278
282 public static bool chdir(String path);
283
287 public static String getHostName();
288
306 public static bool registrySystemSignalHandler(int signal, ISystemSignalHandler handler, bool add);
307
313 public static int loadLibrary(String path);
314
319 public static String getModulePath(int id);
320
326 public static int getModuleId(String path);
327
332 public static int[] getAllModules();
333
334
339 public static int serviceRun();
340
344 public static bool isServiceInstalled(String serviceName);
345
354 public static bool installService(String apppath,String serviceName, String displayName, String description);
355
359 public static bool uninstallService(String serviceName);
360
367 public static int getFileMode(String filepath);
368
374 public static bool setMinorGCThreshold(double fThreshold);
375
382 public static void setObjectNonFinalize(Object object);
383
388 public static int getchar();
389
397 public static void stdflush(int stdno);
398
399
406 public static long consoleWriteError(String text);
407
418 public static long consoleReadMask(byte[] buffer,long offset, long length, char cMask);
419
428 public static bool setEnvironmentVariable(String name, String value, bool append, bool atFront);
429
436
442 public static bool disableIncrementalGC(bool disable);
446 public static const int STDIN_NO = 0;
447 public static const int STDOUT_NO = 1;
448 public static const int STDERR_NO = 2;
449
453 public static const int LOG_LEV_EMERG = 0;
454 public static const int LOG_LEV_ALERT = 1;
455 public static const int LOG_LEV_CRIT = 2;
456 public static const int LOG_LEV_ERR = 3;
457 public static const int LOG_LEV_WARNING = 4;
458 public static const int LOG_LEV_NOTICE = 5;
459 public static const int LOG_LEV_DEBUG = 6;
460
464 public static const int PLATFORM_UNKNOW = -1;
465 public static const int PLATFORM_WINDOWS = 0;
466 public static const int PLATFORM_LINUX = 1;
467 public static const int PLATFORM_MACOSX = 2;
468 public static const int PLATFORM_IOS = 3;
469 public static const int PLATFORM_IOS_SIMULATOR = 4;
470 public static const int PLATFORM_UNIX = 5;
471 public static const int PLATFORM_POSIX = 6;
472
476 public static const int ARCH_UNKNOW = -1;
477 public static const int ARCH_X86 = 1;
478 public static const int ARCH_X64 = 2;
479 public static const int ARCH_ARM = 3;
480 public static const int ARCH_ARM64 = 4;
481 public static const int ARCH_MIPS = 5;
482 public static const int ARCH_MIPS64 = 6;
483
487 public static const int SIGINT = 1; //CTRL+C
488 public static const int SIGTSTP = 2; //CTRL+Z
489 public static const int SIGCONT = 3; //fg
490 public static const int SIGTERM = 4; //kill
491 public static const int SIGPWR = 5;
492
496 public static const int SIGNAL_UNINTERESTED = 0; //不感兴趣, 由系统按照默认方式处理
497 public static const int SIGNAL_SPREAD = 0; //继续向后传播
498 public static const int SIGNAL_ABORT = 1; //终止传播
499 public static const int SIGNAL_DISCARD = 2; //丢弃信号(忽略)
500
501 public static const int S_IFMT = 00170000; //
502 public static const int S_IFSOCK = 0140000; //
503 public static const int S_IFLNK = 0120000; //
504 public static const int S_IFREG = 0100000; //
505 public static const int S_IFBLK = 0060000; //
506 public static const int S_IFDIR = 0040000; //
507 public static const int S_IFCHR = 0020000; //
508 public static const int S_IFIFO = 0010000; //
509 public static const int S_ISUID = 0004000; //
510 public static const int S_ISGID = 0002000; //
511 public static const int S_ISVTX = 0001000; //
512 public static const int S_IRWXU = 00700; //
513 public static const int S_IRUSR = 00400; //
514 public static const int S_IWUSR = 00200; //
515 public static const int S_IXUSR = 00100; //
516 public static const int S_IRWXG = 00070; //
517 public static const int S_IRGRP = 00040; //
518 public static const int S_IWGRP = 00020; //
519 public static const int S_IXGRP = 00010; //
520 public static const int S_IRWXO = 00007; //
521 public static const int S_IROTH = 00004; //
522 public static const int S_IWOTH = 00002; //
523 public static const int S_IXOTH = 00001; //
524
525};
系统和IO相关
static long consoleWrite(String text)
向控制台环境中写入文本
static long writePipe(long pipe, byte [] buffer, long offset, long length)
向管道中写入数据
static const int SIGINT
信号
static long writeFile(long handle, byte[] buffer,long offset, long length)
向文件中写入数据
static long consoleReadMask(byte[] buffer,long offset, long length, char cMask)
从控制台环境中读取数据并设置掩码
static int loadLibrary(String path)
加载slx动态库
static const int SIGCONT
static const int SIGNAL_DISCARD
static const int SIGNAL_ABORT
static void sleep(long milliSecond)
使线程进入休眠
static long createPipe(String name, bool forOpen)
创建一个管道
static const int LOG_LEV_CRIT
static const int ARCH_ARM
static const int LOG_LEV_EMERG
logcat 信息级别
static const int S_IWOTH
static bool closePipe(long pipe)
关闭管道
static long consoleWriteError(String text)
向控制台STDERR流中写入文本
static const int S_IFMT
static bool installService(String apppath,String serviceName, String displayName, String description)
检查服务是否已安装
static const int PLATFORM_IOS
static const int S_IWGRP
static bool deleteFile(String filepath)
删除一个本地文件
static bool fileExists(String filepath)
测试一个本地文件是否存在
static const int S_IXOTH
static void gc()
手动垃圾回收,一般不建议使用
static const int S_IFIFO
static const int SIGNAL_SPREAD
static bool disableIncrementalGC(bool disable)
禁用增量GC[注意此功能暂未开放]
static long getFileSize(String filepath)
获取一个文件的长度
static long getAppVersion()
获取App版本, 该版本由.version文件定义, 返回值为一个64位的long, 每两个字节为一个版本的值
static const int S_IFDIR
static const int ARCH_X64
static const int S_IRWXU
static const int S_IRWXG
static const int SIGTSTP
static long getAppTimestamp()
获取App组建时间 毫秒数
static bool uninstallService(String serviceName)
卸载服务
static const int S_IROTH
static const int S_IWUSR
static int [] getAllModules()
获取所有已加载的slx动态库的id
static const int PLATFORM_IOS_SIMULATOR
static String getAppDirector()
获取程序所在文件夹
static bool isServiceInstalled(String serviceName)
检查服务是否已安装
static const int SIGNAL_UNINTERESTED
信号处理接口返回值
static const int ARCH_MIPS
static long consoleRead(byte[] buffer,long offset, long length)
从控制台环境中读取数据
static const int S_IRUSR
static const int LOG_LEV_WARNING
static const int SIGPWR
static int getchar()
从控制台获取一个输入字符
static const int PLATFORM_POSIX
static bool chmod(String path, int mode)
改变文件权限
static const int PLATFORM_WINDOWS
static int getOSBit()
获取操作系统位数
static void createConsole()
创建控制台环境
static long readFile(long handle, byte[] buffer,long offset, long length)
读取文件数据
static void setObjectNonFinalize(Object object)
设置对象Finalize开关, 调用此函数以后 对象的finalize将被禁止
static bool openPipe(long pipe, bool forRead)
打开一个管道
static const int S_IFSOCK
static const int PLATFORM_UNIX
static const int STDIN_NO
标准输入输出流
static const int S_ISUID
static int getPlatformId()
获取平台操作系统ID 0 WINDOWS 1 LINUX 2 MAC OSX 3 iPhone 模拟器 4 iPhone 5 unix 6 其他poxis环境
static int getFileMode(String filepath)
获取文件属性
static String getAppPath()
获取程序的路径
static long fileLength(long handle)
获取一个已打开的文件的长度
static bool registrySystemSignalHandler(int signal, ISystemSignalHandler handler, bool add)
添加信号处理回调, 该方法可以添加多个信号处理接口,当有信号时按照添加的顺序进行调用,若前面的接口返回SIGNAL_ABORT 则后添加的接口得不到处理机会
static const int ARCH_MIPS64
static long currentTimeMillis()
获取当前毫秒数
static const int PLATFORM_LINUX
static int serviceRun()
服务主线程循环
static bool setupLogSource(String eventName)
设置日志事件源 windows下有效
static bool registryCrashHandler(ICrashHandler handle)
添加一个程序crash的回调接口, 当程序发生异常或者没有catch的Exception时 将调用此接口
static String getDefaultEncoding()
获取操作系统默认字符集
static const int STDOUT_NO
static bool mkdir(String path)
创建文件夹
static int getModuleId(String path)
获取已加载的slx动态库的id
static const int S_IFREG
static String getEnvironmentVariable(String name)
获取环境变量
static void stdflush(int stdno)
刷新控制台数据流
static String getModulePath(int id)
获取slx动态库的路径
static const int S_ISGID
static void exit()
程序退出
static bool rename(String oldname, String newname)
重命名文件或者文件夹
static bool chdir(String path)
改变当前路径
static long readPipe(long pipe, byte [] buffer, long offset, long length)
从管道中读取数据
static String getWorkDirector()
获取程序当前工作目录
static const int S_IFBLK
static const int PLATFORM_MACOSX
static const int ARCH_X86
static const int S_IXUSR
static const int S_IFCHR
static const int LOG_LEV_DEBUG
static String getHostName()
获取本机名称
static const int LOG_LEV_ERR
static const int SIGTERM
static void arrayCopy(Object[] src,long srcpos, Object[] dst,long dstpos, long length)
复制数组对象内容,要求类型匹配
static bool closeFile(long handle)
关闭一个已打开的文件
static bool setMinorGCThreshold(double fThreshold)
设置GC阈值
static const int S_IFLNK
static const int ARCH_ARM64
static const int S_IXGRP
static const int LOG_LEV_NOTICE
static const int S_IRWXO
static const int ARCH_UNKNOW
处理器架构
static const int S_ISVTX
static const int STDERR_NO
static const int S_IRGRP
static bool setEnvironmentVariable(String name, String value, bool append, bool atFront)
设置环境变量
static const int PLATFORM_UNKNOW
操作系统
static int getArchId()
获取平台架构 1 X86 2 X86_64 3 ARM 4 ARM64 5 MIPS 6 MIPS64 7 UNKNOW
static bool rmdir(String path)
删除文件夹
static const int LOG_LEV_ALERT
static long openFile(String filepath,String mode)
打开文件
App 崩溃处理接口
App 操作系统信号处理接口
字符串类