public abstract class ExternalTranslator extends AbstractTranslator
for an example of extending this class.| Constructor and Description | 
|---|
| ExternalTranslator() | 
| Modifier and Type | Method and Description | 
|---|---|
| boolean | checkCommand(String checkCommandString,
            int... successCodes)Checks to see if the command can be run. | 
| Reader | runAndGetOutput(String command,
               String[] env,
               File workingDirectory)Run the given command and return the output written to standard out. | 
| String | translate(String text,
         String targetLanguage)Default translate method which uses built Tika language identification. | 
detectLanguageclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisAvailable, translatepublic Reader runAndGetOutput(String command, String[] env, File workingDirectory) throws IOException, InterruptedException
command - The complete command to run.env - The environment to pass along to the Runtime.workingDirectory - The directory from which to run the command.IOExceptionInterruptedExceptionpublic boolean checkCommand(String checkCommandString, int... successCodes)
checkCommandString - The command to run and check the return code of.successCodes - Return codes that signify success.public String translate(String text, String targetLanguage) throws TikaException, IOException
text - The text to translate.targetLanguage - The desired language to translate to (for example, "hi").ExceptionTikaException - When there is an error translating.IOExceptionCopyright © 2007–2022 The Apache Software Foundation. All rights reserved.