javax.jmdns

Class ServiceInfo

Known Direct Subclasses:
ServiceInfoImpl

public abstract class ServiceInfo
extends java.lang.Object

Field Summary

static byte[]
NO_VALUE

Method Summary

static ServiceInfo
create(String type, String name, int port, String text)
Construct a service description for registrating with JmDNS.
static ServiceInfo
create(String type, String name, int port, int weight, int priority, Hashtable props)
Construct a service description for registrating with JmDNS.
static ServiceInfo
create(String type, String name, int port, int weight, int priority, String text)
Construct a service description for registrating with JmDNS.
static ServiceInfo
create(String type, String name, int port, int weight, int priority, text[] )
Construct a service description for registrating with JmDNS.
abstract InetAddress
getAddress()
abstract String
getHostAddress()
Get the host address of the service (ie X.X.X.X).
abstract InetAddress
getInetAddress()
Get the InetAddress of the service.
abstract String
getName()
Unqualified service instance name, such as foobar .
abstract String
getNiceTextString()
abstract int
getPort()
Get the port for the service.
abstract int
getPriority()
Get the priority of the service.
abstract byte[]
getPropertyBytes(String name)
Get a property of the service.
abstract Enumeration
getPropertyNames()
Enumeration of the property names.
abstract String
getPropertyString(String name)
Get a property of the service.
abstract String
getQualifiedName()
Fully qualified service name, such as foobar._http._tcp.local. .
abstract String
getServer()
Get the name of the server.
abstract byte[]
getTextBytes()
Get the text for the serivce as raw bytes.
abstract String
getTextString()
Get the text for the service.
abstract String
getType()
Fully qualified service type name, such as _http._tcp.local. .
abstract String
getURL()
Get the URL for this service.
abstract String
getURL(String protocol)
Get the URL for this service.
abstract int
getWeight()
Get the weight of the service.

Field Details

NO_VALUE

public static final byte[] NO_VALUE

Method Details

create

public static ServiceInfo create(String type,
                                 String name,
                                 int port,
                                 String text)
Construct a service description for registrating with JmDNS.
Parameters:
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 runs
text - string describing the service

create

public static ServiceInfo create(String type,
                                 String name,
                                 int port,
                                 int weight,
                                 int priority,
                                 Hashtable props)
Construct a service description for registrating with JmDNS. The properties hashtable must map property names to either Strings or byte arrays describing the property values.
Parameters:
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 runs
weight - weight of the service
priority - priority of the service
props - properties describing the service

create

public static ServiceInfo create(String type,
                                 String name,
                                 int port,
                                 int weight,
                                 int priority,
                                 String text)
Construct a service description for registrating with JmDNS.
Parameters:
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 runs
weight - weight of the service
priority - priority of the service
text - string describing the service

create

public static ServiceInfo create(String type,
                                 String name,
                                 int port,
                                 int weight,
                                 int priority,
                                 text[] )
Construct a service description for registrating with JmDNS.
Parameters:
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 runs
weight - weight of the service
priority - priority of the service

getAddress

public abstract InetAddress getAddress()

getHostAddress

public abstract String getHostAddress()
Get the host address of the service (ie X.X.X.X).

getInetAddress

public abstract InetAddress getInetAddress()
Get the InetAddress of the service.

getName

public abstract String getName()
Unqualified service instance name, such as foobar .

getNiceTextString

public abstract String getNiceTextString()

getPort

public abstract int getPort()
Get the port for the service.

getPriority

public abstract int getPriority()
Get the priority of the service.

getPropertyBytes

public abstract byte[] getPropertyBytes(String name)
Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found or the text data could not be decoded correctly.

getPropertyNames

public abstract Enumeration getPropertyNames()
Enumeration of the property names.

getPropertyString

public abstract String getPropertyString(String name)
Get a property of the service. This involves decoding the text bytes into a property list. Returns null if the property is not found, the text data could not be decoded correctly, or the resulting bytes are not a valid UTF8 string.

getQualifiedName

public abstract String getQualifiedName()
Fully qualified service name, such as foobar._http._tcp.local. .

getServer

public abstract String getServer()
Get the name of the server.

getTextBytes

public abstract byte[] getTextBytes()
Get the text for the serivce as raw bytes.

getTextString

public abstract String getTextString()
Get the text for the service. This will interpret the text bytes as a UTF8 encoded string. Will return null if the bytes are not a valid UTF8 encoded string.

getType

public abstract String getType()
Fully qualified service type name, such as _http._tcp.local. .

getURL

public abstract String getURL()
Get the URL for this service. An http URL is created by combining the address, port, and path properties.

getURL

public abstract String getURL(String protocol)
Get the URL for this service. An URL is created by combining the protocol, address, port, and path properties.

getWeight

public abstract int getWeight()
Get the weight of the service.