public class SpeedTestSocket extends java.lang.Object implements ISpeedTestSocket
| Constructor and Description |
|---|
SpeedTestSocket() |
SpeedTestSocket(int reportInterval)
Initialize global report interval value.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSpeedTestListener(ISpeedTestListener listener)
Add a speed test listener to list.
|
void |
clearListeners()
Clear all listeners.
|
void |
closeSocket()
Close socket streams and socket object.
|
void |
forceStopTask()
close mSocket + shutdown thread pool.
|
ComputationMethod |
getComputationMethod()
Get the computation method.
|
java.math.RoundingMode |
getDefaultRoundingMode()
Retrieve rounding mode used for BigDecimal.
|
int |
getDefaultScale()
Retrieve scale used for BigDecimal.
|
long |
getDownloadSetupTime()
Get download setup time value.
|
FtpMode |
getFtpMode()
Get FTP mode.
|
SpeedTestReport |
getLiveReport()
Get live report.
|
RepeatWrapper |
getRepeatWrapper()
retrieve repeat wrapper object used to manage repeating Download/upload tasks.
|
int |
getSocketTimeout()
get socket timeout in milliseconds ( 0 if no timeout not defined).
|
SpeedTestMode |
getSpeedTestMode()
retrieve current speed test mode.
|
int |
getUploadChunkSize()
retrieve size of each packet sent to upload server.
|
long |
getUploadSetupTime()
Get upload setup time value.
|
UploadStorageType |
getUploadStorageType()
Retrieve upload storage type (RAM or ROM).
|
void |
removeSpeedTestListener(ISpeedTestListener listener)
Relive a speed listener from list.
|
void |
setComputationMethod(ComputationMethod computationMethod)
Set computation method used to calculate transfer rate.
|
void |
setDefaultRoundingMode(java.math.RoundingMode roundingMode)
Set the default RoundingMode for BigDecimal.
|
void |
setDefaultScale(int scale)
Set the default scale for BigDecimal.
|
void |
setDownloadSetupTime(long setupTime)
Set the setup time for download.
|
void |
setFtpMode(FtpMode mode)
Set FTP mode passive or active.
|
boolean |
setProxyServer(java.lang.String proxyUrl)
Set proxy server for all DL/UL tasks.
|
void |
setSocketTimeout(int socketTimeoutMillis)
set socket timeout in millisecond.
|
void |
setUploadChunkSize(int uploadChunkSize)
set size of each packet sent to upload server.
|
void |
setUploadSetupTime(long setupTime)
Set the setup time for upload.
|
void |
setUploadStorageType(UploadStorageType uploadStorageType)
Set upload storage type.
|
void |
shutdownAndWait()
Shutdown threadpool and wait for task completion.
|
void |
startDownload(java.lang.String uri)
Start download process.
|
void |
startDownload(java.lang.String uri,
int reportInterval)
Start download process.
|
void |
startDownloadRepeat(java.lang.String uri,
int repeatWindow,
int reportPeriodMillis,
IRepeatListener repeatListener)
Start repeat download task.
|
void |
startDownloadRepeat(java.lang.String uri,
int repeatWindow,
IRepeatListener repeatListener)
Start repeat download task.
|
void |
startFixedDownload(java.lang.String uri,
int maxDuration)
Start download process with a fixed duration.
|
void |
startFixedDownload(java.lang.String uri,
int maxDuration,
int reportInterval)
Start download process with a fixed duration.
|
void |
startFixedUpload(java.lang.String uri,
int fileSizeOctet,
int maxDuration)
Start upload process.
|
void |
startFixedUpload(java.lang.String uri,
int fileSizeOctet,
int maxDuration,
int reportInterval)
Start upload process.
|
void |
startUpload(java.lang.String uri,
int fileSizeOctet)
Start upload process.
|
void |
startUpload(java.lang.String uri,
int fileSizeOctet,
int reportInterval)
Start upload process.
|
void |
startUploadRepeat(java.lang.String uri,
int repeatWindow,
int reportPeriodMillis,
int fileSizeOctet,
IRepeatListener repeatListener)
Start repeat upload task.
|
void |
startUploadRepeat(java.lang.String uri,
int repeatWindow,
int fileSizeOctet,
IRepeatListener repeatListener)
Start repeat upload task.
|
public SpeedTestSocket()
public SpeedTestSocket(int reportInterval)
reportInterval - report value in millisecondspublic void addSpeedTestListener(ISpeedTestListener listener)
addSpeedTestListener in interface ISpeedTestSocketlistener - speed test listener to be addedpublic void removeSpeedTestListener(ISpeedTestListener listener)
removeSpeedTestListener in interface ISpeedTestSocketlistener - speed test listener to be removedpublic void shutdownAndWait()
shutdownAndWait in interface ISpeedTestSocketpublic void startFixedDownload(java.lang.String uri,
int maxDuration)
uri - uri to fetch to download filemaxDuration - maximum duration of the speed test in millisecondspublic void startFixedDownload(java.lang.String uri,
int maxDuration,
int reportInterval)
uri - uri to fetch to download filemaxDuration - maximum duration of the speed test in millisecondsreportInterval - report interval in millisecondspublic void startDownload(java.lang.String uri,
int reportInterval)
uri - uri to fetch to download filereportInterval - report interval in millisecondspublic void startDownload(java.lang.String uri)
startDownload in interface ISpeedTestSocketuri - uri to fetch to download filepublic boolean setProxyServer(java.lang.String proxyUrl)
setProxyServer in interface ISpeedTestSocketproxyUrl - proxy URLpublic void startFixedUpload(java.lang.String uri,
int fileSizeOctet,
int maxDuration)
uri - uri to fetchfileSizeOctet - size of file to uploadmaxDuration - maximum duration of speed test in millisecondspublic void startFixedUpload(java.lang.String uri,
int fileSizeOctet,
int maxDuration,
int reportInterval)
uri - uri to fetchfileSizeOctet - size of file to uploadmaxDuration - maximum duration of speed test in millisecondsreportInterval - report interval in millisecondspublic void startUpload(java.lang.String uri,
int fileSizeOctet,
int reportInterval)
uri - uri to fetchfileSizeOctet - size of file to uploadreportInterval - report interval in millisecondspublic void startUpload(java.lang.String uri,
int fileSizeOctet)
startUpload in interface ISpeedTestSocketuri - uri to fetchfileSizeOctet - size of file to uploadpublic void startDownloadRepeat(java.lang.String uri,
int repeatWindow,
IRepeatListener repeatListener)
uri - uri to fetch to download filerepeatWindow - time window for the repeated download in millisecondsrepeatListener - listener for download repeat task completion & reportspublic void startDownloadRepeat(java.lang.String uri,
int repeatWindow,
int reportPeriodMillis,
IRepeatListener repeatListener)
uri - uri to fetch to download filerepeatWindow - time window for the repeated download in millisecondsreportPeriodMillis - time interval between each report in millisecondsrepeatListener - listener for download repeat task completion & reportspublic void startUploadRepeat(java.lang.String uri,
int repeatWindow,
int fileSizeOctet,
IRepeatListener repeatListener)
uri - uri to fetch to download filerepeatWindow - time window for the repeated upload in millisecondsfileSizeOctet - file size in octetrepeatListener - listener for upload repeat task completion & reportspublic void startUploadRepeat(java.lang.String uri,
int repeatWindow,
int reportPeriodMillis,
int fileSizeOctet,
IRepeatListener repeatListener)
uri - uri to fetch to download filerepeatWindow - time window for the repeated upload in millisecondsreportPeriodMillis - time interval between each report in millisecondsfileSizeOctet - file size in octetrepeatListener - listener for upload repeat task completion & reportspublic void forceStopTask()
forceStopTask in interface ISpeedTestSocketpublic SpeedTestReport getLiveReport()
getLiveReport in interface ISpeedTestSocketpublic void closeSocket()
ISpeedTestSocketcloseSocket in interface ISpeedTestSocketpublic SpeedTestMode getSpeedTestMode()
public void setSocketTimeout(int socketTimeoutMillis)
socketTimeoutMillis - mSocket timeout value in millisecondspublic int getSocketTimeout()
getSocketTimeout in interface ISpeedTestSocketpublic int getUploadChunkSize()
getUploadChunkSize in interface ISpeedTestSocketpublic RepeatWrapper getRepeatWrapper()
ISpeedTestSocketgetRepeatWrapper in interface ISpeedTestSocketpublic void setUploadChunkSize(int uploadChunkSize)
uploadChunkSize - new size of each packet sent to upload serverpublic void setDefaultRoundingMode(java.math.RoundingMode roundingMode)
roundingMode - rounding mode.public void setDefaultScale(int scale)
scale - mScale valuepublic void setComputationMethod(ComputationMethod computationMethod)
setComputationMethod in interface ISpeedTestSocketcomputationMethod - model valuepublic void setFtpMode(FtpMode mode)
mode - ftp mode.public ComputationMethod getComputationMethod()
getComputationMethod in interface ISpeedTestSocketpublic void setUploadSetupTime(long setupTime)
setupTime - point in time from which upload speed rate should be computedpublic void setDownloadSetupTime(long setupTime)
setupTime - point in time from which download speed rate should be computedpublic long getDownloadSetupTime()
getDownloadSetupTime in interface ISpeedTestSocketpublic long getUploadSetupTime()
getUploadSetupTime in interface ISpeedTestSocketpublic java.math.RoundingMode getDefaultRoundingMode()
getDefaultRoundingMode in interface ISpeedTestSocketpublic int getDefaultScale()
getDefaultScale in interface ISpeedTestSocketpublic UploadStorageType getUploadStorageType()
getUploadStorageType in interface ISpeedTestSocketpublic void setUploadStorageType(UploadStorageType uploadStorageType)
setUploadStorageType in interface ISpeedTestSocketuploadStorageType - upload storage typepublic void clearListeners()
public FtpMode getFtpMode()
getFtpMode in interface ISpeedTestSocket