de.anneck.jcast.sources
Class FileSourceThread
java.lang.Object
|
+--de.anneck.jcast.core.AbstractThread
|
+--de.anneck.jcast.sources.AbstractSourceThread
|
+--de.anneck.jcast.sources.FileSourceThread
- All Implemented Interfaces:
- org.apache.avalon.framework.configuration.Configurable, ISignal, ISource, ISourceThread, IStartable, IThread, java.lang.Runnable
- public class FileSourceThread
- extends AbstractSourceThread
This source thread reads from a specified file and streams it. You can specify the
modi: once or loop. Default modi is once. This is also a very simple example of how to
implement a SourceThread. Take a look at the sourcecode for details. Dont you love open
source! ;)
- Version:
- $Revision: 1.7 $
- Author:
- andre.anneck@web.de
Field Summary |
static int |
LOOP
This source will loop forever |
static int |
ONCE
This source will play only once |
Method Summary |
void |
configure(org.apache.avalon.framework.configuration.Configuration configuration)
Configures the Source. |
void |
doWork()
Executes whatever this thread is supposed to do |
int |
getPlayMode()
Returns the current play mode. |
void |
setPlayMode(int mode)
Sets the current playmode. |
int |
setPlayMode(java.lang.String wantedPlayMode)
Sets the playmode from a String. |
Methods inherited from class de.anneck.jcast.sources.AbstractSourceThread |
addListener, equals, getChannel, getIdentifyingName, getSubscribedListeners, hashCode, receiveSignal, removeListener, send, send, setChannel, setIdentifyingName, signal, toString |
Methods inherited from class de.anneck.jcast.core.AbstractThread |
checkState, doKill, doRestart, doStart, doStop, getAllThreads, getThreadClass, getThreadName, getThreadPriority, isRunning, isStopped, isWaiting, run, setState, setThreadPriority |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface de.anneck.jcast.core.IThread |
checkState, doKill, doRestart, doStart, doStop, getThreadClass, getThreadName, getThreadPriority, isRunning, isStopped, isWaiting, setState, setThreadPriority |
Methods inherited from interface java.lang.Runnable |
run |
ONCE
public static final int ONCE
- This source will play only once
LOOP
public static final int LOOP
- This source will loop forever
FileSourceThread
public FileSourceThread()
- Creates new FileSourceThread
setPlayMode
public void setPlayMode(int mode)
- Sets the current playmode.
- Parameters:
mode
- The playmode. Available: ONCE, LOOP
getPlayMode
public int getPlayMode()
- Returns the current play mode.
- Returns:
- The play mode.
setPlayMode
public int setPlayMode(java.lang.String wantedPlayMode)
- Sets the playmode from a String. The String is parsed an has to match exactly
as specified. Default return mode is 0 (ONCE).
- Parameters:
wantedPlayMode
- Playmode wanted.- Returns:
- Wanted playmode, or default.
doWork
public void doWork()
throws java.lang.Exception
- Executes whatever this thread is supposed to do
- Throws:
java.lang.Exception
- Error during work.
configure
public void configure(org.apache.avalon.framework.configuration.Configuration configuration)
throws org.apache.avalon.framework.configuration.ConfigurationException
- Configures the Source. This is the place where filename, playmode, etc. are set.
- Overrides:
configure
in class AbstractSourceThread
- Parameters:
configuration
- The configuration object.- Throws:
org.apache.avalon.framework.configuration.ConfigurationException
- Error during configuration.