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


Java Util.encodeUrl方法代码示例

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


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

示例1: sendMessage

import com.codename1.io.Util; //导入方法依赖的package包/类
@Override
public void sendMessage(String[] recieptents, String subject, Message msg) {
    if(recieptents != null){
        try {
            String mailto = "mailto:" + recieptents[0];
            for(int iter = 1 ; iter < recieptents.length ; iter++) {
                mailto += "," + recieptents[iter];
            }
            mailto += "?body=" + Util.encodeUrl(msg.getContent()) + "&subject=" + Util.encodeUrl(subject);
            Desktop.getDesktop().mail(new URI(mailto));
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        System.out.println("sending message to " + recieptents[0]);
    }
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:17,代码来源:JavaSEPort.java

示例2: sendMessage

import com.codename1.io.Util; //导入方法依赖的package包/类
public void sendMessage(String[] recieptents, String subject, Message msg) {
    String mailto = "mailto:" + recieptents[0];
    for(int iter = 1 ; iter < recieptents.length ; iter++) {
        mailto += "," + recieptents[iter];
    }
    mailto += "?body=" + Util.encodeUrl(msg.getContent()) + "&subject=" + Util.encodeUrl(subject);
    execute(mailto);
}
 
开发者ID:codenameone,项目名称:CodenameOne,代码行数:9,代码来源:GameCanvasImplementation.java

示例3: buildQueryStringParameter

import com.codename1.io.Util; //导入方法依赖的package包/类
private String buildQueryStringParameter(String key, String val)
{
    return Util.encodeUrl(key) + "=" + Util.encodeUrl(val);
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:5,代码来源:Proxy.java

示例4: createMediaByTrack

import com.codename1.io.Util; //导入方法依赖的package包/类
/*******************************************************************************************************************
 *
 * Helper ...
 *
 ******************************************************************************************************************/

private MediaItem createMediaByTrack(Map track, ActionListener coverActionListener) throws MediaNotFoundException, IOException {
    String url = null;
    Boolean isOffline = false;

    if (MediaHelper.getState(track) == MediaHelper.DOWNLOADED)
    {
        String path = FileManager.getInstance().getFullPath(MediaHelper.getLocalFilename(track));
        url = path;
        isOffline = true;
    }
    else {
        for (Map itemMedia : (ArrayList<Map>)track.get("media")) {
            if ("audio".equals(itemMedia.get("type"))) {
                Map file = ((ArrayList<Map>)itemMedia.get("files")).get(0);
                url = (String)file.get("url");
            }
        }

        // There was no playable media in here. Go on and try playing the next.
        if (url == null) {
            log("No audio found in " + MediaHelper.getId(track));
            throw new MediaNotFoundException();
        }

        if (url.startsWith("https://")) {
            url = "http://"
                    // Maybe we have an "@" in the username ...
                    + Util.encodeUrl(Api.getInstance().getProfile().getUsername())
                    + ":"
                    + Util.encodeUrl(Api.getInstance().getProfile().getToken())
                    + "@"
                    + url.substring(8);
        }
    }

    Log.p("url: " + url);

    final MediaItem media = new MediaItem(url, track, isOffline);
    Log.p("new Media created");

    // This should be null if the track is pre-loading.
    if (coverActionListener != null) {
        media.addCoverLoadedListener(coverActionListener);
    }

    if (coverUrl == null || !coverUrl.equals(media.getCoverUrl())) {
        // Reset cover variables
        coverUrl = null;
        cover = null;

        // Load the cover in a separate thread. It may take time to read the ID3 header of the file or where ever the image actually comes from.
        Display.getInstance().scheduleBackgroundTask(new Runnable() {
            public void run() {
                media.initCover();
            }
        });
    } else {
        media.setCover(cover);
        Log.p("Reuse loaded cover.");
    }

    return media;
}
 
开发者ID:martijn00,项目名称:MusicPlayerCodenameOne,代码行数:70,代码来源:MediaPlayer.java


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