source: other-projects/the-macronizer/trunk/src/java/monogram/plugin/PluginTXT.java@ 35725

Last change on this file since 35725 was 35719, checked in by cstephen, 2 years ago

Add support for JSON response to direct input queries. Cleanup other components.

File size: 1.1 KB
Line 
1/*
2 * To change this template, choose Tools | Templates
3 * and open the template in the editor.
4 */
5package monogram.plugin;
6
7import java.io.File;
8import java.io.IOException;
9import monogram.restorer.TxtRestorer;
10
11/**
12 * @author University of Waikato - Te Whare Wānanga o Waikato
13 * @version 1.0
14 * @since 2014-11-20
15 */
16public class PluginTXT implements Plugin {
17
18 private File tmpdir;
19
20 public PluginTXT(File tmpdir)
21 {
22 this.tmpdir = tmpdir;
23 }
24
25 public File run(PluginConfiguration configuration)
26 throws IllegalArgumentException, IOException
27 {
28 if (configuration.getCharsetEncoding() == null)
29 {
30 throw new IllegalArgumentException();
31 }
32
33 final File outputFile = File.createTempFile("mi-tmp-", configuration.getFileType(), tmpdir);
34 final TxtRestorer restorer = new TxtRestorer();
35
36 restorer.restore
37 (
38 configuration.getFile(),
39 configuration.getCharsetEncoding(),
40 outputFile,
41 configuration.getPreserveExistingMacrons(),
42 configuration.getMarkupChangedWords()
43 );
44
45 return outputFile;
46 }
47}
Note: See TracBrowser for help on using the repository browser.