本文整理汇总了Java中android.net.Uri.getUserInfo方法的典型用法代码示例。如果您正苦于以下问题:Java Uri.getUserInfo方法的具体用法?Java Uri.getUserInfo怎么用?Java Uri.getUserInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.net.Uri
的用法示例。
在下文中一共展示了Uri.getUserInfo方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parse
import android.net.Uri; //导入方法依赖的package包/类
public static ShadowsocksConfig parse(String proxyInfo) throws Exception{
ShadowsocksConfig config=new ShadowsocksConfig();
Uri uri=Uri.parse(proxyInfo);
if(uri.getPort()==-1){
String base64String=uri.getHost();
proxyInfo="ss://"+ new String(Base64.decode(base64String.getBytes("ASCII"),Base64.DEFAULT));
uri=Uri.parse(proxyInfo);
}
String userInfoString=uri.getUserInfo();
if(userInfoString!=null){
String[] userStrings=userInfoString.split(":");
config.EncryptMethod=userStrings[0];
if(userStrings.length>=2){
config.Password=userStrings[1];
}
}
config.ServerAddress=new InetSocketAddress(uri.getHost(), uri.getPort());
config.Encryptor=EncryptorFactory.createEncryptorByConfig(config);
return config;
}
示例2: parse
import android.net.Uri; //导入方法依赖的package包/类
public static ShadowsocksConfig parse(String proxyInfo) throws Exception {
ShadowsocksConfig config = new ShadowsocksConfig();
Uri uri = Uri.parse(proxyInfo);
if (uri.getPort() == -1) {
String base64String = uri.getHost();
proxyInfo = "ss://" + new String(Base64.decode(base64String.getBytes("ASCII"), Base64.DEFAULT));
uri = Uri.parse(proxyInfo);
}
String userInfoString = uri.getUserInfo();
if (userInfoString != null) {
String[] userStrings = userInfoString.split(":");
config.EncryptMethod = userStrings[0];
if (userStrings.length >= 2) {
config.Password = userStrings[1];
}
}
if (!CryptFactory.isCipherExisted(config.EncryptMethod)) {
throw new Exception(String.format("Method: %s does not support", config.EncryptMethod));
}
config.ServerAddress = new InetSocketAddress(uri.getHost(), uri.getPort());
return config;
}
示例3: parse
import android.net.Uri; //导入方法依赖的package包/类
public static HttpConnectConfig parse(String proxyInfo){
HttpConnectConfig config=new HttpConnectConfig();
Uri uri=Uri.parse(proxyInfo);
String userInfoString=uri.getUserInfo();
if(userInfoString!=null){
String[] userStrings=userInfoString.split(":");
config.UserName=userStrings[0];
if(userStrings.length>=2){
config.Password=userStrings[1];
}
}
config.ServerAddress=new InetSocketAddress(uri.getHost(), uri.getPort());
return config;
}
示例4: parse
import android.net.Uri; //导入方法依赖的package包/类
public static HttpConnectConfig parse(String proxyInfo) {
HttpConnectConfig config = new HttpConnectConfig();
Uri uri = Uri.parse(proxyInfo);
String userInfoString = uri.getUserInfo();
if (userInfoString != null) {
String[] userStrings = userInfoString.split(":");
config.UserName = userStrings[0];
if (userStrings.length >= 2) {
config.Password = userStrings[1];
}
}
config.ServerAddress = new InetSocketAddress(uri.getHost(), uri.getPort());
return config;
}