com.kenmccrary.jtella
Class SearchReplyMessage

java.lang.Object
  |
  +--com.kenmccrary.jtella.Message
        |
        +--com.kenmccrary.jtella.SearchReplyMessage

public class SearchReplyMessage
extends com.kenmccrary.jtella.Message

Search Reply message(QUERY HIT), response to a search request


Inner Class Summary
static class SearchReplyMessage.FileRecord
          Represents information about a single file served
 
Field Summary
protected  GUID guid
           
protected  byte hops
           
protected  Connection originatingConnection
           
protected  short[] payload
           
protected  int payloadSize
           
static int SIZE
           
protected  byte ttl
           
protected  short type
           
 
Constructor Summary
SearchReplyMessage(SearchMessage searchMessage, short port, java.lang.String ipAddress, int speed)
          Used to respond to a query message
SearchReplyMessage(SearchMessage searchMessage, short port, java.lang.String ipAddress, int speed, java.lang.String vendorCode)
          Used to respond to a query message
 
Method Summary
 void addFileRecord(SearchReplyMessage.FileRecord fileRecord)
          Adds a file record.
 GUID getClientIdentifier()
          Retrieve the client GUID for the replying servant
 int getDownloadSpeed()
          Returns the replying host's connection bandwidth
 int getFileCount()
          Query the umber of files found for the search
 SearchReplyMessage.FileRecord getFileRecord(int index)
          Get information about the files found
 java.lang.String getIPAddress()
          Query the IP address for this pong message result is an IP address in the form of "206.26.48.100".
 Connection getOriginatingConnection()
          Get the connection that was the source for this message
 int getPort()
          Query the port for this search reply
 java.lang.String getVendorCode()
          Retrieve the vendor code for the responding servant
 java.lang.String toRawString()
          Returns a String containing the flattened message
 java.lang.String toString()
          String representation of the message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE

originatingConnection

protected Connection originatingConnection

guid

protected GUID guid

type

protected short type

ttl

protected byte ttl

hops

protected byte hops

payload

protected short[] payload

payloadSize

protected int payloadSize
Constructor Detail

SearchReplyMessage

public SearchReplyMessage(SearchMessage searchMessage,
                          short port,
                          java.lang.String ipAddress,
                          int speed)
Used to respond to a query message
Parameters:
searchMessage - the search thats being responded to
port - the point used for download
ipAddress - of the servant
speed - download speed in kilobytes/sec

SearchReplyMessage

public SearchReplyMessage(SearchMessage searchMessage,
                          short port,
                          java.lang.String ipAddress,
                          int speed,
                          java.lang.String vendorCode)
Used to respond to a query message
Parameters:
searchMessage - the search thats being responded to
port - the point used for download
ipAddress - of the servant
speed - download speed in kilobytes/sec
vendorCode - option 4 byte value identifying the servant vendor
Method Detail

getFileCount

public int getFileCount()
Query the umber of files found for the search

getPort

public int getPort()
Query the port for this search reply
Returns:
port

getIPAddress

public java.lang.String getIPAddress()
Query the IP address for this pong message result is an IP address in the form of "206.26.48.100".
Returns:
IP address

getDownloadSpeed

public int getDownloadSpeed()
Returns the replying host's connection bandwidth
Returns:
download speed, in kilobytes/sec

addFileRecord

public void addFileRecord(SearchReplyMessage.FileRecord fileRecord)
Adds a file record. This is for originating a message for a query hit
Parameters:
fileRecord - file information

getFileRecord

public SearchReplyMessage.FileRecord getFileRecord(int index)
Get information about the files found

getClientIdentifier

public GUID getClientIdentifier()
Retrieve the client GUID for the replying servant
Returns:
client GUID

getVendorCode

public java.lang.String getVendorCode()
Retrieve the vendor code for the responding servant
Returns:
vendor code or NONE if the code is not present

toString

public java.lang.String toString()
String representation of the message
Overrides:
toString in class java.lang.Object

toRawString

public java.lang.String toRawString()
Returns a String containing the flattened message
Returns:
message string

getOriginatingConnection

public Connection getOriginatingConnection()
Get the connection that was the source for this message
Returns:
originating connection or null if this Message was not read from the network