Class ScroogeXHTML

All Implemented Interfaces:
ConversionConfiguration, Serializable

public class ScroogeXHTML extends ScroogeXHTMLMain
ScroogeXHTML class provides methods to convert RTF documents to XHTML/HTML format. The class offers multiple overloaded methods to handle conversions from RTF strings, RTF file paths, and input streams to both markup strings and files, using specified or default character encodings.
See Also:
  • Constructor Details

    • ScroogeXHTML

      public ScroogeXHTML()
      Constructs a new instance of ScroogeXHTML. If debug logging is enabled, outputs the name and version of the software to the debug log.
  • Method Details

    • convert

      public String convert(String rtf)
      Converts an RTF string to a markup string using the UTF-8 output charset.
      Parameters:
      rtf - the input RTF string
      Returns:
      the equivalent XHTML/HTML string
    • convert

      public String convert(String rtf, Charset outputCharset)
      Converts a given RTF string to a markup string using the specified output charset.
      Parameters:
      rtf - the input RTF string to be converted
      outputCharset - the charset to be used for the output markup string
      Returns:
      the equivalent XHTML/HTML string
      Throws:
      ConversionException - when an IOException occurs during conversion
    • convert

      public void convert(String rtf, Path outputPath) throws IOException
      Converts an RTF string to a markup file using the UTF-8 output charset.
      Parameters:
      rtf - the RTF input code
      outputPath - the path where the converted markup file will be saved
      Throws:
      IOException - if an I/O error occurs during the conversion process
    • convert

      public void convert(String rtf, Path outputPath, Charset outputCharset) throws IOException
      Converts a given RTF string to a markup file at the specified output path using the specified output charset.
      Parameters:
      rtf - the RTF input string to be converted
      outputPath - the path where the converted markup file will be saved
      outputCharset - the charset to use for the output file
      Throws:
      IOException - if an I/O error occurs during the file writing process
    • convert

      public void convert(Path rtfPath, Path outputPath) throws IOException
      Converts an RTF file located at the specified path to a markup file, saving it at the given output path. The conversion uses the UTF-8 character encoding.
      Parameters:
      rtfPath - the path to the RTF file to be converted
      outputPath - the path where the converted markup file will be saved
      Throws:
      IOException - if an I/O error occurs during the conversion process
    • convert

      public void convert(Path rtfPath, Path htmlPath, Charset outputCharset) throws IOException
      Converts an RTF file located at the specified path to a markup file, saving it at the given output path. The conversion uses the specified character encoding.
      Parameters:
      rtfPath - the path to the RTF file to be converted
      htmlPath - the path where the converted markup file will be saved
      outputCharset - the charset to be used for the output markup file
      Throws:
      IOException - if an I/O error occurs during the conversion process
    • convert

      public String convert(Path rtfPath) throws IOException
      Converts an RTF file located at the specified path to a markup string using UTF-8 character encoding.
      Parameters:
      rtfPath - the path to the RTF file to be converted
      Returns:
      the equivalent markup string in XHTML/HTML format
      Throws:
      IOException - if an I/O error occurs during the conversion process
    • convert

      public String convert(Path rtfPath, Charset outputCharset) throws IOException
      Converts an RTF file at the specified path to a markup string using the specified output charset.
      Parameters:
      rtfPath - the path to the RTF file to be converted
      outputCharset - the charset to be used for the output markup string
      Returns:
      the equivalent XHTML/HTML string
      Throws:
      IOException - if an I/O error occurs during the conversion process
    • convert

      public String convert(ByteArrayInputStream rtf)
      Converts the given RTF input stream into a string using the UTF-8 character encoding.
      Parameters:
      rtf - the ByteArrayInputStream containing the RTF data to be converted
      Returns:
      a string representing the equivalent XHTML/HTML markup
    • convert

      public void convert(ByteArrayInputStream rtf, Path outputPath)
      Converts the given RTF input stream into a markup file at the specified output path using UTF-8 character encoding.
      Parameters:
      rtf - the ByteArrayInputStream containing the RTF data to be converted
      outputPath - the path where the converted markup file will be saved
      Throws:
      ConversionException - if an IOException occurs during the conversion process
    • convert

      public String convert(ByteArrayInputStream rtf, Charset outputCharset)
      Converts the given RTF input stream into a string using the specified output charset.
      Parameters:
      rtf - the ByteArrayInputStream containing the RTF data to be converted
      outputCharset - the charset to be used for the output string
      Returns:
      a string representing the equivalent XHTML/HTML markup
      Throws:
      ConversionException - if an I/O error occurs during the conversion process