Package javax.jmdns.impl.util
Class ByteWrangler
java.lang.Object
javax.jmdns.impl.util.ByteWrangler
This class contains all the byte shifting
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
Name for charset used to convert Strings to/from wire bytes: "UTF-8".private static final Charset
Charset used to convert Strings to/from wire bytes: "UTF-8".static final byte[]
Representation of empty text.private static org.slf4j.Logger
static final int
Maximum number of bytes record data can consist of.static final int
Maximum number of bytes a value can consist of.static final byte[]
Representation of no value. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
encodeText
(String text) static void
readProperties
(Map<String, byte[]> properties, byte[] textBytes) static String
readUTF
(byte[] data) Read data bytes as "UTF-8" to String.static String
readUTF
(byte[] data, int off, int len) Read data bytes as "UTF-8" to String.static byte[]
textFromProperties
(Map<String, ?> props) static void
writeUTF
(OutputStream out, String str) Write a String as "UTF-8" encoded bytes to a stream.
-
Field Details
-
logger
private static org.slf4j.Logger logger -
MAX_VALUE_LENGTH
public static final int MAX_VALUE_LENGTHMaximum number of bytes a value can consist of.- See Also:
-
MAX_DATA_LENGTH
public static final int MAX_DATA_LENGTHMaximum number of bytes record data can consist of. It isMAX_VALUE_LENGTH
+ 1 because the first byte contains the number of the following bytes.- See Also:
-
NO_VALUE
public static final byte[] NO_VALUERepresentation of no value. A zero length array of bytes. -
EMPTY_TXT
public static final byte[] EMPTY_TXTRepresentation of empty text. The first byte denotes the length of the following character bytes (in this case zero.) FIXME: Should this be exported as a method since it could change externally??? -
CHARSET_NAME
Name for charset used to convert Strings to/from wire bytes: "UTF-8".- See Also:
-
CHARSET_UTF_8
Charset used to convert Strings to/from wire bytes: "UTF-8".
-
-
Constructor Details
-
ByteWrangler
public ByteWrangler()
-
-
Method Details
-
writeUTF
Write a String as "UTF-8" encoded bytes to a stream.- Throws:
IOException
-
readUTF
Read data bytes as "UTF-8" to String. -
readUTF
Read data bytes as "UTF-8" to String. -
readProperties
- Throws:
Exception
-
textFromProperties
-
encodeText
- Throws:
IOException
-