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

Inherits org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.

Public Member Functions

TranslateResult doInBackground () throws InterruptedException
 
void done ()
 

Protected Member Functions

void onErrorDisplay (String text, ComponentOrientation orientation, int font)
 
void onProgressDisplay (String text, ComponentOrientation orientation, int font)
 
void onTextDisplay (String text, ComponentOrientation orientation, int font)
 
String retrieveText () throws IOException, InterruptedException, IllegalStateException
 
String translate (String input) throws NoServiceProviderException, TranslationException
 

Private Member Functions

 ExtractAndTranslateTextTask (AbstractFile file, boolean translateText)
 
String extractText (AbstractFile source, boolean ocrEnabled) throws IOException, InterruptedException, TextExtractor.InitReaderException
 
String getFileText (AbstractFile file) throws IOException, InterruptedException, TextExtractor.InitReaderException
 
Reader getTextExtractor (AbstractFile file, boolean ocrEnabled) throws IOException, TextExtractor.InitReaderException
 

Private Attributes

final AbstractFile file
 

Detailed Description

Extracts text from a file and optionally translates it.

Definition at line 150 of file TranslatedTextViewer.java.

Constructor & Destructor Documentation

org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.ExtractAndTranslateTextTask ( AbstractFile  file,
boolean  translateText 
)
private

Definition at line 154 of file TranslatedTextViewer.java.

Member Function Documentation

TranslateResult org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.doInBackground ( ) throws InterruptedException
inherited
void org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.done ( )
inherited
String org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.extractText ( AbstractFile  source,
boolean  ocrEnabled 
) throws IOException, InterruptedException, TextExtractor.InitReaderException
private

Fetches text from a file.

Parameters
sourcethe AbstractFile source to get a Reader for
ocrEnabledtrue if OCR is enabled false otherwise
Returns
Extracted Text
Exceptions
IOException
InterruptedException
org.sleuthkit.autopsy.textextractors.TextExtractor.InitReaderException

Definition at line 228 of file TranslatedTextViewer.java.

String org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.getFileText ( AbstractFile  file) throws IOException, InterruptedException, TextExtractor.InitReaderException
private

Extracts text from the given node

Parameters
fileSelected node in UI
Returns
Extracted text
Exceptions
IOException
InterruptedException
org.sleuthkit.autopsy.textextractors.TextExtractor.InitReaderException

Definition at line 200 of file TranslatedTextViewer.java.

References org.sleuthkit.autopsy.core.UserPreferences.getUseOcrInTranslation().

Reader org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.getTextExtractor ( AbstractFile  file,
boolean  ocrEnabled 
) throws IOException, TextExtractor.InitReaderException
private

Fetches the appropriate reader for the given file mimetype and configures it to use OCR.

Parameters
fileFile to be read
ocrEnabledDetermines if the extractor should be configured for OCR
Returns
Reader containing Content text
Exceptions
IOException
NoTextReaderFound

Definition at line 273 of file TranslatedTextViewer.java.

References org.sleuthkit.autopsy.textextractors.TextExtractorFactory.getExtractor(), org.sleuthkit.autopsy.textextractors.TextExtractor.getReader(), org.sleuthkit.autopsy.textextractors.TextExtractorFactory.getStringsExtractor(), org.sleuthkit.autopsy.textextractors.configs.ImageConfig.setOCREnabled(), and org.sleuthkit.autopsy.textextractors.configs.ImageConfig.setOCRLanguages().

void org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.onErrorDisplay ( String  text,
ComponentOrientation  orientation,
int  font 
)
protectedinherited

When an error result is received, this method is called. This method can be overridden depending on the scenario but defaults to just displaying using onTextDisplay.

Parameters
textthe text of the error
orientationthe orientation for the error
fontthe font style of the error

Definition at line 130 of file TranslateTextTask.java.

References org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.onTextDisplay().

Referenced by org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.done().

void org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.onProgressDisplay ( String  text,
ComponentOrientation  orientation,
int  font 
)
protectedinherited

When a progress result is received, this method is called. This method can be overridden depending on the scenario, but defaults to just displaying using onTextDisplay.

Parameters
textthe text of the status update
orientationthe orientation for the status
fontthe font style of the status

Definition at line 118 of file TranslateTextTask.java.

References org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.onTextDisplay().

Referenced by org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.translateRetrievedText().

void org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.onTextDisplay ( String  text,
ComponentOrientation  orientation,
int  font 
)
protected
String org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.retrieveText ( ) throws IOException, InterruptedException, IllegalStateException
protected

Extracts text from the current node

Returns
Extracted text
Exceptions
Exception

Definition at line 170 of file TranslatedTextViewer.java.

String org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.translate ( String  input) throws NoServiceProviderException, TranslationException
protectedinherited

This method passes the translation off to the translation service provider.

Parameters
inputtext to be translated
Returns
translated text or error message

Definition at line 238 of file TranslateTextTask.java.

References org.sleuthkit.autopsy.texttranslation.TextTranslationService.getInstance(), and org.sleuthkit.autopsy.texttranslation.TextTranslationService.translate().

Referenced by org.sleuthkit.autopsy.texttranslation.ui.TranslateTextTask.translateRetrievedText().

Member Data Documentation

final AbstractFile org.sleuthkit.autopsy.texttranslation.ui.TranslatedTextViewer.ExtractAndTranslateTextTask.file
private

Definition at line 152 of file TranslatedTextViewer.java.


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

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