javax.jmdns.impl
Class ServiceInfoImpl

java.lang.Object
  extended by javax.jmdns.ServiceInfo
      extended by javax.jmdns.impl.ServiceInfoImpl

public class ServiceInfoImpl
extends ServiceInfo

JmDNS service information.


Field Summary
 
Fields inherited from class javax.jmdns.ServiceInfo
NO_VALUE
 
Constructor Summary
ServiceInfoImpl(java.lang.String type, java.lang.String name, int port, int weight, int priority, byte[] text)
           
ServiceInfoImpl(java.lang.String type, java.lang.String name, int port, int weight, int priority, java.util.Map<java.lang.String,?> props)
           
ServiceInfoImpl(java.lang.String type, java.lang.String name, int port, int weight, int priority, java.lang.String text)
           
ServiceInfoImpl(java.lang.String type, java.lang.String name, int port, java.lang.String text)
           
 
Method Summary
 void addAnswers(DNSOutgoing out, int ttl, HostInfo localHost)
           
 void advanceState()
          Sets the state and notifies all objects that wait on the ServiceInfo.
 boolean equals(java.lang.Object obj)
           
 java.net.InetAddress getAddress()
          Get the host address of the service.
 JmDNSImpl getDns()
           
 java.lang.String getHostAddress()
          Get the host address of the service (ie X.X.X.X).
 java.net.InetAddress getInetAddress()
          Get the InetAddress of the service.
 java.lang.String getName()
          Unqualified service instance name, such as foobar .
 java.lang.String getNiceTextString()
          Returns a description of the service info suitable for printing.
 int getPort()
          Get the port for the service.
 int getPriority()
          Get the priority of the service.
 byte[] getPropertyBytes(java.lang.String name)
          Get a property of the service.
 java.util.Enumeration<java.lang.String> getPropertyNames()
          Enumeration of the property names.
 java.lang.String getPropertyString(java.lang.String name)
          Get a property of the service.
 java.lang.String getQualifiedName()
          Fully qualified service name, such as foobar._http._tcp.local. .
 java.lang.String getServer()
          Get the name of the server.
 javax.jmdns.impl.constants.DNSState getState()
          Returns the current state of this info.
 java.util.TimerTask getTask()
           
 byte[] getText()
           
 byte[] getTextBytes()
          Get the text for the service as raw bytes.
 java.lang.String getTextString()
          Get the text for the service.
 java.lang.String getType()
          Fully qualified service type name, such as _http._tcp.local.
 java.lang.String getURL()
          Get the URL for this service.
 java.lang.String getURL(java.lang.String protocol)
          Get the URL for this service.
 int getWeight()
          Get the weight of the service.
 int hashCode()
           
 void setDns(JmDNSImpl dns)
           
 void setTask(java.util.TimerTask task)
           
 void setText(byte[] text)
           
 java.lang.String toString()
           
 void updateRecord(DNSCache dnsCache, long now, DNSEntry rec)
          JmDNS callback to update a DNS record.
 
Methods inherited from class javax.jmdns.ServiceInfo
create, create, create, create, hasData
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceInfoImpl

public ServiceInfoImpl(java.lang.String type,
                       java.lang.String name,
                       int port,
                       java.lang.String text)
Parameters:
type -
name -
port -
text -
See Also:
ServiceInfo.create(String, String, int, String)

ServiceInfoImpl

public ServiceInfoImpl(java.lang.String type,
                       java.lang.String name,
                       int port,
                       int weight,
                       int priority,
                       java.lang.String text)
Parameters:
type -
name -
port -
weight -
priority -
text -
See Also:
ServiceInfo.create(String, String, int, int, int, String)

ServiceInfoImpl

public ServiceInfoImpl(java.lang.String type,
                       java.lang.String name,
                       int port,
                       int weight,
                       int priority,
                       java.util.Map<java.lang.String,?> props)
Parameters:
type -
name -
port -
weight -
priority -
props -
See Also:
ServiceInfo.create(String, String, int, int, int, Map)

ServiceInfoImpl

public ServiceInfoImpl(java.lang.String type,
                       java.lang.String name,
                       int port,
                       int weight,
                       int priority,
                       byte[] text)
Parameters:
type -
name -
port -
weight -
priority -
text -
See Also:
ServiceInfo.create(String, String, int, int, int, byte[])
Method Detail

getType

public java.lang.String getType()
Description copied from class: ServiceInfo
Fully qualified service type name, such as _http._tcp.local.

Specified by:
getType in class ServiceInfo
Returns:
service type name
See Also:
ServiceInfo.getType()

getName

public java.lang.String getName()
Description copied from class: ServiceInfo
Unqualified service instance name, such as foobar .

Specified by:
getName in class ServiceInfo
Returns:
service name
See Also:
ServiceInfo.getName()

