edu.uchsc.ccp.knowtator.textsource.files
Class FileTextSource
java.lang.Object
edu.uchsc.ccp.knowtator.textsource.DefaultTextSource
edu.uchsc.ccp.knowtator.textsource.files.FileTextSource
- All Implemented Interfaces:
- TextSource
public class FileTextSource
- extends DefaultTextSource
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. |
CLS_NAME
public static final String CLS_NAME
- See Also:
- Constant Field Values
file
protected File file
charset
protected Charset charset
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.
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