System.getProperty标准参数例表

The various J2ME JSR documents define system property names that can be queried at runtime. These provide two services:

To indicate the availability of an optional package:

For example, if the device supports the Location API for J2ME then the property microedition.location.version will be present. The value associated with it will be "1.0", to indicate compliance with JSR 179.


To provide platform-dependent configuration data

For instance, the property microedition.commports is present in the MIDP 2.0 specification. Its value is a comma-separated list of ports you can use to build a URL, which the Generic Connection Framework can in turn use to create a javax.microedition.io.CommConnection object.
To query system properties use java.lang.System.getProperty(), as in:

        import        java.lang.*;

        String        value;
        String        key        = "microedition.pim.version";

        value        = System.getProperty( key );
        ...



This table lists the defined system properties, drawing them from JSRs that are in the public review, final ballot, or final state, as defined in the Java Community Process (JCP):

J2ME Defined System Properties

JSR Property Name
Default Value¹
30 microedition.platform null
  microedition.encoding ISO8859_1
  microedition.configuration CLDC-1.0
  microedition.profiles null
37 microedition.locale null
  microedition.profiles MIDP-1.0
75 microedition.io.file.FileConnection.version 1.0
  file.separator (impl-dep)
  microedition.pim.version 1.0
118 microedition.locale null
  microedition.profiles MIDP-2.0
  microedition.commports (impl-dep)
  microedition.hostname (impl-dep)
120 wireless.messaging.sms.smsc (impl-dep)
139 microedition.platform (impl-dep)
  microedition.encoding ISO8859-1
  microedition.configuration CLDC-1.1
  microedition.profiles (impl-dep)
177 microedition.smartcardslots (impl-dep)
179 microedition.location.version 1.0
180 microedition.sip.version 1.0
184 microedition.m3g.version 1.0
185 microedition.jtwi.version 1.0
195 microedition.locale (impl-dep)
  microedition.profiles IMP-1.0
205 wireless.messaging.sms.smsc (impl-dep)
205 wireless.messaging.mms.mmsc (impl-dep)
211 CHAPI-Version 1.0 
  

 

以上是英文版的解释,以下是另外中文的总结。

J2ME规范包括了许多可选包,如支持多媒体功能的MMAPI,支持消息接收和发送的WMA,支持3D游戏的M3G API。如果某一款手机支持某个可选API,MIDP应用程序就可以使用它。但是,让用户回答“本机是否支持MMAPI”是不友好的,发布几个不同版本不但增加了开发的工作量,也让用户难以选择。因此,应用程序应该自己检测手机是否支持某一API,从而在运行期决定是否可以使用此API。

MIDP 1.0和2.0应用程序都可以通过System.getProperty(String key)检测某一个属性的信息。如果该属性有效,将返回对应的字符串,否则,返回null,表示系统不支持此功能。

例如,System.getProperty("microedition.profiles")可能的返回值是"MIDP-1.0"或"MIDP-2.0"。

以下是常见的系统属性和可选API的属性,右侧列出了可能的返回值:

 

系统信息

 

 

 

 

 

 

 

 

microedition.platform

 

 

 

 

平台名称,如j2me

 

 

 

 

microedition.configuration

 

 

 

 

CLDCCDC版本,如CLDC-1.0

 

 

 

 

microedition.profiles

 

 

 

 

MIDP版本,如MIDP-1.0

 

 

 

 

microedition.encoding

 

 

 

 

默认的系统编码,如GBK

 

 

 

 

microedition.locale

 

 

 

 

默认的区域设置,如zh-CN

 

 

 

 

MMAPI相关

 

 

 

 

 

 

 

 

microedition.media.version

 

 

 

 

MMAPI的版本,如1.1

 

 

 

 

supports.mixing

 

 

 

 

是否支持混音,如true

 

 

 

 

supports.audio.capture

 

 

 

 

是否支持音频捕获,如true

 

 

 

 

supports.video.capture

 

 

 

 

是否支持视频捕获,如true

 

 

 

 

supports.recording

 

 

 

 

是否支持录音,如true

 

 

 

 

audio.encodings

 

 

 

 

音频编码格式,如encoding=pcm encoding=pcm&rate=8000&bits=8&channels=1

 

 

 

 

video.snapshot.encodings

 

 

 

 

拍摄图片的编码格式,如encoding=jpeg encoding=png

 

 

 

 

streamable.contents

 

 

 

 

支持的流媒体格式,如audio/x-wav

 

 

 

 

WMA相关

 

 

 

 

 

 

 

 

wireless.messaging.sms.smsc

 

 

 

 

返回SMS的服务中心,如+8613800010000

 

 

 

 

wireless.messaging.mms.mmsc

 

 

 

 

返回MMS的服务中心,如http://mmsc.monternet.com

 

 

 

 

其他

 

 

 

 

 

 

 

 

microedition.m3g.version

 

 

 

 

返回Mobile 3D的版本,如1.0

 

 

 

 

bluetooth.api.version

 

 

 

 

返回蓝牙API的版本,如1.0

 

 

 

 

microedition.io.file.FileConnection.version

 

 

 

 

返回FileConnection的版本,如1.0

 

 

 

 

microedition.pim.version

 

 

 

 

返回PIM的版本,如1.0

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值