當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。