getQualifiedName

public java.lang.String getQualifiedName()
Description copied from class: ServiceInfo
Fully qualified service name, such as foobar._http._tcp.local. .

Specified by:
getQualifiedName in class ServiceInfo
Returns:
qualified service name
See Also:
ServiceInfo.getQualifiedName()

getServer

public java.lang.String getServer()
Description copied from class: ServiceInfo
Get the name of the server.

Specified by:
getServer in class ServiceInfo
Returns:
server name
See Also:
ServiceInfo.getServer()

getHostAddress

public java.lang.String getHostAddress()
Description copied from class: ServiceInfo
Get the host address of the service (ie X.X.X.X).

Specified by:
getHostAddress in class ServiceInfo
Returns:
host IP address
See Also:
ServiceInfo.getHostAddress()

getAddress

public java.net.InetAddress getAddress()
Description copied from class: ServiceInfo
Get the host address of the service.

Specified by:
getAddress in class ServiceInfo
Returns:
host Internet address

getInetAddress

public java.net.InetAddress getInetAddress()
Description copied from class: ServiceInfo
Get the InetAddress of the service.

Specified by:
getInetAddress in class ServiceInfo
Returns:
Internet address

getPort

public int getPort()
Description copied from class: ServiceInfo
Get the port for the service.

Specified by:
getPort in class ServiceInfo
Returns:
service port
See Also:
ServiceInfo.getPort()

getPriority

public int getPriority()
Description copied from class: ServiceInfo
Get the priority of the service.

Specified by:
getPriority in class ServiceInfo
Returns:
service priority
See Also:
ServiceInfo.getPriority()

getWeight

public int getWeight()
Description copied from class: ServiceInfo
Get the weight of the service.

Specified by:
getWeight in class ServiceInfo
Returns:
service weight
See Also:
ServiceInfo.getWeight()

getTextBytes

public byte[] getTextBytes()
Description copied from class: ServiceInfo
Get the text for the service as raw bytes.

Specified by:
getTextBytes in class ServiceInfo
Returns:
raw service text
See Also:
ServiceInfo.getTextBytes()

getTextString

public java.lang.String getTextString()
Description copied from class: ServiceInfo
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.

Specified by:
getTextString in class ServiceInfo
Returns:
service text
See Also:
ServiceInfo.getTextString()

getURL

public java.lang.String getURL()
Description copied from class: ServiceInfo
Get the URL for this service. An http URL is created by combining the address, port, and path properties.

Specified by:
getURL in class ServiceInfo
Returns:
service URL
See Also:
ServiceInfo.getURL()

getURL

public java.lang.String getURL(java.lang.String protocol)
Description copied from class: ServiceInfo
Get the URL for this service. An URL is created by combining the protocol, address, port, and path properties.

Specified by:
getURL in class ServiceInfo
Parameters:
protocol - requested protocol
Returns:
service URL
See Also:
ServiceInfo.getURL(java.lang.String)

getPropertyBytes

public byte[] getPropertyBytes(java.lang.String name)
Description copied from class: ServiceInfo
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.

Specified by:
getPropertyBytes in class ServiceInfo
Parameters:
name - property name
Returns:
raw property text

getPropertyString

public java.lang.String getPropertyString(java.lang.String name)
Description copied from class: ServiceInfo
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.

Specified by:
getPropertyString in class ServiceInfo
Parameters:
name - property name
Returns:
property text

getPropertyNames

public java.util.Enumeration<java.lang.String> getPropertyNames()
Description copied from class: ServiceInfo
Enumeration of the property names.

Specified by:
getPropertyNames in class ServiceInfo
Returns:
property name enumeration

updateRecord

public void updateRecord(DNSCache dnsCache,
                         long now,
                         DNSEntry rec)
JmDNS callback to update a DNS record.

Parameters:
dnsCache -
now -
rec -

advanceState

public void advanceState()
Sets the state and notifies all objects that wait on the ServiceInfo.


getState

public javax.jmdns.impl.constants.DNSState getState()
Returns the current state of this info.

Returns:
current state

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

getNiceTextString

public java.lang.String getNiceTextString()
Description copied from class: ServiceInfo
Returns a description of the service info suitable for printing.

Specified by:
getNiceTextString in class ServiceInfo
Returns:
service info description

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

addAnswers

public void addAnswers(DNSOutgoing out,
                       int ttl,
                       HostInfo localHost)
                throws java.io.IOException
Throws:
java.io.IOException

setTask

public void setTask(java.util.TimerTask task)

getTask

public java.util.TimerTask getTask()

setText

public void setText(byte[] text)

getText

public byte[] getText()

setDns

public void setDns(JmDNSImpl dns)

getDns

public JmDNSImpl getDns()