Package org.omegat.util
Class WikiGet
java.lang.Object
org.omegat.util.WikiGet
Import pages from MediaWiki
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic voidGets mediawiki wiki-code data from remote server.static StringDeprecated.This method is moved to HttpConnectionUtils class.static Stringget(String address, Map<String, String> params, Map<String, String> additionalHeaders, String defaultOutputCharset) Deprecated.This method is moved to HttpConnectionUtils class.static StringDeprecated.This method is moved to HttpConnectionUtils class.static byte[]getURLasByteArray(String target) Deprecated.This method is moved to HttpConnectionUtils class.static StringjoinString(String separator, String[] items) ~inverse of String.split() refactor note: In future releases, this might best be moved to a different filestatic StringDeprecated.This method is moved to HttpConnectionUtils class.static StringDeprecated.This method is moved to HttpConnectionUtils class.static StringDeprecated.This method is moved to HttpConnectionUtils class.static voidPrint UTF-8 text to stdout (useful for debugging)static voidSave UTF-8 format data to file.static BufferedWriterCreates new BufferedWriter configured for UTF-8 output and connects it to an OutputStream
-
Method Details
-
joinString
~inverse of String.split() refactor note: In future releases, this might best be moved to a different file -
doWikiGet
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 retrievedprojectdir- string representation of path to the project-dir where the file should be saved.- Throws:
IOException
-
printUTF8
Print UTF-8 text to stdout (useful for debugging)- Parameters:
output- The UTF-8 format string to be printed.
-
utf8WriterBuilder
Creates new BufferedWriter configured for UTF-8 output and connects it to an OutputStream- Parameters:
out- Outputstream to connect to.- Throws:
Exception
-
saveUTF8
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.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.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.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, throws IOExceptionString> additionalHeaders) Deprecated.This method is moved to HttpConnectionUtils class.Get data from the remote URL.- Parameters:
address- address to postparams- parametersadditionalHeaders- 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, throws IOExceptionString> additionalHeaders, String defaultOutputCharset) Deprecated.This method is moved to HttpConnectionUtils class.Get data from the remote URL.- Parameters:
address- address to postparams- parametersadditionalHeaders- additional headers for request, can be nulldefaultOutputCharset- 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, throws IOExceptionString> additionalHeaders) Deprecated.This method is moved to HttpConnectionUtils class.Post data to the remote URL.- Parameters:
address- address to postparams- parametersadditionalHeaders- 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 IOExceptionDeprecated.This method is moved to HttpConnectionUtils class.Post JSON data to the remote URL.- Parameters:
address- address to postjson- JSON-encoded dataadditionalHeaders- additional headers for request, can be null- Returns:
- Server output
- Throws:
IOException
-