public class EntityBodyHandler extends Object
Constructor and Description |
---|
EntityBodyHandler() |
Modifier and Type | Method and Description |
---|---|
static void |
addMessageDataSource(BMap<String,BValue> entityStruct,
BValue messageDataSource)
Associate a given message data source with a given entity.
|
static boolean |
checkEntityBodyAvailability(BMap<String,BValue> entityStruct)
Check whether the entity body is present.
|
static BByteArray |
constructBlobDataSource(BMap<String,BValue> entityStruct)
Construct BlobDataSource from the underneath byte channel which is associated with the entity struct.
|
static BRefType<?> |
constructJsonDataSource(BMap<String,BValue> entityStruct)
Construct JsonDataSource from the underneath byte channel which is associated with the entity struct.
|
static BString |
constructStringDataSource(BMap<String,BValue> entityStruct)
Construct StringDataSource from the underneath byte channel which is associated with the entity struct.
|
static BXML |
constructXmlDataSource(BMap<String,BValue> entityStruct)
Construct XMl data source from the underneath byte channel which is associated with the entity struct.
|
static void |
decodeEntityBody(Context context,
BMap<String,BValue> entityStruct,
Channel byteChannel)
Decode a given entity body to get a set of child parts and set them to parent entity's multipart data field.
|
static BRefValueArray |
getBodyPartArray(BMap<String,BValue> entityStruct)
Extract body parts from a given entity.
|
static Channel |
getByteChannel(BMap<String,BValue> entityStruct) |
static TempFileIOChannel |
getByteChannelForTempFile(String temporaryFilePath)
Given a temp file location, create a byte channel.
|
static EntityWrapper |
getEntityWrapper(String textPayload)
Get a byte channel for a given text data.
|
static BValue |
getMessageDataSource(BMap<String,BValue> entityStruct)
Get the message data source associated with a given entity.
|
static void |
populateBodyContent(BMap<String,BValue> bodyPart,
org.jvnet.mimepull.MIMEPart mimePart)
Populate ballerina body parts with actual body content.
|
static void |
writeByteChannelToOutputStream(BMap<String,BValue> entityStruct,
OutputStream messageOutputStream)
Write byte channel stream directly into outputstream without converting it to a data source.
|
public static EntityWrapper getEntityWrapper(String textPayload)
textPayload
- Text data that needs to be wrapped in a byte channelpublic static TempFileIOChannel getByteChannelForTempFile(String temporaryFilePath)
temporaryFilePath
- Temporary file pathpublic static BValue getMessageDataSource(BMap<String,BValue> entityStruct)
entityStruct
- Represent a ballerina entitypublic static void addMessageDataSource(BMap<String,BValue> entityStruct, BValue messageDataSource)
entityStruct
- Represent the ballerina entitymessageDataSource
- which represent the entity body in memorypublic static BByteArray constructBlobDataSource(BMap<String,BValue> entityStruct) throws IOException
entityStruct
- Represent an entity structIOException
- In case an error occurred while creating blob data sourcepublic static BRefType<?> constructJsonDataSource(BMap<String,BValue> entityStruct)
entityStruct
- Represent an entity structpublic static BXML constructXmlDataSource(BMap<String,BValue> entityStruct)
entityStruct
- Represent an entity structpublic static BString constructStringDataSource(BMap<String,BValue> entityStruct)
entityStruct
- Represent an entity structpublic static boolean checkEntityBodyAvailability(BMap<String,BValue> entityStruct)
entityStruct
- Represent an 'Entity'public static void populateBodyContent(BMap<String,BValue> bodyPart, org.jvnet.mimepull.MIMEPart mimePart)
bodyPart
- Represent ballerina body partmimePart
- Represent decoded mime partpublic static void writeByteChannelToOutputStream(BMap<String,BValue> entityStruct, OutputStream messageOutputStream) throws IOException
entityStruct
- Represent a ballerina entitymessageOutputStream
- Represent the outputstream that the message should be written toIOException
- When an error occurs while writing inputstream to outputstreampublic static void decodeEntityBody(Context context, BMap<String,BValue> entityStruct, Channel byteChannel)
context
- Represent the ballerina contextentityStruct
- Parent entity that the nested parts residebyteChannel
- Represent ballerina specific byte channelpublic static BRefValueArray getBodyPartArray(BMap<String,BValue> entityStruct)
entityStruct
- Represent a ballerina entityCopyright © 2018 WSO2. All rights reserved.