Java Doc for Protocol.java in  » 6.0-JDK-Modules » j2me » com » sun » midp » io » j2me » cbs » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules » j2me » com.sun.midp.io.j2me.cbs 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.sun.midp.io.j2me.ProtocolBase
      com.sun.midp.io.j2me.cbs.Protocol

Protocol
public class Protocol extends ProtocolBase (Code)
CBS message connection implementation. Cell Broadcast message connections are receive only.


Field Summary
final protected static  intGSM_BINARY
    
final protected static  intGSM_TEXT
    
final protected static  intGSM_UCS2
    
protected static  VectoropenConnections
     Currently opened connections.
protected  Stringurl
     Name of current connection.

Constructor Summary
public  Protocol()
     Creates a message connection protocol handler.

Method Summary
protected  voidcheckReceivePermission()
     Checks the internal setting of the receive permission.
public  voidclose()
     Closes the connection.
protected  intclose00(int connHandle, int deRegister)
     Close connection.
Parameters:
  connHandle - handle returned by open0
Parameters:
  deRegister - Deregistration appID when parameter is 1.
protected  StringgetAppID()
     Gets the connection parameter in string mode.
public  MessagenewMessage(String type)
     Constructs a new message object of a binary or text type. If the TEXT_MESSAGE constant is passed in, the TextMessage interface is implemented by the created object. If the BINARY_MESSAGE constant is passed in, the BinaryMessage interface is implemented by the created object.
public  MessagenewMessage(String type, String addr)
     Constructs a new message object of a text or binary type and specifies a destination address. If the TEXT_MESSAGE constant is passed in, the TextMessage interface is implemented by the created object. If the BINARY_MESSAGE constant is passed in, the BinaryMessage interface is implemented by the created object.

The destination address addr has the following format:

cbs://phone_number:port


Parameters:
  type - TEXT_MESSAGE orBINARY_MESSAGE.
Parameters:
  addr - The destination address of the message.
public  intnumberOfSegments(Message message)
     Returns the number of segments required to send the given Message.

Note: The message is not actually sent.

public  DataInputStreamopenDataInputStream()
     Open and return a data input stream for a connection.
public  DataOutputStreamopenDataOutputStream()
     Open and return a data output stream for a connection.
public  InputStreamopenInputStream()
     Open and return an input stream for a connection.
public  OutputStreamopenOutputStream()
     Open and return an output stream for a connection.
public  ConnectionopenPrim(String name, int mode, boolean timeouts)
     Opens a CBS connection.
public synchronized  ConnectionopenPrimInternal(String name, int mode, boolean timeouts)
     Opens a CBS connection.
public synchronized  Messagereceive()
     Receives the bytes that have been sent over the connection, constructs a Message object, and returns it.
public  voidsend(Message msg)
     Cell broadcast connections are read-only connections.
protected  voidsetAppID(String newValue)
     Sets the connection parameter in string mode.
protected  intunblock00(int msid)
     Unblock the receive thread.
Parameters:
  msid - The MIDlet suite ID.
protected  intwaitUntilMessageAvailable00(int handle)
    

Field Detail
GSM_BINARY
final protected static int GSM_BINARY(Code)
DCS: Binary



GSM_TEXT
final protected static int GSM_TEXT(Code)
DCS: GSM Alphabet



GSM_UCS2
final protected static int GSM_UCS2(Code)
DCS: Unicode UCS-2



openConnections
protected static Vector openConnections(Code)
Currently opened connections.



url
protected String url(Code)
Name of current connection.




Constructor Detail
Protocol
public Protocol()(Code)
Creates a message connection protocol handler.




Method Detail
checkReceivePermission
protected void checkReceivePermission() throws InterruptedIOException(Code)
Checks the internal setting of the receive permission. Called from the receive and setMessageListener methods.
exception:
  InterruptedIOException - if permission dialog was pre-empted.



close
public void close() throws IOException(Code)
Closes the connection. Resets the connection open flag to false. Subsequent operations on a closed connection should throw an appropriate exception.
exception:
  IOException - if an I/O error occurs



