Package org.omegat.util
Class WikiGet
- java.lang.Object
-
- org.omegat.util.WikiGet
-
public final class WikiGet extends java.lang.Object
Import pages from MediaWiki
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WikiGet.ResponseError
Deprecated.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static void
doWikiGet(java.lang.String remoteUrl, java.lang.String projectdir)
Gets mediawiki wiki-code data from remote server.static java.lang.String
get(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
Deprecated.This method is moved to HttpConnectionUtils class.static java.lang.String
get(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.String defaultOutputCharset)
Deprecated.This method is moved to HttpConnectionUtils class.static java.lang.String
getURL(java.lang.String target)
Deprecated.This method is moved to HttpConnectionUtils class.static byte[]
getURLasByteArray(java.lang.String target)
Deprecated.This method is moved to HttpConnectionUtils class.static java.lang.String
joinString(java.lang.String separator, java.lang.String[] items)
~inverse of String.split() refactor note: In future releases, this might best be moved to a different filestatic java.lang.String
post(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params)
Deprecated.This method is moved to HttpConnectionUtils class.static java.lang.String
post(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
Deprecated.This method is moved to HttpConnectionUtils class.static java.lang.String
postJSON(java.lang.String address, java.lang.String json, java.util.Map<java.lang.String,java.lang.String> additionalHeaders)
Deprecated.This method is moved to HttpConnectionUtils class.static void
printUTF8(java.lang.String output)
Print UTF-8 text to stdout (useful for debugging)static void
saveUTF8(java.lang.String dir, java.lang.String filename, java.lang.String output)
Save UTF-8 format data to file.static java.io.BufferedWriter
utf8WriterBuilder(java.io.OutputStream out)
Creates new BufferedWriter configured for UTF-8 output and connects it to an OutputStream
-
-
-
Method Detail
-
joinString
public static java.lang.String joinString(java.lang.String separator, java.lang.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(java.lang.String remoteUrl, java.lang.String projectdir) throws java.io.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 retrievedprojectdir
- string representation of path to the project-dir where the file should be saved.- Throws:
java.io.IOException
-
printUTF8
public static void printUTF8(java.lang.String output)
Print UTF-8 text to stdout (useful for debugging)- Parameters:
output
- The UTF-8 format string to be printed.
-
utf8WriterBuilder
public static java.io.BufferedWriter utf8WriterBuilder(java.io.OutputStream out) throws java.lang.Exception
Creates new BufferedWriter configured for UTF-8 output and connects it to an OutputStream- Parameters:
out
- Outputstream to connect to.- Throws:
java.lang.Exception
-
saveUTF8
public static void saveUTF8(java.lang.String dir, java.lang.String filename, java.lang.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 java.lang.String getURL(java.lang.String target) throws java.io.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:
java.io.IOException
-
getURLasByteArray
@Deprecated public static byte[] getURLasByteArray(java.lang.String target) throws java.io.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:
java.io.IOException
-
post
@Deprecated public static java.lang.String post(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params) throws java.io.IOException
Deprecated.This method is moved to HttpConnectionUtils class.Method call without additional headers for possible calls from plugins.(deprecated)- Throws:
java.io.IOException
-
get
@Deprecated public static java.lang.String get(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> additionalHeaders) throws java.io.IOException
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:
java.io.IOException
-
get
@Deprecated public static java.lang.String get(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> additionalHeaders, java.lang.String defaultOutputCharset) throws java.io.IOException
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:
java.io.IOException
-
post
@Deprecated public static java.lang.String post(java.lang.String address, java.util.Map<java.lang.String,java.lang.String> params, java.util.Map<java.lang.String,java.lang.String> additionalHeaders) throws java.io.IOException
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:
java.io.IOException
-
postJSON
@Deprecated public static java.lang.String postJSON(java.lang.String address, java.lang.String json, java.util.Map<java.lang.String,java.lang.String> additionalHeaders) throws java.io.IOException
Deprecated.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:
java.io.IOException
-
-