Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Průvodce řešením problémů Strana 218

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 286
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 217
218
BlackBerry Java Development Environment Development Guide
Code sample: Listening for data from a web server
Example: HTTPPushDemo.java
/**
* The client side of a simple HTTP Push system.
* This application will listen for image data on the specified port and
* render the data when it arrives.
* Copyright (C) 2001-2005 Research In Motion Limited. All rights reserved.
*/
package com.rim.samples.docs.httppush;
import java.io.*;
import javax.microedition.io.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import com.rim.samples.docs.resource.*;
import net.rim.device.api.util.*;
import net.rim.device.api.io.http.*;
public class HTTPPushDemo extends UiApplication implements HTTPPushDemoResResource
{
// Constants.
private static final String URL = “http://:100”; //PORT 100
private static final int CHUNK_SIZE = 256;
// Fields.
private ListeningThread _listeningThread;
private MainScreen _mainScreen;
private RichTextField _infoField;
private RichTextField _imageField;
//statics ------------------------------------------------------------------
private static ResourceBundle _resources =
ResourceBundle.getBundle(HTTPPushDemoResResource.BUNDLE_ID,
HTTPPushDemoResResource.BUNDLE_NAME);
public static void main(String[] args) {
HTTPPushDemo theApp = new HTTPPushDemo();
theApp.enterEventDispatcher();
}
/**
* Create a separate listening thread so that you do not
* block the application’s main event thread.
*/
private class ListeningThread extends Thread {
Close the stream connection notifier. >Invoke close() on the stream connection notifier.
_notify.close();
Task Steps
Zobrazit stránku 217
1 2 ... 213 214 215 216 217 218 219 220 221 222 223 ... 285 286

Komentáře k této Příručce

Žádné komentáře