Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Anleitung zur Fehlerbehebung Seite 63

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 286
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 62
63
2: Using graphics and multimedia
}
public InputStream getInputStream(String uri, ConnectionInfo info)
throws IOException, MediaException {
if (uri.startsWith(“myprotocol://”)) {
// Perform special tasks.
info.setConnection(new MyProtocolConnection());
info.setContentType(“application/x-vnd.rim.pme”);
// OpenMyInputStream() is a custom method that opens
//stream for “myprotocol://”
input = openMyInputStream(uri);
} else {
input = delegate.getInputStream(uri, info);
}
return input;
}
private InputStream openMyInputStream(String uri) {
InputStream input = null;
// @todo: open stream here
return input;
}
public void releaseConnection(ConnectionInfo info)
throws IOException, MediaException {
Object o = info.getConnection();
if (o instanceof MyProtocolConnection) {
((MyProtocolConnection)o).close(); // Perform cleanup.
} else {
delegate.releaseConnection(info);
}
}
public void setProperty(String property, String value) {
delegate.setProperty(property, value);
}
// Inner class that defines the connection class.
public static class MyProtocolConnection {
public MyProtocolConnection() {
// ...
}
public void close() {
// ...
}
}
}
Seitenansicht 62
1 2 ... 58 59 60 61 62 63 64 65 66 67 68 ... 285 286

Kommentare zu diesen Handbüchern

Keine Kommentare