close00
protected int close00(int connHandle, int deRegister)(Code)
Close connection.
Parameters:
  connHandle - handle returned by open0
Parameters:
  deRegister - Deregistration appID when parameter is 1. 0 on success, -1 on failure



getAppID
protected String getAppID()(Code)
Gets the connection parameter in string mode. string that contains a parameter



newMessage
public Message newMessage(String type)(Code)
Constructs a new message object of a binary or text type. If the TEXT_MESSAGE constant is passed in, the TextMessage interface is implemented by the created object. If the BINARY_MESSAGE constant is passed in, the BinaryMessage interface is implemented by the created object.

If this method is called in a sending mode, a new Message object is requested from the connection. For example:

Message msg = conn.newMessage(TEXT_MESSAGE);

The Message object that was created doesn't have the destination address set. It's the application's responsibility to set it before the message is sent.

If this method is called in receiving mode, the Message object does have its address set. The application can act on the object to extract the address and message data.


Parameters:
  type - TEXT_MESSAGE orBINARY_MESSAGE. A new CBS Message object.




newMessage
public Message newMessage(String type, String addr)(Code)
Constructs a new message object of a text or binary type and specifies a destination address. If the TEXT_MESSAGE constant is passed in, the TextMessage interface is implemented by the created object. If the BINARY_MESSAGE constant is passed in, the BinaryMessage interface is implemented by the created object.

The destination address addr has the following format:

cbs://phone_number:port


Parameters:
  type - TEXT_MESSAGE orBINARY_MESSAGE.
Parameters:
  addr - The destination address of the message. A new CBS Message object.



numberOfSegments
public int numberOfSegments(Message message)(Code)
Returns the number of segments required to send the given Message.

Note: The message is not actually sent. The number of protocol segments is simply computed.

This method calculates the number of segments required when this message is split into the protocol segments utilizing the underlying protocol's features. Possible implementation's limitations that may limit the number of segments that can be sent using it are not taken into account. These limitations are protocol specific. They are documented with that protocol's adapter definition.


Parameters:
  message - The message to be used for the computation. The number of protocol segments needed for sending the message.Returns 0 if the Message object cannot besent using the underlying protocol.



openDataInputStream
public DataInputStream openDataInputStream() throws IOException(Code)
Open and return a data input stream for a connection. This method always throw IllegalArgumentException. a An input stream.
exception:
  IOException - if an I/O error occurs.
exception:
  IllegalArgumentException - is thrown for all requests.



openDataOutputStream
public DataOutputStream openDataOutputStream() throws IOException(Code)
Open and return a data output stream for a connection. This method always throw IllegalArgumentException. An output stream.
exception:
  IOException - if an I/O error occurs.
exception:
  IllegalArgumentException - is thrown for all requests.



openInputStream
public InputStream openInputStream() throws IOException(Code)
Open and return an input stream for a connection. This method always throw IllegalArgumentException. An input stream.
exception:
  IOException - if an I/O error occurs.
exception:
  IllegalArgumentException - is thrown for all requests.



openOutputStream
public OutputStream openOutputStream() throws IOException(Code)
Open and return an output stream for a connection. This method always throw IllegalArgumentException. An output stream.
exception:
  IOException - if an I/O error occurs.
exception:
  IllegalArgumentException - is thrown for all requests.



openPrim
public Connection openPrim(String name, int mode, boolean timeouts) throws IOException(Code)
Opens a CBS connection. This method is called from the Connector.open() method to obtain the destination address given in the name parameter.

The format for the name string for this method is:

cbs://[phone_number:][port_number]

where the phone_number: is optional. If the phone_number parameter is present, the connection is being opened in client mode. This means that messages can be sent. If the parameter is absent, the connection is being opened in server mode. This means that messages can be sent and received.

The connection that is opened is to a low-level transport mechanism which can be any of the following:

  • a datagram Short Message Peer-to-Peer (SMPP) to a service center
  • a comm connection to a phone device with AT-commands
  • .
  • a native CBS stack
