|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectOldIconHashInfo
A data structure containing a set of information about a buddy icon. This is
called "old" icon hash data because of the new buddy icon system (the
0x10
service).
Note that this data structure is stored in two separate formats in the
OSCAR protocol. The first is when "advertising" one's buddy icon in an
IM and the second is when sending one's icon to another user in a rendezvous
packet. Accordingly, are two pairs of read*
and
write*
methods for reading from and writing to these two
formats.
Constructor Summary | |
|
OldIconHashInfo(java.io.File file)
Creates an old icon hash block from the contents, size, and last-modified time of the given file. |
|
OldIconHashInfo(long size,
int sum,
long timestamp)
Creates a new icon hash data object with the given properties. |
protected |
OldIconHashInfo(long size,
int sum,
long timestamp,
int blockSize)
Creates a new icon hash data object with the given properties. |
Method Summary | |
static int |
computeIconSum(ByteBlock data)
Returns an "old icon sum" from the given buddy icon data. |
static int |
computeIconSum(java.io.InputStream in)
Returns an icon sum of all of the data in the given stream. |
int |
getHashBlockSize()
Returns the total size of the data structure from which this icon hash information object was read, or -1 if this block was not
read from an incoming block of binary data. |
long |
getIconSize()
Returns the file size of the icon, as sent in this object. |
int |
getImTlvFormatLength()
Returns the number of bytes that would be or have been written with a call to writeToImTlv . |
int |
getRvDataFormatLength()
Returns the number of bytes that would be or have been written with a call to writeToRvData . |
int |
getSum()
Returns an "icon sum" of the icon data, as sent in this object. |
long |
getTimestamp()
Returns the time at which the icon was modified, in seconds since the unix epoch, as sent in this object. |
static OldIconHashInfo |
readIconHashFromImTlvData(ByteBlock block)
Returns an icon hash data block read from the beginning of the given block of binary data. |
static OldIconHashInfo |
readIconHashFromRvData(ByteBlock block)
Returns an icon hash data block read from the beginning of the given block of binary data. |
java.lang.String |
toString()
|
void |
writeToImTlv(java.io.OutputStream out)
Writes this icon hash block to the given stream in the format normally used in advertising one's buddy icon in an IM. |
void |
writeToRvData(java.io.OutputStream out)
Writes this icon hash block to the given stream in the format normally used in sending one's buddy icon to a buddy in a SendBuddyIconRvCmd . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public OldIconHashInfo(java.io.File file) throws java.io.FileNotFoundException, java.io.IOException
file
- a buddy icon file
java.io.FileNotFoundException
- if the given file does not exist
java.io.IOException
- if an I/O error occurs (i.e., if the file cannot be
read)protected OldIconHashInfo(long size, int sum, long timestamp, int blockSize)
size
- the file size of the iconsum
- a hash of the icon datatimestamp
- the time at which the icon was modified last, in seconds
since the unix epochblockSize
- the total size of this object, in bytes, as read from an
incoming block of binary datapublic OldIconHashInfo(long size, int sum, long timestamp)
size
- the file size of the iconsum
- a hash of the icon datatimestamp
- the time at which the icon was modified last, in seconds
since the unix epochMethod Detail |
public static int computeIconSum(java.io.InputStream in) throws java.io.IOException
in
- a stream containing a buddy icon
java.io.IOException
- if an I/O exception occurspublic static int computeIconSum(ByteBlock data)
data
- the raw buddy icon data
OldIconHashData
public static OldIconHashInfo readIconHashFromImTlvData(ByteBlock block)
null
if the given block does
not contain a valid icon hash data block. Note that this method reads the
data using the format normally used in sending one's icon hash in an
IM.
block
- the block of data from which to read
null
if none could be readpublic static OldIconHashInfo readIconHashFromRvData(ByteBlock block)
null
if the given block does
not contain a valid icon hash data block. Note that this method reads the
data using the format normally used in sending one's icon hash along with
one's icon in a SendBuddyIconRvCmd
.
block
- the block of data from which to read
null
if none could be readpublic final long getIconSize()
public final int getSum()
public final long getTimestamp()
public int getHashBlockSize()
-1
if this block was not
read from an incoming block of binary data.
-1
if this
object was not read from an incoming block of binary datapublic void writeToImTlv(java.io.OutputStream out) throws java.io.IOException
out
- the stream to which to write this block
java.io.IOException
- if an I/O error occurspublic int getImTlvFormatLength()
writeToImTlv
.
public void writeToRvData(java.io.OutputStream out) throws java.io.IOException
SendBuddyIconRvCmd
.
out
- the stream to which to write this block
java.io.IOException
- if an I/O error occurspublic int getRvDataFormatLength()
writeToRvData
.
public java.lang.String toString()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |