Search in sources :

Example 26 with XmlWriter

use of com.amazonaws.services.s3.internal.XmlWriter in project aws-sdk-android by aws-amplify.

the class ObjectTaggingXmlFactory method convertToXmlByteArray.

public byte[] convertToXmlByteArray(ObjectTagging tagging) {
    XmlWriter writer = new XmlWriter();
    writer.start("Tagging").start("TagSet");
    for (Tag tag : tagging.getTagSet()) {
        writer.start("Tag");
        writer.start("Key").value(tag.getKey()).end();
        writer.start("Value").value(tag.getValue()).end();
        // </Tag>
        writer.end();
    }
    // </TagSet>
    writer.end();
    // </Tagging>
    writer.end();
    return writer.getBytes();
}
Also used : Tag(com.amazonaws.services.s3.model.Tag) XmlWriter(com.amazonaws.services.s3.internal.XmlWriter)

Example 27 with XmlWriter

use of com.amazonaws.services.s3.internal.XmlWriter 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)19 RedirectRule (com.amazonaws.services.s3.model.RedirectRule)3 NoncurrentVersionTransition (com.amazonaws.services.s3.model.BucketLifecycleConfiguration.NoncurrentVersionTransition)2 CORSRule (com.amazonaws.services.s3.model.CORSRule)2 FilterRule (com.amazonaws.services.s3.model.FilterRule)2 ReplicationRule (com.amazonaws.services.s3.model.ReplicationRule)2 RoutingRule (com.amazonaws.services.s3.model.RoutingRule)2 Map (java.util.Map)2 AmazonClientException (com.amazonaws.AmazonClientException)1 Rule (com.amazonaws.services.s3.model.BucketLifecycleConfiguration.Rule)1 Transition (com.amazonaws.services.s3.model.BucketLifecycleConfiguration.Transition)1 BucketNotificationConfiguration (com.amazonaws.services.s3.model.BucketNotificationConfiguration)1 TopicConfiguration (com.amazonaws.services.s3.model.BucketNotificationConfiguration.TopicConfiguration)1 AllowedMethods (com.amazonaws.services.s3.model.CORSRule.AllowedMethods)1 CloudFunctionConfiguration (com.amazonaws.services.s3.model.CloudFunctionConfiguration)1 KeyVersion (com.amazonaws.services.s3.model.DeleteObjectsRequest.KeyVersion)1 Filter (com.amazonaws.services.s3.model.Filter)1 Grant (com.amazonaws.services.s3.model.Grant)1 LambdaConfiguration (com.amazonaws.services.s3.model.LambdaConfiguration)1 NotificationConfiguration (com.amazonaws.services.s3.model.NotificationConfiguration)1