Class WikiGet

java.lang.Object
org.omegat.util.WikiGet

public final class WikiGet extends Object
Import pages from MediaWiki
  • Method Details

    • joinString

      public static String joinString(String separator, String[] items)
      ~inverse of String.split() refactor note: In future releases, this might best be moved to a different file
    • doWikiGet

      public static void doWikiGet(String remoteUrl, String projectdir) throws IOException
      Gets mediawiki wiki-code data from remote server. The get strategy is determined by the url format.
      Parameters:
      remoteUrl - string representation of well-formed URL of wikipage to be retrieved
      projectdir - string representation of path to the project-dir where the file should be saved.
      Throws:
      IOException
    • printUTF8

      public static void printUTF8(String output)
      Print UTF-8 text to stdout (useful for debugging)
      Parameters:
      output - The UTF-8 format string to be printed.
    • utf8WriterBuilder

      public static BufferedWriter utf8WriterBuilder(OutputStream out) throws Exception
      Creates new BufferedWriter configured for UTF-8 output and connects it to an OutputStream
      Parameters:
      out - Outputstream to connect to.
      Throws:
      Exception
    • saveUTF8

      public static void saveUTF8(String dir, String filename, String output)
      Save UTF-8 format data to file.
      Parameters:
      dir - directory to write to.
      filename - filename of file to write.
      output - UTF-8 format text to write
    • getURL

      @Deprecated public static String getURL(String target) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Obtain UTF-8 format text from remote URL.
      Parameters:
      target - String representation of well-formed URL.
      Throws:
      IOException
    • getURLasByteArray

      @Deprecated public static byte[] getURLasByteArray(String target) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Obtain byte array context from remote URL.
      Parameters:
      target - String representation of well-formed URL.
      Returns:
      byte array or null if status is not 200 OK
      Throws:
      IOException
    • post

      @Deprecated public static String post(String address, Map<String,String> params) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Method call without additional headers for possible calls from plugins.(deprecated)
      Throws:
      IOException
    • get

      @Deprecated public static String get(String address, Map<String,String> params, Map<String,String> additionalHeaders) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Get data from the remote URL.
      Parameters:
      address - address to post
      params - parameters
      additionalHeaders - additional headers for request, can be null
      Returns:
      server output
      Throws:
      IOException
    • get

      @Deprecated public static String get(String address, Map<String,String> params, Map<String,String> additionalHeaders, String defaultOutputCharset) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Get data from the remote URL.
      Parameters:
      address - address to post
      params - parameters
      additionalHeaders - additional headers for request, can be null
      defaultOutputCharset - default charset used to interpret the response
      Returns:
      server output
      Throws:
      IOException
    • post

      @Deprecated public static String post(String address, Map<String,String> params, Map<String,String> additionalHeaders) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Post data to the remote URL.
      Parameters:
      address - address to post
      params - parameters
      additionalHeaders - additional headers for request, can be null
      Returns:
      Server output
      Throws:
      IOException
    • postJSON

      @Deprecated public static String postJSON(String address, String json, Map<String,String> additionalHeaders) throws IOException
      Deprecated.
      This method is moved to HttpConnectionUtils class.
      Post JSON data to the remote URL.
      Parameters:
      address - address to post
      json - JSON-encoded data
      additionalHeaders - additional headers for request, can be null
      Returns:
      Server output
      Throws:
      IOException