Currently, the mode and timeouts parameters are ignored.
Parameters:
  name - the target of the connection
Parameters:
  mode - indicates whether the callerintends to write to the connection. Currently,this parameter is ignored.
Parameters:
  timeouts - indicates whether the callerwants timeout exceptions. Currently,this parameter is ignored. this connection
exception:
  IOException - if the connection is closed or unavailable



openPrimInternal
public synchronized Connection openPrimInternal(String name, int mode, boolean timeouts) throws IOException(Code)
Opens a CBS connection. This is the internal entry point that allows the CBS protocol handler to use the reserved port for CBS emulated messages.
Parameters:
  name - The name of the connection, which as a format of"//:portNumber" for CBS connections.
Parameters:
  mode - Must be READ, only.
Parameters:
  timeouts - Indicates whether the caller wants time-outexceptions. Currently ignored. the successfully opened connection.
exception:
  IOException - if the connection is closed or unavailable.



receive
public synchronized Message receive() throws IOException(Code)
Receives the bytes that have been sent over the connection, constructs a Message object, and returns it.

If there are no Messages waiting on the connection, this method will block until the MessageConnection is closed, or a message is received. a Message object
exception:
  java.io.IOException - if an error occurs while receivinga message.
exception:
  java.io.InterruptedIOException - if thisMessageConnection object is closed during thecall of this method.
exception:
  java.lang.SecurityException - if the application doesn't havepermission to receive messages on the given port.




send
public void send(Message msg) throws IOException(Code)
Cell broadcast connections are read-only connections. Calling this method causes an IOException to be thrown.
Parameters:
  msg - Placeholder: A Message object.
exception:
  IOException - always thrown.



setAppID
protected void setAppID(String newValue)(Code)
Sets the connection parameter in string mode.
Parameters:
  newValue - new value of connection parameter



unblock00
protected int unblock00(int msid) throws IOException(Code)
Unblock the receive thread.
Parameters:
  msid - The MIDlet suite ID. returns handle to the connection.



waitUntilMessageAvailable00
protected int waitUntilMessageAvailable00(int handle) throws IOException(Code)
Waits until message available
Parameters:
  handle - handle to connection 0 on success, -1 on failure
exception:
  IOException - if an I/O error occurs



Fields inherited from com.sun.midp.io.j2me.ProtocolBase
protected String ADDRESS_PREFIX(Code)(Java Doc)
protected String appID(Code)(Java Doc)
protected Object closeLock(Code)(Java Doc)
protected int connHandle(Code)(Java Doc)
protected String host(Code)(Java Doc)
protected int m_mode(Code)(Java Doc)
protected MIDletSuite midletSuite(Code)(Java Doc)
protected boolean open(Code)(Java Doc)
protected boolean openPermission(Code)(Java Doc)
protected boolean readPermission(Code)(Java Doc)
protected boolean writePermission(Code)(Java Doc)

Methods inherited from com.sun.midp.io.j2me.ProtocolBase
abstract protected void checkReceivePermission() throws InterruptedIOException(Code)(Java Doc)
abstract protected int close00(int connHandle, int deRegister)(Code)(Java Doc)
public void ensureOpen() throws IOException(Code)(Java Doc)
abstract protected String getAppID()(Code)(Java Doc)
protected void io2InterruptedIOExc(IOException ex, String name) throws IOException, InterruptedIOException(Code)(Java Doc)
abstract public Message newMessage(String type)(Code)(Java Doc)
abstract public Message newMessage(String type, String addr)(Code)(Java Doc)
abstract public Message receive() throws IOException(Code)(Java Doc)
abstract public void send(Message dmsg) throws IOException(Code)(Java Doc)
abstract protected void setAppID(String newValue)(Code)(Java Doc)
public void setMessageListener(MessageListener listener) throws IOException(Code)(Java Doc)
abstract protected int unblock00(int msid) throws IOException(Code)(Java Doc)
abstract protected int waitUntilMessageAvailable00(int handle) throws IOException(Code)(Java Doc)

Methods inherited from java.lang.Object
public boolean equals(Object obj)(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.