public class TransferInfo
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected long |
done
The done size.
|
protected boolean |
download
True for download, false for upload.
|
protected java.lang.String |
filename
The name of the local file (without path).
|
protected java.lang.String |
filepath
The full path of the local file (including filename).
|
protected java.lang.String |
id
The id.
|
protected long |
lastdone
The done size of the last update (for calculating speed).
|
protected long |
lastupdate
The time (millis) of the last update (for calculating speed).
|
protected IComponentIdentifier |
other
The ID of the component at the other side of the transfer (i.e.
|
protected long |
size
The size.
|
protected double |
speed
The upload/download speed calculated as dynamic moving average (bytes/sec).
|
protected java.lang.String |
state
The state.
|
static java.lang.String |
STATE_ABORTED
State when transfer was aborted by sending or receiving user.
|
static java.lang.String |
STATE_CANCELLING
State when cancel was requested.
|
static java.lang.String |
STATE_COMPLETED
State when transfer was successful.
|
static java.lang.String |
STATE_ERROR
State when transfer was stopped due to e.g.
|
static java.lang.String |
STATE_REJECTED
State when transfer was rejected by receiver.
|
static java.lang.String |
STATE_TRANSFERRING
State when transfer is in progress.
|
static java.lang.String |
STATE_WAITING
State waiting for acceptance.
|
protected long |
timeout
The absolute timeout value.
|
Constructor and Description |
---|
TransferInfo()
Create a new file transfer info.
|
TransferInfo(boolean download,
java.lang.String id,
java.lang.String filename,
java.lang.String filepath,
IComponentIdentifier other,
long size,
long timeout)
Create a new file transfer info.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Test for equality.
|
long |
getDone()
Get the done.
|
java.lang.String |
getFileName()
Get the name of the local file (without path).
|
java.lang.String |
getFilePath()
Get the full path of the local file (including filename).
|
java.lang.String |
getId()
Get the id.
|
IComponentIdentifier |
getOther()
Get the opposite component.
|
long |
getSize()
Get the size.
|
double |
getSpeed()
Get the speed.
|
java.lang.String |
getState()
Get the state.
|
long |
getTimeout()
Get the timeout.
|
int |
hashCode()
Get the hash code.
|
boolean |
isDownload()
Check if transfer is a download or upload.
|
boolean |
isFinished()
Check if transfer is finished.
|
void |
setDone(long done)
Set the done.
|
void |
setDownload(boolean download)
Set the transfer as a download or upload.
|
void |
setFileName(java.lang.String filename)
Set the name of the local file (without path).
|
void |
setFilePath(java.lang.String filepath)
Set the full path of the local file (including filename).
|
void |
setId(java.lang.String id)
Set the id.
|
void |
setOther(IComponentIdentifier other)
Set the opposite component.
|
void |
setSize(long size)
Set the size.
|
void |
setSpeed(double speed)
Set the speed.
|
void |
setState(java.lang.String state)
Set the state.
|
void |
setTimeout(long timeout)
Set the timeout.
|
boolean |
update(long done)
Update the transfer info.
|
public static final java.lang.String STATE_WAITING
public static final java.lang.String STATE_REJECTED
public static final java.lang.String STATE_TRANSFERRING
public static final java.lang.String STATE_CANCELLING
public static final java.lang.String STATE_COMPLETED
public static final java.lang.String STATE_ABORTED
public static final java.lang.String STATE_ERROR
protected boolean download
protected java.lang.String id
protected java.lang.String filename
protected java.lang.String filepath
protected IComponentIdentifier other
protected long size
protected java.lang.String state
protected long timeout
protected long done
protected double speed
protected long lastupdate
protected long lastdone
public TransferInfo()
public TransferInfo(boolean download, java.lang.String id, java.lang.String filename, java.lang.String filepath, IComponentIdentifier other, long size, long timeout)
public java.lang.String getFileName()
public void setFileName(java.lang.String filename)
filename
- The file name to set.public java.lang.String getFilePath()
public void setFilePath(java.lang.String filepath)
filepath
- The file pathto set.public IComponentIdentifier getOther()
public void setOther(IComponentIdentifier other)
other
- The CID to set.public long getSize()
public void setSize(long size)
size
- The size to set.public long getTimeout()
public void setTimeout(long timeout)
timeout
- The absolute timeout value to set.public long getDone()
public void setDone(long done)
done
- The done to set.public boolean update(long done)
done
- The done to set.public java.lang.String getId()
public void setId(java.lang.String id)
public java.lang.String getState()
public boolean isDownload()
public void setDownload(boolean download)
public double getSpeed()
public void setSpeed(double speed)
public void setState(java.lang.String state)
state
- The state to set.public boolean isFinished()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object