public class CrowdinAPI extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
CrowdinAPI.HTTPMethod
An enum that makes it possible to pass HTTP methods in a typesafe manner.
|
| Modifier and Type | Field and Description |
|---|---|
protected static com.google.gson.Gson |
GSON
The static
Gson instance used for JSON (de)serialization |
| Modifier and Type | Method and Description |
|---|---|
static BranchInfo |
createBranch(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
String token,
String branchName,
org.apache.maven.plugin.logging.Log logger)
Creates a branch at Crowdin.
|
static BuildInfo |
createBuild(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
String token,
Long branchId,
boolean skipUntranslatedStrings,
boolean skipUntranslatedFiles,
boolean exportApprovedOnly,
org.apache.maven.plugin.logging.Log logger)
Triggers a build at Crowdin.
|
static FileInfo |
createFile(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
StorageInfo storage,
String name,
FileType type,
Long branchId,
Long folderId,
String title,
String context,
String[] excludedTargetLanguages,
FileExportOptions exportOptions,
FileImportOptions importOptions,
Integer parserVersion,
String token,
org.apache.maven.plugin.logging.Log logger)
Asks Crowdin to create a new file from a file that has already been
uploaded to storage.
|
static FolderInfo |
createFolder(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
String name,
Long branchId,
Long parentFolderId,
String token,
org.apache.maven.plugin.logging.Log logger)
Asks Crowdin to create a new folder.
|
static org.apache.http.impl.client.CloseableHttpClient |
createHTTPClient(String projectVersion,
Integer timeout)
Creates a new
CloseableHttpClient instance. |
static StorageInfo |
createStorage(org.apache.http.impl.client.CloseableHttpClient httpClient,
String filename,
org.apache.http.HttpEntity entity,
String token,
org.apache.maven.plugin.logging.Log logger)
Creates a new storage on Crowdin by uploading content.
|
static void |
deleteStorage(org.apache.http.impl.client.CloseableHttpClient httpClient,
StorageInfo storage,
String token,
org.apache.maven.plugin.logging.Log logger)
Deletes the specified storage at Crowdin.
|
static String |
entityToString(org.apache.http.HttpEntity entity)
Extracts the content of an
HttpEntity to a string and returns it,
making some assumptions along the way. |
static BuildInfo |
getBuildStatus(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
long buildId,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for the status of the specified build.
|
static DownloadLinkInfo |
getDownloadLink(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
long buildId,
String token,
org.apache.maven.plugin.logging.Log logger)
Asks Crowdin for a download link for the specified build.
|
static FileInfo |
getFile(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
long fileId,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for information about the specified file.
|
static FileInfo |
getFileIfExists(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
BranchInfo branch,
FolderInfo folder,
String fileName,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for information about a file with the specified name.
|
static FolderInfo |
getFolder(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
BranchInfo branch,
String folderPath,
boolean create,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for information about the specified folder.
|
static FolderInfo |
getFolder(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
long folderId,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for information about the specified folder.
|
static com.google.gson.Gson |
getGsonInstance() |
static ProjectInfo |
getProjectInfo(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for project information.
|
static String |
getTranslationStatus(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
String token,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for the current translation status.
|
static List<BranchInfo> |
listBranches(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
String token,
String branchName,
org.apache.maven.plugin.logging.Log logger)
Queries Crowdin for a list of branches.
|
static List<FileInfo> |
listFiles(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
Long branchId,
Long folderId,
String filter,
boolean recursion,
String token,
org.apache.maven.plugin.logging.Log logger)
Asks Crowdin for a list of files.
|
static List<FolderInfo> |
listFolders(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
Long branchId,
Long parentFolderId,
String filter,
boolean recursion,
String token,
org.apache.maven.plugin.logging.Log logger)
Asks Crowdin for a list of folders.
|
static List<BuildInfo> |
listProjectBuilds(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
Long branchId,
String token,
org.apache.maven.plugin.logging.Log logger)
Requests a list of builds from Crowdin.
|
static List<StorageInfo> |
listStorages(org.apache.http.impl.client.CloseableHttpClient httpClient,
String token,
org.apache.maven.plugin.logging.Log logger)
Lists the Crowdin storages for the current API user.
|
static <T,V> T |
sendRequest(org.apache.http.impl.client.CloseableHttpClient httpClient,
CrowdinAPI.HTTPMethod method,
String function,
Map<String,String> parameters,
Collection<org.apache.http.Header> headers,
String token,
V payload,
org.apache.http.entity.ContentType payloadContentType,
Class<T> clazz,
org.apache.maven.plugin.logging.Log logger)
Sends a HTTP request to the Crowdin API using the specified "function"
and the specified parameters.
|
static <T,V> T |
sendRequest(org.apache.http.impl.client.CloseableHttpClient httpClient,
CrowdinAPI.HTTPMethod method,
URI uri,
Map<String,String> parameters,
Collection<org.apache.http.Header> headers,
String token,
V payload,
org.apache.http.entity.ContentType payloadContentType,
Class<T> clazz,
org.apache.maven.plugin.logging.Log logger)
Sends a HTTP request to the specified
URI using the specified
parameters. |
static org.apache.http.client.methods.CloseableHttpResponse |
sendStreamRequest(org.apache.http.impl.client.CloseableHttpClient httpClient,
CrowdinAPI.HTTPMethod method,
URI uri,
String token,
org.apache.maven.plugin.logging.Log logger)
Sends a HTTP request where the response itself is returned so that is can
be read as an
InputStream, to the specified URI using the
specified parameters. |
static FileInfo |
updateFile(org.apache.http.impl.client.CloseableHttpClient httpClient,
long projectId,
long fileId,
StorageInfo storage,
UpdateOption updateOption,
FileImportOptions importOptions,
FileExportOptions exportOptions,
Boolean replaceModifiedContext,
String token,
org.apache.maven.plugin.logging.Log logger)
Asks Crowdin to update an existing file from a file that has already been
uploaded to storage.
|
protected static final com.google.gson.Gson GSON
Gson instance used for JSON (de)serializationpublic static com.google.gson.Gson getGsonInstance()
Gson instance used for JSON (de)serialization.public static org.apache.http.impl.client.CloseableHttpClient createHTTPClient(String projectVersion, @Nullable Integer timeout) throws IOException
CloseableHttpClient instance.projectVersion - a String containing the current version of
this plugin.timeout - the timeout in seconds for HTTP operations.CloseableHttpClient.IOException - If an error occurs during the operation.@Nullable public static FolderInfo getFolder(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nullable BranchInfo branch, @Nonnull String folderPath, boolean create, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
Note: This method will not strip a path element that
doesn't end in a separator, but will consider the last element to be a
folder as well. Example: foo/bar - both foo and
bar is assumed to be folders.
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.branch - the BranchInfo if the folder belongs to a branch.folderPath - the folder path.create - if true the folder will be created if it doesn't
exist, if false the method will return null.token - the API token.logger - the Log to log to.FolderInfo if the folder exists or is
created, null otherwise.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static BranchInfo createBranch(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull String token, @Nonnull String branchName, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.token - the API token.branchName - the name of the new branch.logger - the Log to log to.BranchInfo for the newly created branch.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static List<BranchInfo> listBranches(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull String token, @Nullable String branchName, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.token - the API token.branchName - an optional filter for filtering the results.logger - the Log to log to.List of BranchInfo instances.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static BuildInfo createBuild(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull String token, @Nullable Long branchId, boolean skipUntranslatedStrings, boolean skipUntranslatedFiles, boolean exportApprovedOnly, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.token - the API token.branchId - the branch ID for the branch to build.skipUntranslatedStrings - whether to skip untranslated strings.
Can't be combined with skipUntranslatedFiles.skipUntranslatedFiles - whether to skip untranslated files. Can't be
combined with skipUntranslatedStrings.exportApprovedOnly - whether to export approved translations only.logger - the Log to log to.BuildInfo.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static BuildInfo getBuildStatus(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, long buildId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.buildId - the build ID for which to get the build status.token - the API token.logger - the Log to log to.BuildInfo.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static List<BuildInfo> listProjectBuilds(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nullable Long branchId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.branchId - the branch ID for which to list builds.token - the API token.logger - the Log to log to.List of BuildInfo instances.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static String getTranslationStatus(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.token - the API token.logger - the Log to log to.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static ProjectInfo getProjectInfo(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.token - the API token.logger - the Log to log to.ProjectInfo.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static DownloadLinkInfo getDownloadLink(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, long buildId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.buildId - the build ID for which to get a download link.token - the API token.logger - the Log to log to.DownloadLinkInfo.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static List<FileInfo> listFiles(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nullable Long branchId, @Nullable Long folderId, @Nullable String filter, boolean recursion, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.branchId - the branch ID for which to list files. Note: Can't
be used together with folderId.folderId - the folder ID for which to list files. Note: Can't
be used together with branchId.filter - an optional filter for the returned files.recursion - whether to get recurive results. Can only be used with
either branchId or folderId.token - the API token.logger - the Log to log to.List of FileInfo instances.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nullable public static FileInfo getFileIfExists(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nullable BranchInfo branch, @Nullable FolderInfo folder, @Nullable String fileName, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.branch - the branch to look in.folder - the folder to look in. Note: If specified together
with branch, folder takes precedence.fileName - the file name to look for. Note: If path elements
are present, they will be stripped and only the file name will
be used.token - the API token.logger - the Log to log to.FileInfo or null if no such file
exists.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static FileInfo getFile(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, long fileId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.fileId - the file ID for the file.token - the API token.logger - the Log to log to.FileInfo.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static List<FolderInfo> listFolders(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nullable Long branchId, @Nullable Long parentFolderId, @Nullable String filter, boolean recursion, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.branchId - the branch ID for which to list folders. Note:
Can't be used together with parentFolderId.parentFolderId - the folder ID for which to list files. Note:
Can't be used together with branchId.filter - an optional filter for the returned folders.recursion - whether to get recurive results. Can only be used with
either branchId or parentFolderId.token - the API token.logger - the Log to log to.List of FolderInfo instances.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static FolderInfo getFolder(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, long folderId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.folderId - the folder ID for the folder.token - the API token.logger - the Log to log to.FolderInfo.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static FolderInfo createFolder(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull String name, @Nullable Long branchId, @Nullable Long parentFolderId, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.name - the name of the new folder.branchId - the branch ID for the branch in which to create the new
folder. Note: Can't be used together with
parentFolderId.parentFolderId - the parent folder ID for the folder in which to
create the new folder. Note: Can't be used together
with branchId.token - the API token.logger - the Log to log to.FolderInfo for the new folder.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static FileInfo createFile(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, @Nonnull StorageInfo storage, @Nonnull String name, @Nullable FileType type, @Nullable Long branchId, @Nullable Long folderId, @Nullable String title, @Nullable String context, @Nullable String[] excludedTargetLanguages, @Nullable FileExportOptions exportOptions, @Nullable FileImportOptions importOptions, @Nullable Integer parserVersion, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.storage - the StorageInfo for the previously uploaded file.name - the name of the new file.type - the FileType for the new file.branchId - the branch ID for the branch in which to create the new
file. Note: Can't be used together with
folderId.folderId - the folder ID for the folder in which to create the new
file. Note: Can't be used together with
branchId.title - the title for the new file as shown to translators.context - the context for the new file.excludedTargetLanguages - the array of excluded target languages.exportOptions - the FileExportOptions for the new file.importOptions - the FileImportOptions for the new file.parserVersion - the parser version to use for the new file.token - the API token.logger - the Log to log to.FileInfo for the new file.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nullable public static FileInfo updateFile(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, long projectId, long fileId, @Nonnull StorageInfo storage, @Nullable UpdateOption updateOption, @Nullable FileImportOptions importOptions, @Nullable FileExportOptions exportOptions, @Nullable Boolean replaceModifiedContext, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.projectId - the Crowdin project ID.fileId - the file ID for the file to update.storage - the StorageInfo for the previously uploaded file.updateOption - the UpdateOption to use for the update.importOptions - the FileImportOptions for the file.exportOptions - the FileExportOptions for the file.replaceModifiedContext - whether to overwrite modified context
during the update.token - the API token.logger - the Log to log to.FileInfo for the updated file or null if the
file wasn't modified.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static List<StorageInfo> listStorages(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.token - the API token.logger - the Log to log to.List of StorageInfo instances.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static StorageInfo createStorage(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, @Nonnull String filename, @Nonnull org.apache.http.HttpEntity entity, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.filename - the filename for the newly created storage.entity - the HttpEntity containing the content to upload.token - the API token.logger - the Log to log to.StorageInfo for the newly created storage.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.@Nonnull public static void deleteStorage(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, @Nonnull StorageInfo storage, @Nonnull String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.maven.plugin.MojoExecutionException
httpClient - the CloseableHttpClient to use.storage - the StorageInfo for the storage to delete.token - the API token.logger - the Log to log to.org.apache.maven.plugin.MojoExecutionException - If an error occurs during the operation.public static <T,V> T sendRequest(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, @Nonnull CrowdinAPI.HTTPMethod method, @Nullable String function, @Nullable Map<String,String> parameters, @Nullable Collection<org.apache.http.Header> headers, @Nullable String token, @Nullable V payload, @Nullable org.apache.http.entity.ContentType payloadContentType, @Nonnull Class<T> clazz, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.http.HttpException
T - the type of the returned object.V - the type of the payload, if any.httpClient - the CloseableHttpClient to use.method - the CrowdinAPI.HTTPMethod to use.function - the "function" parameters to append to the API URI.parameters - a Map of query parameters to append to the
constructed URI.headers - a Collection of Headers to send.token - the API token.payload - the request content, if any.payloadContentType - the Content-Type for the payload, if
any. Note: Only used if the payload is String
or InputStream.clazz - the Class used to indicate the return type to use.logger - to Log to log to.org.apache.http.HttpException - If an error occurs during the operation.public static <T,V> T sendRequest(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, @Nonnull CrowdinAPI.HTTPMethod method, @Nonnull URI uri, @Nullable Map<String,String> parameters, @Nullable Collection<org.apache.http.Header> headers, @Nullable String token, @Nullable V payload, @Nullable org.apache.http.entity.ContentType payloadContentType, @Nonnull Class<T> clazz, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.http.HttpException
URI using the specified
parameters.T - the type of the returned object.V - the type of the payload, if any.httpClient - the CloseableHttpClient to use.method - the CrowdinAPI.HTTPMethod to use.uri - the URI to contact.parameters - a Map of query parameters to append to
uri.headers - a Collection of Headers to send.token - the API token.payload - the request content, if any.payloadContentType - the Content-Type for the payload, if
any. Note: Only used if the payload is String
or InputStream.clazz - the Class used to indicate the return type to use.logger - to Log to log to.org.apache.http.HttpException - If an error occurs during the operation.public static org.apache.http.client.methods.CloseableHttpResponse sendStreamRequest(@Nonnull org.apache.http.impl.client.CloseableHttpClient httpClient, @Nonnull CrowdinAPI.HTTPMethod method, @Nonnull URI uri, @Nullable String token, @Nullable org.apache.maven.plugin.logging.Log logger) throws org.apache.http.HttpException
InputStream, to the specified URI using the
specified parameters.
Note: This method does not close the returned response for obvious reasons, so it's the caller's responsibility to make sure it is closed.
httpClient - the CloseableHttpClient to use.method - the CrowdinAPI.HTTPMethod to use.uri - the URI to contact.token - the API token.logger - the Log to log to.CloseableHttpResponse.org.apache.http.HttpException - If an error occurs during the operation.@Nullable public static String entityToString(@Nullable org.apache.http.HttpEntity entity) throws IOException
HttpEntity to a string and returns it,
making some assumptions along the way. Assumptions are that the content
isn't very large, so that a small buffer will suffice, and that the
content is UTF-8 encoded.
Note: This method does NOT close the InputStream
after reading.
entity - the HttpEntity whose content to extract.String content.IOException - If an error occurs during the operation.Copyright © 2024. All rights reserved.