|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.apple.dnssd.TXTRecord
public class TXTRecord
Object used to construct and parse DNS-SD format TXT records. For more info see DNS-Based Service Discovery, section 6.
Constructor Summary | |
---|---|
TXTRecord()
Constructs a new, empty TXT record. |
|
TXTRecord(byte[] initBytes)
Constructs a new TXT record from a byte array in the standard format. |
Method Summary | |
---|---|
boolean |
contains(java.lang.String key)
Return true if key is present in the TXT record, false if not. |
java.lang.String |
getKey(int index)
Return a key in the TXT record by zero-based index. |
byte[] |
getRawBytes()
Return the contents of the TXT record as raw bytes. |
byte[] |
getValue(int index)
Look up a key in the TXT record by zero-based index and return its value. |
byte[] |
getValue(java.lang.String forKey)
Get the value associated with a key. |
java.lang.String |
getValueAsString(int index)
Converts the result of getValue() to a string in the platform default character set. |
java.lang.String |
getValueAsString(java.lang.String forKey)
Converts the result of getValue() to a string in the platform default character set. |
int |
remove(java.lang.String key)
Remove a key/value pair from the TXT record. |
void |
set(java.lang.String key,
byte[] value)
Set a key/value pair in the TXT record. |
void |
set(java.lang.String key,
java.lang.String value)
Set a key/value pair in the TXT record. |
int |
size()
Return the number of keys in the TXT record. |
java.lang.String |
toString()
Return a string representation of the object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public TXTRecord()
public TXTRecord(byte[] initBytes)
Method Detail |
---|
public void set(java.lang.String key, java.lang.String value)
key
- The key name. Must be ASCII, with no '=' characters.
value
- Value to be encoded into bytes using the default platform character set.public void set(java.lang.String key, byte[] value)
key
- The key name. Must be ASCII, with no '=' characters.
value
- Binary representation of the value.public int remove(java.lang.String key)
public int size()
public boolean contains(java.lang.String key)
public java.lang.String getKey(int index)
public byte[] getValue(int index)
Returns null if index exceeds the total number of keys. Returns null if the key is present with no value.
public java.lang.String getValueAsString(int index)
public byte[] getValue(java.lang.String forKey)
forKey
- The left-hand side of the key-value pair.
public java.lang.String getValueAsString(java.lang.String forKey)
forKey
- The left-hand side of the key-value pair.
public byte[] getRawBytes()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |