j_waste.network
Class SearchReplyPacket

java.lang.Object
  extended byj_waste.network.Packet
      extended byj_waste.network.HeadedPacket
          extended byj_waste.network.SearchReplyPacket
All Implemented Interfaces:
NetworkConstants

public class SearchReplyPacket
extends HeadedPacket

This is the class for the Search reply packet type.

Version:
0.1
Author:
Fredrik Hultin (frehul@users.sourceforge.net)

Field Summary
 
Fields inherited from class j_waste.network.HeadedPacket
iscomplete, packetData, padBytes
 
Fields inherited from class j_waste.network.Packet
packet
 
Fields inherited from interface j_waste.network.NetworkConstants
ABORT, CAP_BANDWIDTH, CAP_REMOTE_IP, CAP_SATURATION, GENERAL_TYPE_BROADCAST, GENERAL_TYPE_LOCAL, GENERAL_TYPE_ROUTED, HEADER_SIZE, MAX_BROADCAST_SIZE, MAX_ROUTED_SIZE, NO_ABORT, PREMATURE_ABORT, PRIO_CHAT, PRIO_CHAT_REPLY, PRIO_FILE_REQ_REPLY, PRIO_FILE_REQUEST, PRIO_KEYDIST, PRIO_KEYDIST_REPLY, PRIO_LCAPS, PRIO_LOCAL_SATURATE, PRIO_PING, PRIO_SEARCH, PRIO_SEARCH_REPLY, PRIO_SEARCH_USERLIST, PRIO_UPLOAD, TYPE_CHAT, TYPE_CHAT_REPLY, TYPE_FILE_REQ_REPLY, TYPE_FILE_REQUEST, TYPE_KEYDIST, TYPE_KEYDIST_REPLY, TYPE_LCAPS, TYPE_LOCAL_SATURATE, TYPE_PING, TYPE_SEARCH, TYPE_SEARCH_REPLY, TYPE_SEARCH_USERLIST, TYPE_UPLOAD
 
Constructor Summary
SearchReplyPacket(byte[] guid, boolean localSearch)
          Base constructor of the SearchPacket class.
 
Method Summary
 void finalizePacket()
          Finalizes this SearchReplyPacket.
 void setItem(java.io.File file, int id)
          This method will set an item in the SearchReplyPacket from the "file" parameter given to this method.
 void setItem(java.lang.String metaData, int numFiles, int shareSize)
          This method will set an item in the SearchReplyPacket with the specified meta data.
 byte[] toByteArray()
          Returns a byte array representation of this packet.
 
Methods inherited from class j_waste.network.HeadedPacket
createPacket, getData, getGeneralType, getGUID, getHeader, getIntPrio, getIntType, getLength, getMD5, getPrio, getTTL, getType, setLength, setTTL
 
Methods inherited from class j_waste.network.Packet
padCD, reverseBytes, reverseInt, reverseShort, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SearchReplyPacket

public SearchReplyPacket(byte[] guid,
                         boolean localSearch)
Base constructor of the SearchPacket class. Constructs an empty SearchPacket.

Parameters:
guid - The guid from the corresponding (incomming) search packet.
Method Detail

setItem

public void setItem(java.io.File file,
                    int id)
This method will set an item in the SearchReplyPacket from the "file" parameter given to this method.

Parameters:
file - The file/directory if this item.

setItem

public void setItem(java.lang.String metaData,
                    int numFiles,
                    int shareSize)
This method will set an item in the SearchReplyPacket with the specified meta data.

Parameters:
metaData - The meta data that will be used in this item.
numFiles - The number of files and directories that are shared at the moment.
shareSize - The size of the share in mega bytes (MB).

toByteArray

public byte[] toByteArray()
Returns a byte array representation of this packet.

Overrides:
toByteArray in class HeadedPacket
Returns:
a byte array representation of this packet.

finalizePacket

public void finalizePacket()
Finalizes this SearchReplyPacket.

Overrides:
finalizePacket in class HeadedPacket