Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
org.sleuthkit.autopsy.texttranslation.translators.BingTranslator Class Reference

Inherits org.sleuthkit.autopsy.texttranslation.TextTranslator.

Public Member Functions

 BingTranslator ()
 
int getMaxTextChars ()
 
String getName ()
 
JPanel getSettingsPanel ()
 
String postTranslationRequest (String string) throws IOException
 
void saveSettings () throws TranslationConfigException
 
String translate (String string) throws TranslationException
 

Private Member Functions

String parseJSONResponse (String json_text) throws TranslationException
 

Private Attributes

final OkHttpClient CLIENT = new OkHttpClient()
 
final BingTranslatorSettings settings = new BingTranslatorSettings()
 
BingTranslatorSettingsPanel settingsPanel
 

Static Private Attributes

static final String BASE_URL = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to="
 
static final int MAX_STRING_LENGTH = 5000
 

Detailed Description

Translates text by making HTTP requests to Bing Translator. This requires a valid subscription key for a Microsoft Azure account.

Definition at line 43 of file BingTranslator.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.BingTranslator ( )

Create a Bing Translator

Definition at line 58 of file BingTranslator.java.

Member Function Documentation

int org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.getMaxTextChars ( )

Gets the maximum number of characters allowed in a translation request.

Returns
The maximum character count.

Implements org.sleuthkit.autopsy.texttranslation.TextTranslator.

Definition at line 181 of file BingTranslator.java.

String org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.getName ( )

Get the name of the TextTranslator implementation

Returns
the name of the TextTranslator

Implements org.sleuthkit.autopsy.texttranslation.TextTranslator.

Definition at line 132 of file BingTranslator.java.

JPanel org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.getSettingsPanel ( )

Get the JPanel to display on the settings options panel when this TextTranslator is selected

Returns
the panel which displays the settings options

Implements org.sleuthkit.autopsy.texttranslation.TextTranslator.

Definition at line 138 of file BingTranslator.java.

String org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.parseJSONResponse ( String  json_text) throws TranslationException
private

Parse the response to get the translated text

Parameters
json_textthe json which was received as a response to a translation request
Returns
the translated text
Exceptions
TranslationException

Definition at line 162 of file BingTranslator.java.

String org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.postTranslationRequest ( String  string) throws IOException

Converts an input text to the JSON format required by Bing Translator, posts it to Microsoft, and returns the JSON text response.

Parameters
stringThe input text to be translated.
Returns
The translation response as a JSON string
Exceptions
IOExceptionif the request could not be executed due to cancellation, a connectivity problem or timeout.

Definition at line 86 of file BingTranslator.java.

void org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.saveSettings ( ) throws TranslationConfigException

Saves the current state of the settings in the settings panel.

Exceptions
TranslationConfigException

Implements org.sleuthkit.autopsy.texttranslation.TextTranslator.

Definition at line 146 of file BingTranslator.java.

String org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.translate ( String  input) throws TranslationException

Translates a provided string

Parameters
inputthe String to translate
Returns
the translated String
Exceptions
TranslationException

Implements org.sleuthkit.autopsy.texttranslation.TextTranslator.

Definition at line 106 of file BingTranslator.java.

Member Data Documentation

final String org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.BASE_URL = "https://api.cognitive.microsofttranslator.com/translate?api-version=3.0&to="
staticprivate

Definition at line 48 of file BingTranslator.java.

final OkHttpClient org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.CLIENT = new OkHttpClient()
private

Definition at line 53 of file BingTranslator.java.

final int org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.MAX_STRING_LENGTH = 5000
staticprivate

Definition at line 49 of file BingTranslator.java.

final BingTranslatorSettings org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.settings = new BingTranslatorSettings()
private

Definition at line 51 of file BingTranslator.java.

BingTranslatorSettingsPanel org.sleuthkit.autopsy.texttranslation.translators.BingTranslator.settingsPanel
private

Definition at line 50 of file BingTranslator.java.


The documentation for this class was generated from the following file:

Copyright © 2012-2022 Basis Technology. Generated on: Mon Sep 26 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.