public abstract class ServiceInfo
extends java.lang.Object
implements java.lang.Cloneable
The fully qualified service name is build using up to 5 components with the following structure:
<app>.<protocol>.<servicedomain>.<parentdomain>.
<Instance>.<app>.<protocol>.<servicedomain>.<parentdomain>.
<sub>._sub.<app>.<protocol>.<servicedomain>.<parentdomain>.
Modifier and Type | Class and Description |
---|---|
static class |
ServiceInfo.Fields
Fields for the fully qualified map.
|
Modifier and Type | Field and Description |
---|---|
static byte[] |
NO_VALUE
This is the no value text byte.
|
Constructor and Description |
---|
ServiceInfo() |
Modifier and Type | Method and Description |
---|---|
ServiceInfo |
clone() |
static ServiceInfo |
create(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap,
int port,
int weight,
int priority,
boolean persistent,
java.util.Map<java.lang.String,?> props)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
int weight,
int priority,
boolean persistent,
byte[] text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
int weight,
int priority,
boolean persistent,
java.util.Map<java.lang.String,?> props)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
int weight,
int priority,
boolean persistent,
java.lang.String text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
int weight,
int priority,
byte[] text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
int weight,
int priority,
java.util.Map<java.lang.String,?> props)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
int weight,
int priority,
java.lang.String text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
int port,
java.lang.String text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
byte[] text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
java.util.Map<java.lang.String,?> props)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
boolean persistent,
java.lang.String text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
byte[] text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
java.util.Map<java.lang.String,?> props)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
int weight,
int priority,
java.lang.String text)
Construct a service description for registering with JmDNS.
|
static ServiceInfo |
create(java.lang.String type,
java.lang.String name,
java.lang.String subtype,
int port,
java.lang.String text)
Construct a service description for registering with JmDNS.
|
abstract java.net.InetAddress |
getAddress()
Deprecated.
since 3.1.8
|
abstract java.lang.String |
getApplication()
Returns the application of the service info suitable for printing.
|
abstract java.lang.String |
getDomain()
Returns the domain of the service info suitable for printing.
|
abstract java.lang.String |
getHostAddress()
Deprecated.
since 3.2.3
|
abstract java.lang.String[] |
getHostAddresses()
Returns the host IP addresses string in textual presentation.
|
abstract java.net.Inet4Address |
getInet4Address()
Deprecated.
since 3.2.3
|
abstract java.net.Inet4Address[] |
getInet4Addresses()
Returns a list of all IPv4 InetAddresses that can be used for this service.
|
abstract java.net.Inet6Address |
getInet6Address()
Deprecated.
since 3.2.3
|
abstract java.net.Inet6Address[] |
getInet6Addresses()
Returns a list of all IPv6 InetAddresses that can be used for this service.
|
abstract java.net.InetAddress |
getInetAddress()
Deprecated.
since 3.2.3
|
abstract java.net.InetAddress[] |
getInetAddresses()
Returns a list of all InetAddresses that can be used for this service.
|
abstract java.lang.String |
getKey()
The key is used to retrieve service info in hash tables.
The key is the lower case qualified name. |
abstract java.lang.String |
getName()
Unqualified service instance name, such as
foobar . |
abstract java.lang.String |
getNiceTextString()
Returns a description of the service info suitable for printing.
|
abstract int |
getPort()
Get the port for the service.
|
abstract int |
getPriority()
Get the priority of the service.
|
abstract byte[] |
getPropertyBytes(java.lang.String name)
Get a property of the service.
|
abstract java.util.Enumeration<java.lang.String> |
getPropertyNames()
Enumeration of the property names.
|
abstract java.lang.String |
getPropertyString(java.lang.String name)
Get a property of the service.
|
abstract java.lang.String |
getProtocol()
Returns the protocol of the service info suitable for printing.
|
abstract java.lang.String |
getQualifiedName()
Fully qualified service name, such as
foobar._http._tcp.local. . |
abstract java.util.Map<ServiceInfo.Fields,java.lang.String> |
getQualifiedNameMap()
Returns a dictionary of the fully qualified name component of this service.
|
abstract java.lang.String |
getServer()
Get the name of the server.
|
abstract java.lang.String |
getSubtype()
Returns the sub type of the service info suitable for printing.
|
abstract byte[] |
getTextBytes()
Get the text for the service as raw bytes.
|
abstract java.lang.String |
getTextString()
Deprecated.
since 3.1.7
|
abstract java.lang.String |
getType()
Fully qualified service type name, such as
_http._tcp.local. |
abstract java.lang.String |
getTypeWithSubtype()
Fully qualified service type name with the subtype if appropriate, such as
_printer._sub._http._tcp.local. |
abstract java.lang.String |
getURL()
Deprecated.
since 3.2.3
|
abstract java.lang.String |
getURL(java.lang.String protocol)
Deprecated.
since 3.2.3
|
abstract java.lang.String[] |
getURLs()
Get the list of URL for this service.
|
abstract java.lang.String[] |
getURLs(java.lang.String protocol)
Get the list of URL for this service.
|
abstract int |
getWeight()
Get the weight of the service.
|
abstract boolean |
hasData()
Returns true if the service info is filled with data.
|
abstract boolean |
isPersistent()
Returns
true if ServiceListener.resolveService will be called whenever new new information is received. |
abstract void |
setText(byte[] text)
Set the text for the service.
|
abstract void |
setText(java.util.Map<java.lang.String,?> props)
Set the text for the service.
|
public static final byte[] NO_VALUE
public static ServiceInfo create(java.lang.String type, java.lang.String name, int port, java.lang.String text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runstext
- string describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, java.lang.String text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runstext
- string describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, java.lang.String text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicetext
- string describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, java.lang.String text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicetext
- string describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, java.util.Map<java.lang.String,?> props)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the serviceprops
- properties describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, java.util.Map<java.lang.String,?> props)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the serviceprops
- properties describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, byte[] text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicetext
- bytes describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, byte[] text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicetext
- bytes describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, boolean persistent, java.lang.String text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.text
- string describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, boolean persistent, java.lang.String text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.text
- string describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, boolean persistent, java.util.Map<java.lang.String,?> props)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.props
- properties describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, boolean persistent, java.util.Map<java.lang.String,?> props)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.props
- properties describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, boolean persistent, byte[] text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.text
- bytes describing the servicepublic static ServiceInfo create(java.lang.String type, java.lang.String name, java.lang.String subtype, int port, int weight, int priority, boolean persistent, byte[] text)
type
- fully qualified service type name, such as _http._tcp.local.
.name
- unqualified service instance name, such as foobar
subtype
- service subtype see draft-cheshire-dnsext-dns-sd-06.txt chapter 7.1 Selective Instance Enumerationport
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.text
- bytes describing the servicepublic static ServiceInfo create(java.util.Map<ServiceInfo.Fields,java.lang.String> qualifiedNameMap, int port, int weight, int priority, boolean persistent, java.util.Map<java.lang.String,?> props)
qualifiedNameMap
- dictionary of values to build the fully qualified service name. Mandatory keys are Application and Instance. The Domain default is local, the Protocol default is tcp and the subtype default is none.port
- the local port on which the service runsweight
- weight of the servicepriority
- priority of the servicepersistent
- if true
ServiceListener.resolveService will be called whenever new new information is received.props
- properties describing the servicepublic abstract boolean hasData()
true
if the service info has data, false
otherwise.public abstract java.lang.String getType()
_http._tcp.local.
public abstract java.lang.String getTypeWithSubtype()
_printer._sub._http._tcp.local.
public abstract java.lang.String getName()
foobar
.public abstract java.lang.String getKey()
public abstract java.lang.String getQualifiedName()
foobar._http._tcp.local.
.public abstract java.lang.String getServer()
@Deprecated public abstract java.lang.String getHostAddress()
getHostAddresses()
public abstract java.lang.String[] getHostAddresses()
@Deprecated public abstract java.net.InetAddress getAddress()
getInetAddresses()
@Deprecated public abstract java.net.InetAddress getInetAddress()
getInetAddresses()
@Deprecated public abstract java.net.Inet4Address getInet4Address()
getInet4Addresses()
@Deprecated public abstract java.net.Inet6Address getInet6Address()
getInet6Addresses()
public abstract java.net.InetAddress[] getInetAddresses()
In a multi-homed environment service info can be associated with more than one address.
public abstract java.net.Inet4Address[] getInet4Addresses()
In a multi-homed environment service info can be associated with more than one address.
public abstract java.net.Inet6Address[] getInet6Addresses()
In a multi-homed environment service info can be associated with more than one address.
public abstract int getPort()
public abstract int getPriority()
public abstract int getWeight()
public abstract byte[] getTextBytes()
@Deprecated public abstract java.lang.String getTextString()
getPropertyNames()
,
getPropertyBytes(String)
,
getPropertyString(String)
@Deprecated public abstract java.lang.String getURL()
getURLs()
public abstract java.lang.String[] getURLs()
@Deprecated public abstract java.lang.String getURL(java.lang.String protocol)
protocol
- requested protocolgetURLs()
public abstract java.lang.String[] getURLs(java.lang.String protocol)
protocol
- requested protocolpublic abstract byte[] getPropertyBytes(java.lang.String name)
name
- property namepublic abstract java.lang.String getPropertyString(java.lang.String name)
name
- property namepublic abstract java.util.Enumeration<java.lang.String> getPropertyNames()
public abstract java.lang.String getNiceTextString()
public abstract void setText(byte[] text) throws java.lang.IllegalStateException
text
- the raw byte representation of the text field.java.lang.IllegalStateException
- if attempting to set the text for a non persistent service info.public abstract void setText(java.util.Map<java.lang.String,?> props) throws java.lang.IllegalStateException
props
- a key=value map that will be encoded into raw bytes.java.lang.IllegalStateException
- if attempting to set the text for a non persistent service info.public abstract boolean isPersistent()
true
if ServiceListener.resolveService will be called whenever new new information is received.public abstract java.lang.String getDomain()
public abstract java.lang.String getProtocol()
public abstract java.lang.String getApplication()
public abstract java.lang.String getSubtype()
public abstract java.util.Map<ServiceInfo.Fields,java.lang.String> getQualifiedNameMap()
public ServiceInfo clone()
clone
in class java.lang.Object