Package com.microsoft.windowsazure.core.utils

Examples of com.microsoft.windowsazure.core.utils.InputStreamDataSource


        ByteArrayOutputStream httpRequest = new ByteArrayOutputStream();
        addHttpMethod(httpRequest, verb, uri);
        appendHeaders(httpRequest, headers);
        appendEntity(httpRequest, new ByteArrayInputStream(bytes));

        DataSource bodyPartContent = new InputStreamDataSource(
                new ByteArrayInputStream(httpRequest.toByteArray()),
                "application/http");
        return bodyPartContent;
    }
View Full Code Here


     * @throws IOException
     *             Signals that an I/O exception has occurred.
     */
    private List<DataSource> parsePartsCore(InputStream entityInputStream,
            String contentType) throws MessagingException, IOException {
        DataSource dataSource = new InputStreamDataSource(entityInputStream,
                contentType);
        MimeMultipart batch = new MimeMultipart(dataSource);
        MimeBodyPart batchBody = (MimeBodyPart) batch.getBodyPart(0);

        MimeMultipart changeSets = new MimeMultipart(new MimePartDataSource(
                batchBody));

        List<DataSource> result = new ArrayList<DataSource>();
        for (int i = 0; i < changeSets.getCount(); i++) {
            BodyPart part = changeSets.getBodyPart(i);

            result.add(new InputStreamDataSource(part.getInputStream(), part
                    .getContentType()));
        }
        return result;
    }
View Full Code Here

        String httpResponse = "HTTP/1.1 200 OK";
        int expectedStatus = 200;
        String expectedReason = "OK";
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
                httpResponse.getBytes());
        DataSource dataSource = new InputStreamDataSource(byteArrayInputStream,
                "defaultContentType");

        // Act
        StatusLine statusLine = StatusLine.create(dataSource);
View Full Code Here

        String httpResponse = "HTTP/1.1 200 OK";
        int expectedStatus = 300;
        String expectedReason = "NotOK";
        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(
                httpResponse.getBytes());
        DataSource dataSource = new InputStreamDataSource(byteArrayInputStream,
                "defaultContentType");
        StatusLine statusLine = StatusLine.create(dataSource);

        // Act
        statusLine.setStatus(expectedStatus);
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.core.utils.InputStreamDataSource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.