⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 breakpoint.java

📁 j2me的基于http协议的断点续传。支持多线程的断点续传。
💻 JAVA
字号:
package NetFox;import javax.microedition.midlet.*;import javax.microedition.io.*;import javax.microedition.lcdui.*;import LogUtils;import java.io.*;public class BreakPoint extends MIDlet {    private FileSelector fileSelector;    public BreakPoint() {        fileSelector = new FileSelector(this);    }    /**     * Start creates the thread to do the MessageConnection receive     * text.     * It should return immediately to keep the dispatcher     * from hanging.     */    public void startApp()     {        Displayable current = Display.getDisplay(this).getCurrent();        LogUtils.setLevel(LogUtils.LEVEL_INFO);                if (current == null) {            if (0 != Utility.init()) {                Alert splashScreen = new Alert(null, "init log error", null, null);                Display.getDisplay(this).setCurrent(splashScreen);            }            Utility.log("startApp ... \n");                        // Checks whether the API is available            boolean isAPIAvailable = System.getProperty(                "microedition.io.file.FileConnection.version") != null;                        // shows splash screen            String text = "File Conn test";                    if (!isAPIAvailable) {                text += "\nFile Connection API is not available";            }                    Alert splashScreen = new Alert(null, text, null, null);            if (isAPIAvailable) {                splashScreen.setTimeout(1000);                Display.getDisplay(this).setCurrent(splashScreen, fileSelector);            } else {                Display.getDisplay(this).setCurrent(splashScreen);            }        } else {            Display.getDisplay(this).setCurrent(current);        }    }    /**     * Pause signals the thread to stop by clearing the thread field.     * If stopped before done with the iterations it will     * be restarted from scratch later.     */    public void pauseApp() {        Utility.log("pauseApp ... \n");        Utility.close();    }    /**     * Destroy must cleanup everything.  The thread is signaled     * to stop and no result is produced.     * @param unconditional true if a forced shutdown was requested     */    public void destroyApp(boolean unconditional) {        Utility.log("destroyApp ... \n");        Utility.close();        notifyDestroyed();    }    void fileSelectorExit() {       destroyApp(false);    }        /**     * A method used to show errors.     * @param e Exception     */    void showError(Exception e) {       ErrorScreen.showError(e.getMessage(), fileSelector);    }    /**     * A method used to show messages.     * @param text String     */    void showMsg(String text) {        Alert infoScreen = new Alert(null, text, null, null);        infoScreen.setTimeout(3000);        Display.getDisplay(this).setCurrent(infoScreen, fileSelector);    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -