javax.jmdns
Class ServiceInfo

java.lang.Object
  extended by javax.jmdns.ServiceInfo
Direct Known Subclasses:
ServiceInfoImpl

public abstract class ServiceInfo
extends java.lang.Object


Field Summary
static byte[] NO_VALUE
           
 
Constructor Summary
ServiceInfo()
           
 
Method Summary
static ServiceInfo create(java.lang.String type, java.lang.String name, int port, int weight, int priority, byte[] text)
          Construct a service description for registrating 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 registrating 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 registrating with JmDNS.
static ServiceInfo create(java.lang.String type, java.lang.String name, int port, java.lang.String text)
          Construct a service description for registrating with JmDNS.
abstract  java.net.InetAddress getAddress()
          Get the host address of the service.
abstract  java.lang.String getHostAddress()
          Get the host address of the service (ie X.X.X.X).
abstract  java.net.InetAddress getInetAddress()
          Get the InetAddress of the service.
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 getQualifiedName()
          Fully qualified service name, such as foobar._http._tcp.local. .
abstract  java.lang.String getServer()
          Get the name of the server.
abstract  byte[] getTextBytes()
          Get the text for the service as raw bytes.
abstract  java.lang.String getTextString()
          Get the text for the service.
abstract  java.lang.String getType()
          Fully qualified service type name, such as _http._tcp.local.
abstract  java.lang.String getURL()
          Get the URL for this service.
abstract  java.lang.String getURL(java.lang.String protocol)
          Get the URL for this service.
abstract  int getWeight()
          Get the weight of the service.
 boolean hasData()
          Returns true if the service info is filled with data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_VALUE

public static final byte[] NO_VALUE
Constructor Detail

ServiceInfo

public ServiceInfo()
Method Detail

create

public static ServiceInfo create(java.lang.String type,
                                 java.lang.String name,
                                 int port,
                                 java.lang.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
Returns:
new service info

create

public 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 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
Returns:
new service info

create

public 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 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
Returns:
new service info

create

public static ServiceInfo create(java.lang.String type,
                                 java.lang.String name,
                                 int port,
                                 int weight,
                                 int priority,
                                 byte[] 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 - bytes describing the service
Returns:
new service info

hasData

public boolean hasData()
Returns true if the service info is filled with data.

Returns:
true if the service info has data, false otherwise.

getType

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

Returns:
service type name

getName

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

Returns:
service name

getQualifiedName

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

Returns:
qualified service name

getServer

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

Returns:
server name

getHostAddress

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

Returns:
host IP address

getAddress

public abstract java.net.InetAddress getAddress()
Get the host address of the service.

Returns:
host Internet address

getInetAddress

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

Returns:
Internet address

getPort

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

Returns:
service port

getPriority

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

Returns:
service priority

getWeight

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

Returns:
service weight

getTextBytes

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

Returns:
raw service text

getTextString

public abstract java.lang.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.

Returns:
service text

getURL

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

Returns:
service URL

getURL

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

Parameters:
protocol - requested protocol
Returns:
service URL

getPropertyBytes

public abstract byte[] getPropertyBytes(java.lang.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.

Parameters:
name - property name
Returns:
raw property text

getPropertyString

public abstract java.lang.String getPropertyString(java.lang.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.

Parameters:
name - property name
Returns:
property text

getPropertyNames

public abstract java.util.Enumeration<java.lang.String> getPropertyNames()
Enumeration of the property names.

Returns:
property name enumeration

getNiceTextString

public abstract java.lang.String getNiceTextString()
Returns a description of the service info suitable for printing.

Returns:
service info description