javax.microedition.io
Interface Connection

All Known Subinterfaces:
APDUConnection, ClientSession, CommConnection, ContentConnection, DatagramConnection, ExtendedFileConnection, FileConnection, HttpConnection, HttpsConnection, HttpServerConnection, InputConnection, JavaCardRMIConnection, L2CAPConnection, L2CAPConnectionNotifier, MessageConnection, Operation, OutputConnection, SecureConnection, ServerSocketConnection, SessionNotifier, SocketConnection, StreamConnection, StreamConnectionNotifier, UDPDatagramConnection

public interface Connection

This is the most basic type of generic connection. Only the close method is defined. The open method defined here because opening is always done by the Connector.open() methods.

Blocking Operations

This interface performs blocking Input and Output operations. An application will lock if an implementation of this interface opens a connection from within the main event thread. Prevent an application from locking by opening a connection from within a thread that is separate from the main event thread. SeeConnector for more information.


Method Summary
 void close()
          Close the connection.
 

Method Detail

close

public void close()
           throws IOException
Close the connection.

When a connection has been closed, access to any of its methods except this close() will cause an an IOException to be thrown. Closing an already closed connection has no effect. Streams derived from the connection may be open when method is called. Any open streams will cause the connection to be held open until they themselves are closed. In this latter case access to the open streams is permitted, but access to the connection is not.

BlackBerry Implementation Note: When developing applications for the BlackBerry Wireless handheld, note that the stream must be flushed or closed before the program exits, otherwise all pending data will be lost.

Throws:
IOException - If an I/O error occurs



Copyright 1999-2009 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Copyright 1993-2003 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
Copyright 2002-2003 Nokia Corporation All Rights Reserved.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.