Package ipsk.net
Class URLContentLoader
- java.lang.Object
-
- ipsk.awt.ProgressWorker
-
- ipsk.net.URLContentLoader
-
- All Implemented Interfaces:
Worker
,ProgressUpdate
,java.lang.Runnable
public class URLContentLoader extends ProgressWorker
Asynchronous download engine for URL content.- Author:
- K.Jaensch, klausj@phonetik.uni-muenchen.de
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ipsk.awt.ProgressWorker
ProgressWorker.ProgressEventTransferAgent
-
Nested classes/interfaces inherited from interface ipsk.awt.Worker
Worker.State
-
-
Field Summary
Fields Modifier and Type Field Description static boolean
DEBUG
static int
DEBUG_TOTAL_MIN_MS
int
DEFAULT_BUFFER_SIZE
protected java.net.URL
url
-
Fields inherited from class ipsk.awt.ProgressWorker
generateEvents, progressEventTransferAgent, progressStatus, task, thread, threadName
-
-
Constructor Summary
Constructors Constructor Description URLContentLoader()
URLContentLoader(java.lang.String threadName)
URLContentLoader(java.net.URL url, java.io.OutputStream outputStream)
Constructor.URLContentLoader(java.net.URL url, java.io.OutputStream outputStream, java.lang.String threadName)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doWork()
java.lang.Integer
getConnectTimeOut()
ContentType
getContentType()
java.io.OutputStream
getOutputStream()
java.lang.Integer
getReadTimeout()
java.net.URL
getUrl()
boolean
isOpenConnectionInThread()
static void
main(java.lang.String[] args)
void
open()
void
setConnectTimeOut(java.lang.Integer connectTimeOut)
void
setOpenConnectionInThread(boolean openConnectionInThread)
void
setOutputStream(java.io.OutputStream outputStream)
void
setReadTimeout(java.lang.Integer readTimeout)
void
setTimeouts(java.lang.Integer timeout)
void
setUrl(java.net.URL url)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from class ipsk.awt.ProgressWorker
addProgressListener, cancel, close, fireProgressEvent, fireProgressEvent, getProgressStatus, getStatus, getTask, hasCancelRequest, removeProgressListener, reset, run, setRunningWithParentWorker, setTask, start
-
-
-
-
Field Detail
-
DEBUG
public static final boolean DEBUG
- See Also:
- Constant Field Values
-
DEBUG_TOTAL_MIN_MS
public static final int DEBUG_TOTAL_MIN_MS
- See Also:
- Constant Field Values
-
DEFAULT_BUFFER_SIZE
public final int DEFAULT_BUFFER_SIZE
- See Also:
- Constant Field Values
-
url
protected java.net.URL url
-
-
Constructor Detail
-
URLContentLoader
public URLContentLoader()
-
URLContentLoader
public URLContentLoader(java.lang.String threadName)
-
URLContentLoader
public URLContentLoader(java.net.URL url, java.io.OutputStream outputStream)
Constructor.
-
URLContentLoader
public URLContentLoader(java.net.URL url, java.io.OutputStream outputStream, java.lang.String threadName)
Constructor.
-
-
Method Detail
-
getConnectTimeOut
public java.lang.Integer getConnectTimeOut()
- Returns:
- the connectTimeOut, null if default of URLConnection is used
-
setConnectTimeOut
public void setConnectTimeOut(java.lang.Integer connectTimeOut)
- Parameters:
connectTimeOut
- the connectTimeOut to set, null to use default of URLConnection
-
getReadTimeout
public java.lang.Integer getReadTimeout()
- Returns:
- the readTimeout, null if default of URLConnection is used
-
setReadTimeout
public void setReadTimeout(java.lang.Integer readTimeout)
- Parameters:
readTimeout
- the readTimeout to set
-
setTimeouts
public void setTimeouts(java.lang.Integer timeout)
-
isOpenConnectionInThread
public boolean isOpenConnectionInThread()
- Returns:
- the openConnectionInThread
-
setOpenConnectionInThread
public void setOpenConnectionInThread(boolean openConnectionInThread)
- Parameters:
openConnectionInThread
- the openConnectionInThread to set
-
getUrl
public java.net.URL getUrl()
-
setUrl
public void setUrl(java.net.URL url)
-
open
public void open() throws WorkerException
- Specified by:
open
in interfaceWorker
- Overrides:
open
in classProgressWorker
- Throws:
WorkerException
-
doWork
public void doWork() throws WorkerException
- Overrides:
doWork
in classProgressWorker
- Throws:
WorkerException
-
main
public static void main(java.lang.String[] args)
-
getOutputStream
public java.io.OutputStream getOutputStream()
-
setOutputStream
public void setOutputStream(java.io.OutputStream outputStream)
-
getContentType
public ContentType getContentType()
-
-