Package ej.ecom.io
Class Connector
- java.lang.Object
-
- ej.ecom.io.Connector
-
public class Connector extends Object
This class defines methods for opening aConnectionfrom an URL. The URL format (which complies with RFC 2396) is on the following format:[protocol]:[name](;[param])*
Where:protocoldefines the connection protocol (for example:comm,http)nameis the name of the connection to open (for example:/dev/ttyS0,192.168.1.1)paramis a connection specific parameter
The factory corresponding to the extracted protocol is dynamically bound and its
ConnectionFactory.open(java.lang.String, int, boolean)method is called on the specified URL.- See Also:
ConnectionFactory
-
-
Field Summary
Fields Modifier and Type Field Description static intREADAccess mode READ.static intREAD_WRITEAccess mode READ/WRITE.static intWRITEAccess mode WRITE.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Connectionopen(String url)Create and open a Connection from an URL.static Connectionopen(String url, int mode)Create and open a Connection.static Connectionopen(String url, int mode, boolean timeouts)Create and open a Connection.static Connectionopen(String packageName, String url, int mode, boolean timeouts)Create and open a Connection with the specifiedConnectionFactorypackage name.
-
-
-
Field Detail
-
READ
public static final int READ
Access mode READ.- See Also:
- Constant Field Values
-
WRITE
public static final int WRITE
Access mode WRITE.- See Also:
- Constant Field Values
-
READ_WRITE
public static final int READ_WRITE
Access mode READ/WRITE.- See Also:
- Constant Field Values
-
-
Method Detail
-
open
public static Connection open(String url) throws IOException
Create and open a Connection from an URL.- Parameters:
url- the connection URL to open- Returns:
- the open
Connection. - Throws:
ConnectionNotFoundException- if connection protocol is not foundIOException- if an I/O error occursSecurityException- if a security manager exists and it does not allow the caller to open such kind of connection
-
open
public static Connection open(String url, int mode) throws IOException
Create and open a Connection.- Parameters:
url- the connection URL to open- Returns:
- the open
Connection. - Throws:
ConnectionNotFoundException- if connection protocol is not foundIOException- if an I/O error occursSecurityException- if a security manager exists and it does not allow the caller to open such kind of connection
-
open
public static Connection open(String url, int mode, boolean timeouts) throws IOException
Create and open a Connection.- Parameters:
url- the connection URL to open- Returns:
- the open
Connection. - Throws:
ConnectionNotFoundException- if connection protocol is not foundIOException- if an I/O error occursSecurityException- if a security manager exists and it does not allow the caller to open such kind of connection
-
open
public static Connection open(String packageName, String url, int mode, boolean timeouts) throws IOException
Create and open a Connection with the specifiedConnectionFactorypackage name.- Parameters:
url- the connection URL to openpackageName- the package name prefix of theConnectionFactoryto bind- Returns:
- the open
Connection. - Throws:
ConnectionNotFoundException- if connection protocol is not foundIOException- if an I/O error occursSecurityException- if a security manager exists and it does not allow the caller to open such kind of connection- See Also:
ConnectionFactory
-
-