|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectExtraInfoData
A data structure used to hold data in ExtraInfoBlock
s, containing
a set of flags and a block of data.
A few notes on flags:
FullUserInfo
):
FLAG_HASH_PRESENT
bit, the data field
is a buddy icon hash (in MD5 format). If the FLAG_HASH_PRESENT
bit is off,that user may not have an icon, and the data field will (normally)
be HASH_SPECIAL
. The significance of HASH_SPECIAL
is
unknown at the time of this writing. One should note that if the flags
include the FLAG_HASH_PRESENT
bit, the data block may still be
HASH_SPECIAL
. ExtraInfoAck
,
the flags FLAG_UPLOAD_ICON
or FLAG_ALREADY_HAVE_ICON
may be
present. If FLAG_UPLOAD_ICON
is present, the client should
upload the user's buddy icon to the buddy icon server (with an UploadIconCmd
. If
FLAG_ALREADY_HAVE_ICON
is present, the server has your buddy
icon cached and no further action is necessary. Normally, the
FLAG_ALREADY_HAVE_ICON
flag is accompanied by a
FLAG_HASH_PRESENT
flag; the FLAG_UPLOAD_ICON
flag
normally is the only flag set (if, of course, it is set). IconItem
:
FLAG_HASH_PRESENT
should be set
and the data block should be an MD5 hash of the icon. FLAG_DEFAULT
) and the data block should be #HASH_SPECIAL
.
FLAG_AVAILMSG_PRESENT
should be
set. The data should be as follows:
FLAG_HASH_PRESENT
flag is on, one
could use code such as the following:
if ((extraInfoData.getFlags() & ExtraInfoData.FLAG_HASH_PRESENT) != 0) { System.out.println("this extra info data block " + "contains a buddy icon MD5 hash!"); }
Field Summary | |
static int |
FLAG_ALREADY_HAVE_ICON
A flag indicating that the server already has a copy of your buddy icon. |
static int |
FLAG_AVAILMSG_PRESENT
A flag indicating that an iChat availability message is present. |
static int |
FLAG_DEFAULT
A flagset with no flags on ( 0x00 ). |
static int |
FLAG_HASH_PRESENT
A flag indicating that a hash (for example, an MD5 hash of the user's buddy icon) is present. |
static int |
FLAG_UPLOAD_ICON
A flag indicating that the client should upload its buddy icon. |
static ByteBlock |
HASH_SPECIAL
A "special" icon hash which appears to indicate that no icon has been set. |
Constructor Summary | |
ExtraInfoData(int flags,
ByteBlock data)
Creates a new extra info block object with the given flags and given data block. |
Method Summary | |
ByteBlock |
getData()
Returns the data stored in this extra info data block. |
int |
getFlags()
Returns the flags stored in this extra info data object. |
int |
getTotalSize()
Returns the size, in bytes, of this object, as read from a block of binary data. |
long |
getWritableLength()
Returns the length of the data that was or will be written in a call to write . |
static ExtraInfoData |
readExtraInfoData(ByteBlock block)
Reads an extra info data block from the given block of binary data. |
java.lang.String |
toString()
|
void |
write(java.io.OutputStream out)
Writes a representation of this object to the given stream. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int FLAG_DEFAULT
0x00
).
public static final int FLAG_HASH_PRESENT
public static final int FLAG_UPLOAD_ICON
public static final int FLAG_ALREADY_HAVE_ICON
FLAG_HASH_PRESENT
. See
above for details.
public static final int FLAG_AVAILMSG_PRESENT
public static final ByteBlock HASH_SPECIAL
Constructor Detail |
public ExtraInfoData(int flags, ByteBlock data) throws java.lang.IllegalArgumentException
BinaryTools.UBYTE_MAX
(255
) bytes.
flags
- a set of bit flags, like FLAG_AVAILMSG_PRESENT
data
- a block of data to store in this extra info data block
java.lang.IllegalArgumentException
- if data.length >
BinaryTools.UBYTE_MAX
Method Detail |
public static ExtraInfoData readExtraInfoData(ByteBlock block)
getTotalSize
on the returned object. Note that this will
return null
if no valid extra info data block can be read.
block
- the block containing an extra info data block
null
if no valid block could be readpublic final int getFlags()
FLAG_*
constants defined in this class. See
above for details on how to check for specific
flags.
public final ByteBlock getData()
public final int getTotalSize()
-1
if this object was not read from a
data block with readExtraInfoData
.
public long getWritableLength()
Writable
write
. The value returned by this method must not
change after its first invocation.
getWritableLength
in interface Writable
write
public void write(java.io.OutputStream out) throws java.io.IOException
Writable
getWritableLength
.
write
in interface Writable
out
- the stream to which to write
java.io.IOException
- if an I/O error occurspublic java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |