public static byte[] convertToXmlByteArray(RestoreObjectRequest restoreObjectRequest) throws SdkClientException {

        XmlWriter xml = new XmlWriter();

        xml.start("RestoreRequest");
        if (restoreObjectRequest.getExpirationInDays() != -1) {
            xml.start("Days").value(Integer.toString(restoreObjectRequest.getExpirationInDays())).end();
        }

        final GlacierJobParameters glacierJobParameters = restoreObjectRequest.getGlacierJobParameters();
        if (glacierJobParameters != null) {
            xml.start("GlacierJobParameters");
            addIfNotNull(xml, "Tier", glacierJobParameters.getTier());
            xml.end();
        }
        addIfNotNull(xml, "Type", restoreObjectRequest.getType());
        addIfNotNull(xml, "Tier", restoreObjectRequest.getTier());
        addIfNotNull(xml, "Description", restoreObjectRequest.getDescription());

        addSelectParametersIfNotNull(xml, restoreObjectRequest.getSelectParameters());
        addOutputLocationIfNotNull(xml, restoreObjectRequest.getOutputLocation());
        xml.end();

        return xml.getBytes();
    }
Converts the RestoreObjectRequest to an XML fragment that can be sent to
the RestoreObject operation of Amazon S3.

@param restoreObjectRequest
           The container which provides options for restoring an object,
           which was transitioned to the Glacier from S3 when it was
           expired, into S3 again.

@return A byte array containing the data

@throws SdkClientException
aws-java-sdk-s3/src/main/java/com/amazonaws/services/s3/model/transform/RequestXmlFactory.java