}
@Override
public void composeObject(Iterable<String> source, GcsFilename dest, long timeoutMillis)
throws IOException {
HTTPRequest req =
makeRequest(dest, COMPOSE_QUERY_STRINGS, PUT, timeoutMillis, headers);
StringBuilder xmlContent = new StringBuilder(Iterables.size(source) * 50);
xmlContent.append("<ComposeRequest>");
Escaper escaper = XmlEscapers.xmlContentEscaper();
for (String srcFileName : source) {
xmlContent.append("<Component><Name>");
xmlContent.append(escaper.escape(srcFileName));
xmlContent.append("</Name></Component>");
}
xmlContent.append("</ComposeRequest>");
byte[] payload = xmlContent.toString().getBytes(UTF_8);
req.setHeader(new HTTPHeader(CONTENT_LENGTH, String.valueOf(payload.length)));
req.setPayload(payload);
HTTPResponse resp;
try {
resp = urlfetch.fetch(req);
} catch (IOException e) {
throw createIOException(new HTTPRequestInfo(req), e);