org.stanwood.media.source.xbmc
Class StreamProcessor

java.lang.Object
  extended by org.stanwood.media.source.xbmc.StreamProcessor

public abstract class StreamProcessor
extends java.lang.Object

This class is used to process streams that could be zipped. If the stream is not zipped, then processContents(String) is called once with the streams contents read as a string. If the stream is a instance of ZipInputStream, then processContents(String) is called with the contents of each file within the zip stream.


Constructor Summary
StreamProcessor(java.lang.String cacheKey)
          The constructor
StreamProcessor(java.lang.String cacheKey, java.lang.String forcedContentType)
          The constructor
 
Method Summary
protected abstract  Stream getStream()
           
 void handleStream()
          Called to process the stream.
abstract  void processContents(java.lang.String contents)
          This method is called each time a streams contents are read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StreamProcessor

public StreamProcessor(java.lang.String cacheKey,
                       java.lang.String forcedContentType)
The constructor

Parameters:
cacheKey - The cached key associated with this stream
forcedContentType - Used to override the content type, null to use the default

StreamProcessor

public StreamProcessor(java.lang.String cacheKey)
The constructor

Parameters:
cacheKey - The cached key associated with this stream
Method Detail

getStream

protected abstract Stream getStream()
                             throws ExtensionException,
                                    java.io.IOException
Throws:
ExtensionException
java.io.IOException

handleStream

public void handleStream()
                  throws SourceException
Called to process the stream. This causes the method processContents(String) to be called.

Throws:
SourceException - Thrown in their are any problems

processContents

public abstract void processContents(java.lang.String contents)
                              throws SourceException
This method is called each time a streams contents are read. If the stream is a instance of ZipInputStream, then it is called for each of the files within the zip stream.

Parameters:
contents - The contents of the stream as a string
Throws:
SourceException - Thrown in their are any problems