public byte[] serialize() {
String username = getUsername();
StringBuffer temp = new StringBuffer(0x70 - (0x3));
temp.append(username);
while (temp.length() < 0x70 - 0x3)
{
temp.append(
" "); // (70 = fixed lenght -3 = the overhead bits of unicode string)
}
username = temp.toString();
UnicodeString str = new UnicodeString();
str.setString(username);
str.setOptionFlags(( byte ) 0x0);
str.setCharCount(( short ) 0x4);
byte[] stringbytes = str.serialize();
byte[] retval = new byte[ 116 ]; // 0x70 +4
LittleEndian.putShort(retval, 0, sid);
LittleEndian.putShort(retval, 2,
( short ) (stringbytes
.length)); // 112 bytes (115 total)
System.arraycopy(stringbytes, 0, retval, 4, stringbytes.length);
return retval;
}
|