anl.aida.reader
Class CachedContentReader
java.lang.Object
anl.aida.reader.CachedContentReader
- All Implemented Interfaces:
- ContentReader
public class CachedContentReader
- extends java.lang.Object
- implements ContentReader
ContentReader that reads cached content.
Field Summary |
private java.lang.String |
dir
|
private java.lang.String |
source
|
Constructor Summary |
CachedContentReader(java.lang.String source,
java.lang.String cacheDir)
Creates a CachedContentReader that will produce ReaderResults with the
specified source property. |
Method Summary |
ReaderResult |
read(java.lang.String url,
java.lang.String title,
java.util.Date date,
java.lang.String author)
Reads the text content from the url and uses that as the reader result
contents. |
private void |
readContents(java.lang.String file,
ReaderResult result)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
source
private java.lang.String source
dir
private java.lang.String dir
CachedContentReader
public CachedContentReader(java.lang.String source,
java.lang.String cacheDir)
- Creates a CachedContentReader that will produce ReaderResults with the
specified source property.
- Parameters:
source
- the content source namecacheDir
- the top level cached content directory.
readContents
private void readContents(java.lang.String file,
ReaderResult result)
throws java.io.IOException
- Throws:
java.io.IOException
read
public ReaderResult read(java.lang.String url,
java.lang.String title,
java.util.Date date,
java.lang.String author)
throws java.io.IOException
- Reads the text content from the url and uses that as the reader result
contents. No parsing is done. The url is assumed to contain a cached
content file whose first line is the true or original url from which the
article originated.
- Specified by:
read
in interface ContentReader
- Parameters:
url
- the content urltitle
- the title of the articledate
- the date of the articleauthor
- the author (can be empty string)
- Returns:
-
- Throws:
java.io.IOException
- if there is an error