📄 env.java
字号:
package demo.smpp34demo ;
import java.io.IOException ;
import com.huawei.smproxy.util.Cfg ;
import com.huawei.smproxy.util.Debug ;
import com.huawei.smproxy.util.Resource ;
/**
* A iuniform external interface for parsing the configuration file and resource file.
*/
public class Env
{
/**
* Cfg class is used for reading and writting the configuration file.
*/
static Cfg config ;
/**
* Resource class is used for reading and writting the resource file in smpp package.
*/
static Resource resource ;
/**
* Gets a instance of Cfg class contained the connection infomation.
* @return Cfg
*/
public static Cfg getConfig ()
{
if ( config == null )
{// Not be initialized.
try
{
config = new Cfg ( "config.xml" ) ;
}
catch ( IOException ex )
{
Debug.dump (
"reading config file error,pealse make sure the config.xml"
+ " is in the correct path !" ) ;
}
}
return config ;
}
/**
* Gets a instance of Resource class.
* The resource file 'resource' is used by english users.
* The resource file 'resource_zh' is used by chinese users.
* @return Resource
*/
public static Resource getResource ()
{
if ( resource == null )
{
try
{
resource = new Resource ( "resource" ) ;
}
catch ( IOException ex )
{
Debug.dump (
"reading resource file error,pealse make sure the resource(resource_en).xml"
+ " is in the correct path !" ) ;
}
}
return resource ;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -