public class MimeUtil extends Object
| Constructor and Description |
|---|
MimeUtil() |
| Modifier and Type | Method and Description |
|---|---|
static StringBuilder |
convertDispositionObjectToString(StringBuilder dispositionBuilder,
BStruct contentDispositionStruct) |
static BStruct |
createEntityError(Context context,
String msg)
Get entity error as a ballerina struct.
|
static BStruct |
extractEntity(BStruct httpMessageStruct) |
static String |
getBaseType(BStruct entity)
Given a ballerina entity, get the content-type as a base type.
|
static String |
getContentDisposition(BStruct entity)
Given a ballerina entity, build the content-disposition header value from 'ContentDisposition' object.
|
static String |
getContentTypeWithParameters(BStruct entity)
Given a ballerina entity, get the content-type with parameters included.
|
static String |
getNewMultipartDelimiter()
Get a new multipart boundary delimiter.
|
static BStruct |
getParserError(Context context,
String errMsg)
Get parser error as a ballerina struct.
|
static String |
includeQuotes(String textValue)
Surround the given value with quotes.
|
static boolean |
isNotNullAndEmpty(String textValue)
Check whether the given string is not null and empty.
|
static BStruct |
parseMediaType(BStruct mediaType,
String contentType)
Parse 'MediaType' struct with the given Content-Type.
|
static void |
populateContentDispositionObject(BStruct contentDisposition,
String contentDispositionHeaderWithParams) |
static void |
setContentDisposition(BStruct contentDisposition,
BStruct bodyPart,
String contentDispositionHeaderWithParams)
Populate ContentDisposition struct and set it to body part.
|
static void |
setContentLength(BStruct entityStruct,
int length)
Populate given 'Entity' with it's body size.
|
static void |
setContentType(BStruct mediaType,
BStruct entityStruct,
String contentType)
Construct 'MediaType' struct with the given Content-Type and set it into the given 'Entity'.
|
static void |
setMediaTypeToEntity(Context context,
BStruct entityStruct,
String contentType) |
static void |
writeInputToOutputStream(InputStream inputStream,
OutputStream outputStream)
Write a given inputstream to a given outputstream.
|
public static String getBaseType(BStruct entity)
entity - Represent an 'Entity'public static String getContentTypeWithParameters(BStruct entity)
entity - Represent an 'Entity'public static void setContentType(BStruct mediaType, BStruct entityStruct, String contentType)
mediaType - Represent 'MediaType' structentityStruct - Represent 'Entity' structcontentType - Content-Type value in stringpublic static BStruct parseMediaType(BStruct mediaType, String contentType)
mediaType - Represent 'MediaType' structcontentType - Content-Type value in stringpublic static void setMediaTypeToEntity(Context context, BStruct entityStruct, String contentType)
public static void setContentDisposition(BStruct contentDisposition, BStruct bodyPart, String contentDispositionHeaderWithParams)
contentDisposition - Represent the ContentDisposition struct that needs to be filledbodyPart - Represent a body partcontentDispositionHeaderWithParams - Represent Content-Disposition header value with parameterspublic static void populateContentDispositionObject(BStruct contentDisposition, String contentDispositionHeaderWithParams)
public static String getContentDisposition(BStruct entity)
entity - Represent an 'Entity'public static StringBuilder convertDispositionObjectToString(StringBuilder dispositionBuilder, BStruct contentDispositionStruct)
public static void setContentLength(BStruct entityStruct, int length)
entityStruct - Represent 'Entity'length - Size of the entity bodypublic static void writeInputToOutputStream(InputStream inputStream, OutputStream outputStream) throws IOException
outputStream - Represent the outputstream that the inputstream should be written toinputStream - Represent the inputstream that that needs to be written to outputstreamIOException - When an error occurs while writing inputstream to outputstreampublic static boolean isNotNullAndEmpty(String textValue)
textValue - Represent a text valuepublic static String includeQuotes(String textValue)
textValue - Represent a text valuepublic static String getNewMultipartDelimiter()
public static BStruct createEntityError(Context context, String msg)
context - Represent ballerina contextmsg - Error message in string formCopyright © 2018 WSO2. All rights reserved.