Class MarianTranslator.MarianServerClient
- java.lang.Object
- 
- org.apache.tika.language.translate.impl.MarianTranslator.MarianServerClient
 
- 
- Enclosing class:
- MarianTranslator
 
 public static class MarianTranslator.MarianServerClient extends Object Internal Client for marian-server Web Socket Server.
- 
- 
Constructor SummaryConstructors Constructor Description MarianServerClient(URI endpointURI, File file)Marian Server Web Socket Client.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the connection to the Marian Server.voidonClose(jakarta.websocket.Session session)voidonOpen(jakarta.websocket.Session session)voidprocessMessage(String message)voidtranslate(String sourceText)Translate the passed text using the Marian Server.
 
- 
- 
- 
Constructor Detail- 
MarianServerClientpublic MarianServerClient(URI endpointURI, File file) throws TikaException Marian Server Web Socket Client.- Parameters:
- endpointURI- the endpoint URI for the Marian Server instance.
- file- the location of the file to write the translation response to.
- Throws:
- TikaException
 
 
- 
 - 
Method Detail- 
onOpenpublic void onOpen(jakarta.websocket.Session session) 
 - 
processMessagepublic void processMessage(String message) throws IOException - Throws:
- IOException
 
 - 
onClosepublic void onClose(jakarta.websocket.Session session) 
 - 
translatepublic void translate(String sourceText) throws IOException Translate the passed text using the Marian Server.- Parameters:
- sourceText- the source text to translate.
- Throws:
- IOException- on any I/O error calling the server.
 
 - 
closepublic void close() throws IOExceptionClose the connection to the Marian Server.- Throws:
- IOException- on any I/O error calling the server.
 
 
- 
 
-