edu.uchsc.ccp.knowtator.textsource.files
Class FileTextSource

java.lang.Object
  extended by edu.uchsc.ccp.knowtator.textsource.DefaultTextSource
      extended by edu.uchsc.ccp.knowtator.textsource.files.FileTextSource
All Implemented Interfaces:
TextSource

public class FileTextSource
extends DefaultTextSource


Field Summary
protected  Charset charset
           
static String CLS_NAME
           
protected  File file
           
 
Fields inherited from class edu.uchsc.ccp.knowtator.textsource.DefaultTextSource
name, protegeClsName, text
 
Constructor Summary
FileTextSource(File file, String rootPath, Charset charset)
          The name of the file with the rootPath prefix removed is the name of the FileTextSource.
 
Method Summary
 File getFile()
           
 String getText()
          It might be prudent for extensions of this class to override this method such that the member variable text is not used - esp.
static String readFile(InputStream inputStream, Charset charset)
           
 
Methods inherited from class edu.uchsc.ccp.knowtator.textsource.DefaultTextSource
createTextSourceInstance, equals, getName, getProtegeClsName, getText, getText, hashCode, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLS_NAME

public static final String CLS_NAME
See Also:
Constant Field Values

file

protected File file

charset

protected Charset charset
Constructor Detail

FileTextSource

public FileTextSource(File file,
                      String rootPath,
                      Charset charset)
The name of the file with the rootPath prefix removed is the name of the FileTextSource. For example, if file.getPath is "/home/pogren/my_text.txt" and rootPath is "/home/pogren", then the name of the text source is my_text.txt. Typically file.getPath() == rootPath + "/"+ name.

Method Detail

getFile

public File getFile()

getText

public String getText()
               throws TextSourceAccessException
Description copied from class: DefaultTextSource
It might be prudent for extensions of this class to override this method such that the member variable text is not used - esp. if the texts are large and there are many of them.

Specified by:
getText in interface TextSource
Overrides:
getText in class DefaultTextSource
Returns:
the text associated with the TextSource. The text returned will be shown in the Knowtator text viewer.
Throws:
TextSourceAccessException

readFile

public static String readFile(InputStream inputStream,
                              Charset charset)
                       throws IOException
Throws:
IOException