org.livetribe.slp.spi.msg
Class BytesBlock

java.lang.Object
  extended by org.livetribe.slp.spi.msg.BytesBlock
Direct Known Subclasses:
AuthenticationBlock, Extension, Message, URLEntry

public class BytesBlock
extends Object

Version:
$Rev: 130 $ $Date: 2006-05-23 23:45:17 +0200 (Tue, 23 May 2006) $

Field Summary
protected static byte[] EMPTY_BYTES
           
protected static String[] EMPTY_STRINGS
           
 
Constructor Summary
BytesBlock()
           
 
Method Summary
protected static String escape(String value)
           
protected static int readInt(byte[] bytes, int offset, int length)
          Reads an integer from bytes in network byte order.
protected static String readString(byte[] bytes, int offset, int length)
           
protected static String[] readStringArray(byte[] bytes, int offset, int length)
           
protected static byte[] stringToUTF8Bytes(String value)
           
protected static String unescape(String value)
           
protected static String utf8BytesToString(byte[] bytes, int offset, int length)
           
protected static void writeInt(int value, byte[] bytes, int offset, int length)
          Writes an integer value to bytes in network byte order
protected static byte[] writeString(String value)
           
protected static byte[] writeStringArray(String[] value)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_BYTES

protected static final byte[] EMPTY_BYTES

EMPTY_STRINGS

protected static final String[] EMPTY_STRINGS
Constructor Detail

BytesBlock

public BytesBlock()
Method Detail

readInt

protected static int readInt(byte[] bytes,
                             int offset,
                             int length)
Reads an integer from bytes in network byte order.

Parameters:
bytes - The bytes from where the integer value is read
offset - The offset in bytes from where to start reading the integer
length - The number of bytes to read
Returns:
The integer value read

writeInt

protected static void writeInt(int value,
                               byte[] bytes,
                               int offset,
                               int length)
Writes an integer value to bytes in network byte order

Parameters:
value - The integer value to write
bytes - The bytes where the integer value is written to
offset - The offset in bytesfrom where to start writing the integer
length - The number of bytes to write

readString

protected static String readString(byte[] bytes,
                                   int offset,
                                   int length)
                            throws ServiceLocationException
Throws:
ServiceLocationException

writeString

protected static byte[] writeString(String value)
                             throws ServiceLocationException
Throws:
ServiceLocationException

readStringArray

protected static String[] readStringArray(byte[] bytes,
                                          int offset,
                                          int length)
                                   throws ServiceLocationException
Throws:
ServiceLocationException

writeStringArray

protected static byte[] writeStringArray(String[] value)
                                  throws ServiceLocationException
Throws:
ServiceLocationException

stringToUTF8Bytes

protected static byte[] stringToUTF8Bytes(String value)
                                   throws ServiceLocationException
Throws:
ServiceLocationException

utf8BytesToString

protected static String utf8BytesToString(byte[] bytes,
                                          int offset,
                                          int length)
                                   throws ServiceLocationException
Throws:
ServiceLocationException

escape

protected static String escape(String value)

unescape

protected static String unescape(String value)
                          throws ServiceLocationException
Throws:
ServiceLocationException


Copyright © 2006-2012 LiveTribe. All Rights Reserved.