Search in sources :

Example 1 with Payer

use of com.amazonaws.services.s3.model.RequestPaymentConfiguration.Payer in project aws-sdk-android by aws-amplify.

the class RequestPaymentConfigurationXmlFactory method convertToXmlByteArray.

/**
 * Converts the specified request payment configuration into an XML byte
 * array to send to Amazon S3. Sample XML: <RequestPaymentConfiguration
 * xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <Payer>Requester</Payer>
 * </RequestPaymentConfiguration>
 *
 * @param requestPaymentConfiguration The request payment configuration
 *            request to convert..
 * @return The XML byte array representation.
 */
public byte[] convertToXmlByteArray(RequestPaymentConfiguration requestPaymentConfiguration) {
    XmlWriter xml = new XmlWriter();
    xml.start("RequestPaymentConfiguration", "xmlns", Constants.XML_NAMESPACE);
    Payer payer = requestPaymentConfiguration.getPayer();
    if (payer != null) {
        XmlWriter payerDocumentElement = xml.start("Payer");
        payerDocumentElement.value(payer.toString());
        payerDocumentElement.end();
    }
    xml.end();
    return xml.getBytes();
}
Also used : Payer(com.amazonaws.services.s3.model.RequestPaymentConfiguration.Payer) XmlWriter(com.amazonaws.services.s3.internal.XmlWriter)

Aggregations

XmlWriter (com.amazonaws.services.s3.internal.XmlWriter)1 Payer (com.amazonaws.services.s3.model.RequestPaymentConfiguration.Payer)1