Class NetworkConnector
java.lang.Object
jp.co.sanei_elec.printerlibrary.api.connectivity.AbstractConnector
jp.co.sanei_elec.printerlibrary.api.connectivity.NetworkConnector
This class implements a network connector to remote host.
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkConnector
(android.content.Context context, String host, int port) Creates aNetworkConnector
from a hostname and a port number. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this network connector and releases any system resources associated with it.void
connect()
Connects this connector to the specified remote network host.boolean
getHost()
Gets the host name.Return an input stream to read data from this connector.Return an output stream to write data into this connector.int
getPort()
Gets the port number.int
hashCode()
toString()
Methods inherited from class jp.co.sanei_elec.printerlibrary.api.connectivity.AbstractConnector
getContext
-
Constructor Details
-
NetworkConnector
Creates aNetworkConnector
from a hostname and a port number.- Parameters:
context
- the context of network connector.host
- the host name.port
- the port address.
-
-
Method Details
-
getHost
Gets the host name.- Returns:
- the host name.
-
getPort
public int getPort()Gets the port number.- Returns:
- the port number.
-
connect
Connects this connector to the specified remote network host.- Specified by:
connect
in classAbstractConnector
- Throws:
IOException
- if socket is already connected or an error occurs while connecting.
-
close
Closes this network connector and releases any system resources associated with it.- Specified by:
close
in classAbstractConnector
- Throws:
IOException
- if an I/O error occurs.
-
getInputStream
Return an input stream to read data from this connector.- Specified by:
getInputStream
in classAbstractConnector
- Returns:
- the byte-oriented input stream.
- Throws:
IOException
- if an I/O error occurs.
-
getOutputStream
Return an output stream to write data into this connector.- Specified by:
getOutputStream
in classAbstractConnector
- Returns:
- the byte-oriented output stream.
- Throws:
IOException
- if an I/O error occurs.
-
equals
-
hashCode
public int hashCode() -
toString
-