Get System Info
来源:互联网 发布:相片mv制作软件 编辑:程序博客网 时间:2024/05/01 03:13
Ch15 系统程序设计
1 System
1.1 I/O流
 public static InputStream in: 读取字符的标准输入流。
 public static PrintStream out: 标准输出流。
 public static PrintStream err: 标准错误输出流。
1.2 系统属性
(1) 属性
 java.version 版本号 java.vendor销售商
 java.vendor.url java.home安装目录
 java.class.version类版本 java.class.path类路径
 os.name os.arch支持的体系结构
 os.version file.separator
 path.separator line.separator 行分隔符
 user.name user.home home目录
 user.dir 用户当前目录
(2) 方法
 public static Properties getProperties(): 取系统属性。如果当前系统属性集不存在,则创建并初始化。
 public static void setProperties(Properties props)
 public static String getProperty(String key)
返回名为key的属性值。等效于System.getProperties().getProperty(key);
 public static String getProperty(String key,String defaultValue)
返回名为key的属性值。若没定义则返回defaultValue。它等效于System.getProperties().getProperty(key,def);
(3) 属性值的解码 属性值转换成数值(对象)
 static boolean Boolean.getBoolean(String name)
name为”true”(不区分大小写)时, 返回true,否则false
 static Integer Integer.getInteger(String name)
如果没有数字形式,返回null。
 static Integer Integer.getInteger(String name,Integer def): 如果没有数字形式,返回缺省值def
 static Long Long.getLong(String nm)
 static Long Long.getLong(String nm,Long def)
(4) Eample
public static File personal(String fileName){
String home = System.getProperty( "user.home ");
if (home == null) return null;
else return new File(home,fileName);
}
StringBuffer props = new StringBuffer();
props.append( "\nOS Name: ");
props.append(System.getProperty( "os.name "));
props.append( "\nOS Version: ");
props.append(System.getProperty( "os.version "));
props.append( "\nOS Architecture: ");
props.append(System.getProperty( "os.arch "));
props.append( "\nJVM Version: ");
props.append(System.getProperty( "java.runtime.version "));
props.append( "\nJVM Vendor: ");
props.append(System.getProperty( "java.vm.vendor "));
System.out.println(props.toString());
1 System
1.1 I/O流
 public static InputStream in: 读取字符的标准输入流。
 public static PrintStream out: 标准输出流。
 public static PrintStream err: 标准错误输出流。
1.2 系统属性
(1) 属性
 java.version 版本号 java.vendor销售商
 java.vendor.url java.home安装目录
 java.class.version类版本 java.class.path类路径
 os.name os.arch支持的体系结构
 os.version file.separator
 path.separator line.separator 行分隔符
 user.name user.home home目录
 user.dir 用户当前目录
(2) 方法
 public static Properties getProperties(): 取系统属性。如果当前系统属性集不存在,则创建并初始化。
 public static void setProperties(Properties props)
 public static String getProperty(String key)
返回名为key的属性值。等效于System.getProperties().getProperty(key);
 public static String getProperty(String key,String defaultValue)
返回名为key的属性值。若没定义则返回defaultValue。它等效于System.getProperties().getProperty(key,def);
(3) 属性值的解码 属性值转换成数值(对象)
 static boolean Boolean.getBoolean(String name)
name为”true”(不区分大小写)时, 返回true,否则false
 static Integer Integer.getInteger(String name)
如果没有数字形式,返回null。
 static Integer Integer.getInteger(String name,Integer def): 如果没有数字形式,返回缺省值def
 static Long Long.getLong(String nm)
 static Long Long.getLong(String nm,Long def)
(4) Eample
public static File personal(String fileName){
String home = System.getProperty( "user.home ");
if (home == null) return null;
else return new File(home,fileName);
}
StringBuffer props = new StringBuffer();
props.append( "\nOS Name: ");
props.append(System.getProperty( "os.name "));
props.append( "\nOS Version: ");
props.append(System.getProperty( "os.version "));
props.append( "\nOS Architecture: ");
props.append(System.getProperty( "os.arch "));
props.append( "\nJVM Version: ");
props.append(System.getProperty( "java.runtime.version "));
props.append( "\nJVM Vendor: ");
props.append(System.getProperty( "java.vm.vendor "));
System.out.println(props.toString());
- Get System Info
- How To Get System Info In Linux
- [PHP]How to get the system info?
- How to get operating system info in .NET
- how to get detail system info on MAC?
- How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)
- windows system info
- System Data & Info
- adb system cpu info
- dump system info
- vc GET OS INFO
- 显示系统信息(System Info)
- GNU Info System 使用笔记
- Check system info on Linux
- Check system info on Solaris
- How to get battery info
- Android MAKEFILE System (1) -- BUILD VERSION INFO
- system info & cpu core id & thread active
- 1 根文件系统 简单来说,(根文件系统)
- Google搜索从入门到精通(1)
- linux内存磁盘初始化技术
- sql 同步表结构 dll 触发器
- 电影PI/死亡密码
- Get System Info
- Google搜索从入门到精通(2)
- Google搜索从入门到精通(3)
- Google搜索从入门到精通(4)
- ora-00333
- DBConnectTest.java
- 程序江湖:第一章 少年不识愁滋味
- linux底层内存管理--用户空间的分级分配系统以及懒惰的含义
- linux 配置ip