当前位置: 首页>>代码示例>>Java>>正文


Java Uri.decode方法代码示例

本文整理汇总了Java中android.net.Uri.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Uri.decode方法的具体用法?Java Uri.decode怎么用?Java Uri.decode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.net.Uri的用法示例。


在下文中一共展示了Uri.decode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getFileForUri

import android.net.Uri; //导入方法依赖的package包/类
public File getFileForUri(Uri uri) {
    String path = uri.getEncodedPath();
    int splitIndex = path.indexOf(47, 1);
    String tag = Uri.decode(path.substring(1, splitIndex));
    path = Uri.decode(path.substring(splitIndex + 1));
    File root = (File) this.mRoots.get(tag);
    if (root == null) {
        throw new IllegalArgumentException("Unable to find configured root for " + uri);
    }
    File file = new File(root, path);
    try {
        file = file.getCanonicalFile();
        if (file.getPath().startsWith(root.getPath())) {
            return file;
        }
        throw new SecurityException("Resolved path jumped beyond configured root");
    } catch (IOException e) {
        throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:21,代码来源:FileProvider.java

示例2: getFileForUri

import android.net.Uri; //导入方法依赖的package包/类
@Override
public File getFileForUri(Uri uri) {
    String path = uri.getEncodedPath();

    final int splitIndex = path.indexOf('/', 1);
    final String tag = Uri.decode(path.substring(1, splitIndex));
    path = Uri.decode(path.substring(splitIndex + 1));

    final File root = mRoots.get(tag);
    if (root == null) {
        throw new IllegalArgumentException("Unable to find configured root for " + uri);
    }

    File file = new File(root, path);
    try {
        file = file.getCanonicalFile();
    } catch (IOException e) {
        throw new IllegalArgumentException("Failed to resolve canonical path for " + file);
    }

    if (!file.getPath().startsWith(root.getPath())) {
        throw new SecurityException("Resolved path jumped beyond configured root");
    }

    return file;
}
 
开发者ID:roshakorost,项目名称:Phial,代码行数:27,代码来源:FileProvider.java

示例3: parse

import android.net.Uri; //导入方法依赖的package包/类
public static MailTo parse(Uri uri) throws NullPointerException, IllegalArgumentException {
    if (uri == null || uri.toString() == null) {
        throw new NullPointerException("Argument 'uri' must not be null");
    }

    if (!isMailTo(uri)) {
        throw new IllegalArgumentException("Not a mailto scheme");
    }

    String schemaSpecific = uri.getSchemeSpecificPart();
    int end = schemaSpecific.indexOf('?');
    if (end == -1) {
        end = schemaSpecific.length();
    }

    CaseInsensitiveParamWrapper params =
            new CaseInsensitiveParamWrapper(Uri.parse("foo://bar?" + uri.getEncodedQuery()));

    // Extract the recipient's email address from the mailto URI if there's one.
    String recipient = Uri.decode(schemaSpecific.substring(0, end));

    List<String> toList = params.getQueryParameters(TO);
    if (recipient.length() != 0) {
        toList.add(0, recipient);
    }

    List<String> ccList = params.getQueryParameters(CC);
    List<String> bccList = params.getQueryParameters(BCC);

    Address[] toAddresses = toAddressArray(toList);
    Address[] ccAddresses = toAddressArray(ccList);
    Address[] bccAddresses = toAddressArray(bccList);

    String subject = getFirstParameterValue(params, SUBJECT);
    String body = getFirstParameterValue(params, BODY);

    return new MailTo(toAddresses, ccAddresses, bccAddresses, subject, body);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:39,代码来源:MailTo.java

示例4: initToolBar

import android.net.Uri; //导入方法依赖的package包/类
@Override
public void initToolBar() {
    String filePath = Uri.decode(getIntent().getDataString().replace("file://", ""));
    String fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.lastIndexOf("."));
    mCommonToolbar.setTitle(fileName);
    mCommonToolbar.setNavigationIcon(R.drawable.ab_back);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:ReadPDFActivity.java

示例5: buildSearchUrl

import android.net.Uri; //导入方法依赖的package包/类
public String buildSearchUrl(final String searchTerm) {
    if (resultsUris.isEmpty()) {
        return searchTerm;
    }

    // The parse should have put the best URL for this device at the beginning of the list.
    final Uri searchUri = resultsUris.get(0);

    final String template = Uri.decode(searchUri.toString());
    final String urlWithSubstitutions = paramSubstitution(template, Uri.encode(searchTerm));
    return UrlUtils.normalize(urlWithSubstitutions); // User-entered search engines may need normalization.
}
 
开发者ID:mozilla-mobile,项目名称:firefox-tv,代码行数:13,代码来源:SearchEngine.java

示例6: getPath

import android.net.Uri; //导入方法依赖的package包/类
/**
 * Get the path for the file:/// only
 * 
 * @param uri
 * @return
 */
public static String getPath(String uri) {
	Log.i("FileUtils#getPath(%s)", uri);
	if (TextUtils.isEmpty(uri))
		return null;
	if (uri.startsWith("file://") && uri.length() > 7)
		return Uri.decode(uri.substring(7));
	return Uri.decode(uri);
}
 
开发者ID:coding-dream,项目名称:TPlayer,代码行数:15,代码来源:FileUtils.java

示例7: parseSipContact

import android.net.Uri; //导入方法依赖的package包/类
/**
 * Parse a sip contact
 * 
 * @param sipUri string sip contact
 * @return a ParsedSipContactInfos which contains uri parts. If not match
 *         return the object with blank fields
 */
public static ParsedSipContactInfos parseSipContact(String sipUri) {
    ParsedSipContactInfos parsedInfos = new ParsedSipContactInfos();

    if (!TextUtils.isEmpty(sipUri)) {
        Matcher m = SIP_CONTACT_PATTERN.matcher(sipUri);
        if (m.matches()) {
            parsedInfos.displayName = Uri.decode(m.group(1).trim());
            parsedInfos.domain = m.group(4);
            parsedInfos.userName = Uri.decode(m.group(3));
            parsedInfos.scheme = m.group(2);
        }else {
            // Try to consider that as host
            m = SIP_HOST_PATTERN.matcher(sipUri);
            if(m.matches()) {
                parsedInfos.displayName = Uri.decode(m.group(1).trim());
                parsedInfos.domain = m.group(3);
                parsedInfos.scheme = m.group(2);
            }else {
                m = SIP_CONTACT_ADDRESS_PATTERN.matcher(sipUri);
                if(m.matches()) {
                    parsedInfos.userName = Uri.decode(m.group(1));
                    parsedInfos.domain = m.group(2);
                }else {
                    // Final fallback, we have only a username given
                    parsedInfos.userName = sipUri;
                }
            }
        }
    }

    return parsedInfos;
}
 
开发者ID:treasure-lau,项目名称:CSipSimple,代码行数:40,代码来源:SipUri.java

示例8: onCreate

import android.net.Uri; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState)
{
	super.onCreate(savedInstanceState);

	//  get the file path
	Uri uri = getIntent().getData();
	final String path = Uri.decode(uri.getEncodedPath());

	//  set up UI
	setContentView(R.layout.activity_doc_view);
	mDocActivityView = (DocActivityView) findViewById(R.id.doc_view);
	mDocActivityView.showUI(true);  //  set to false for no built-in UI

	//  set a listener for when it's done
	mDocActivityView.setOnDoneListener(new DocActivityView.OnDoneListener()
	{
		@Override
		public void done()
		{
			finish();
		}
	});

	//  Go!
	mDocActivityView.start(path);

}
 
开发者ID:ArtifexSoftware,项目名称:mupdf-android-viewer-nui,代码行数:29,代码来源:DocViewActivity.java

示例9: getPath

import android.net.Uri; //导入方法依赖的package包/类
public static String getPath(Context context, String url) {
    if (isContentUri(url)) {
        url = Uri.decode(url);
        String myUrl = getPath(context, Uri.parse(url));
        return myUrl;
    }
    return url;
}
 
开发者ID:redleaf2002,项目名称:magic_imageloader_network,代码行数:9,代码来源:FileUtils.java

示例10: accept

import android.net.Uri; //导入方法依赖的package包/类
@Override
public boolean accept(File pathname) {
	if (pathname.isFile()) {
		String decodeName = Uri.decode(pathname.getName());
		if (decodeName.startsWith("trainDetail_")) {
			return true;
		} else {
			return false;
		}
	}
	{
		return false;
	}
}
 
开发者ID:SShineTeam,项目名称:Huochexing12306,代码行数:15,代码来源:WelcomeAty.java

示例11: initToolBar

import android.net.Uri; //导入方法依赖的package包/类
@Override
public void initToolBar() {
    chmFilePath = Uri.decode(getIntent().getDataString().replace("file://", ""));
    chmFileName = chmFilePath.substring(chmFilePath.lastIndexOf("/") + 1, chmFilePath.lastIndexOf("."));
    mCommonToolbar.setTitle(chmFileName);
    mCommonToolbar.setNavigationIcon(R.drawable.ab_back);
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:8,代码来源:ReadCHMActivity.java

示例12: query

import android.net.Uri; //导入方法依赖的package包/类
private void query(){
    if(next_href!=null){
        int index=next_href.indexOf("&q=")+3;
        if(next_href.length()>index){
            int lastIndex=next_href.indexOf("&",index);
            query=next_href.substring(index,lastIndex!=-1?lastIndex:next_href.length());
            query=Uri.decode(query);
        }
    }
}
 
开发者ID:vpaliyX,项目名称:SoundCloud-API,代码行数:11,代码来源:Page.java

示例13: initDatas

import android.net.Uri; //导入方法依赖的package包/类
@Override
public void initDatas() {
    recommendBooks = (Recommend.RecommendBooks) getIntent().getSerializableExtra(INTENT_BEAN);
    bookId = recommendBooks._id;
    isFromSD = getIntent().getBooleanExtra(INTENT_SD, false);

    if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
        String filePath = Uri.decode(getIntent().getDataString().replace("file://", ""));
        String fileName;
        if (filePath.lastIndexOf(".") > filePath.lastIndexOf("/")) {
            fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.lastIndexOf("."));
        } else {
            fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
        }

        CollectionsManager.getInstance().remove(fileName);
        // 转存
        File desc = FileUtils.createWifiTranfesFile(fileName);
        FileUtils.fileChannelCopy(new File(filePath), desc);
        // 建立
        recommendBooks = new Recommend.RecommendBooks();
        recommendBooks.isFromSD = true;
        recommendBooks._id = fileName;
        recommendBooks.title = fileName;

        isFromSD = true;
    }
    EventBus.getDefault().register(this);
    showDialog();

    mTvBookReadTocTitle.setText(recommendBooks.title);

    intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
    intentFilter.addAction(Intent.ACTION_TIME_TICK);

    CollectionsManager.getInstance().setRecentReadingTime(bookId);
    Observable.timer(1000, TimeUnit.MILLISECONDS)
            .subscribe(new Action1<Long>() {
                @Override
                public void call(Long aLong) {
                    //延迟1秒刷新书架
                    EventManager.refreshCollectionList();
                }
            });
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:46,代码来源:ReadActivity.java

示例14: initDatas

import android.net.Uri; //导入方法依赖的package包/类
@Override
public void initDatas() {
    recommendBooks = (Recommend.RecommendBooks) getIntent().getSerializableExtra(INTENT_BEAN);
    bookId = recommendBooks._id;
    isFromSD = getIntent().getBooleanExtra(INTENT_SD, false);

    if (Intent.ACTION_VIEW.equals(getIntent().getAction())) {
        String filePath = Uri.decode(getIntent().getDataString().replace("file://", ""));
        String fileName;
        if (filePath.lastIndexOf(".") > filePath.lastIndexOf("/")) {
            fileName = filePath.substring(filePath.lastIndexOf("/") + 1, filePath.lastIndexOf("."));
        } else {
            fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
        }

        CollectionsManager.getInstance().remove(fileName);
        // 转存
        File desc = FileUtils.createWifiTranfesFile(fileName);
        FileUtils.fileChannelCopy(new File(filePath), desc);
        // 建立
        recommendBooks = new Recommend.RecommendBooks();
        recommendBooks.isFromSD = true;
        recommendBooks._id = fileName;
        recommendBooks.title = fileName;

        isFromSD = true;
    }
    EventBus.getDefault().register(this);
    showDialog();

    mTvBookReadTocTitle.setText(recommendBooks.title);

    mTtsPlayer = TTSPlayerUtils.getTTSPlayer();
    ttsConfig = TTSPlayerUtils.getTtsConfig();

    intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
    intentFilter.addAction(Intent.ACTION_TIME_TICK);

    CollectionsManager.getInstance().setRecentReadingTime(bookId);
    Observable.timer(1000, TimeUnit.MILLISECONDS)
            .subscribe(new Action1<Long>() {
                @Override
                public void call(Long aLong) {
                    //延迟1秒刷新书架
                    EventManager.refreshCollectionList();
                }
            });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:49,代码来源:ReadActivity.java

示例15: getAu

import android.net.Uri; //导入方法依赖的package包/类
public String getAu() {
    return Uri.decode(this.au);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:4,代码来源:Marketing.java


注:本文中的android.net.Uri.decode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。