org.tranche.servers
Class ServerMessageDownEvent

java.lang.Object
  extended by org.tranche.servers.ServerEvent
      extended by org.tranche.servers.ServerMessageEvent
          extended by org.tranche.servers.ServerMessageDownEvent

public class ServerMessageDownEvent
extends ServerMessageEvent

Representation of a message being received from a server.

Author:
James "Augie" Hill - augman85@gmail.com

Field Summary
static int TYPE_COMPLETED
          Code for a completed download message.
static int TYPE_FAILED
          Code for a failed download message.
static int TYPE_PROGRESS
          Code for progress on a download message.
static int TYPE_STARTED
          Code for a started download message.
 
Fields inherited from class org.tranche.servers.ServerEvent
AUTO_BAN, AUTO_UNBAN, CALLBACK, CONNECT, MESSAGE, USER_BAN, USER_UNBAN
 
Constructor Summary
ServerMessageDownEvent(java.lang.String url, long callbackId, int type)
           
ServerMessageDownEvent(java.lang.String url, long callbackId, int type, long bytesToDownload)
           
ServerMessageDownEvent(java.lang.String url, long callbackId, int type, long bytesToDownload, long bytesDownloaded)
           
 
Method Summary
 long getBytesDownloaded()
          Gets the number of bytes that have been downloaded.
 long getBytesToDownload()
          Gets the number of bytes that are to be downloaded.
 int getType()
          Returns the type code.
 java.lang.String getTypeString()
          Returns the type in a human-readable format.
 java.lang.String toString()
          Gets a human-readable description of this event.
 
Methods inherited from class org.tranche.servers.ServerMessageEvent
getCallbackId
 
Methods inherited from class org.tranche.servers.ServerEvent
getTimestamp, getUrl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE_STARTED

public static final int TYPE_STARTED

Code for a started download message.

See Also:
Constant Field Values

TYPE_PROGRESS

public static final int TYPE_PROGRESS

Code for progress on a download message.

See Also:
Constant Field Values

TYPE_COMPLETED

public static final int TYPE_COMPLETED

Code for a completed download message.

See Also:
Constant Field Values

TYPE_FAILED

public static final int TYPE_FAILED

Code for a failed download message.

See Also:
Constant Field Values
Constructor Detail

ServerMessageDownEvent

public ServerMessageDownEvent(java.lang.String url,
                              long callbackId,
                              int type)
Parameters:
url -
callbackId -
type -

ServerMessageDownEvent

public ServerMessageDownEvent(java.lang.String url,
                              long callbackId,
                              int type,
                              long bytesToDownload)
Parameters:
url -
callbackId -
type -
bytesToDownload -

ServerMessageDownEvent

public ServerMessageDownEvent(java.lang.String url,
                              long callbackId,
                              int type,
                              long bytesToDownload,
                              long bytesDownloaded)
Parameters:
url -
callbackId -
type -
bytesToDownload -
bytesDownloaded -
Method Detail

getType

public int getType()

Returns the type code.

Overrides:
getType in class ServerEvent
Returns:

getTypeString

public java.lang.String getTypeString()

Returns the type in a human-readable format.

Overrides:
getTypeString in class ServerEvent
Returns:

getBytesToDownload

public long getBytesToDownload()

Gets the number of bytes that are to be downloaded.

Returns:

getBytesDownloaded

public long getBytesDownloaded()

Gets the number of bytes that have been downloaded.

Returns:

toString

public java.lang.String toString()

Gets a human-readable description of this event.

Overrides:
toString in class ServerMessageEvent
Returns:


This code is free for use both commercially and non-commercially as stated in the project's license