Examples of ContentBody


Examples of org.apache.http.entity.mime.content.ContentBody

     *   otherwise.
     */
    public long getTotalLength() {
        long contentLen = 0;
        for (FormBodyPart part: this.parts) {
            ContentBody body = part.getBody();
            long len = body.getContentLength();
            if (len >= 0) {
                contentLen += len;
            } else {
                return -1;
            }
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody

        addPart(new FormBodyPart(name, contentBody));
    }

    public boolean isRepeatable() {
        for (FormBodyPart part: this.multipart.getBodyParts()) {
            ContentBody body = part.getBody();
            if (body.getContentLength() < 0) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody

     *   otherwise.
     */
    public long getTotalLength() {
        long contentLen = 0;
        for (final FormBodyPart part: getBodyParts()) {
            final ContentBody body = part.getBody();
            final long len = body.getContentLength();
            if (len >= 0) {
                contentLen += len;
            } else {
                return -1;
            }
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody

     *   otherwise.
     */
    public long getTotalLength() {
        long contentLen = 0;
        for (final FormBodyPart part: getBodyParts()) {
            final ContentBody body = part.getBody();
            final long len = body.getContentLength();
            if (len >= 0) {
                contentLen += len;
            } else {
                return -1;
            }
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody

        return jsonObject.getAsJsonPrimitive("id").getAsString();
    }

    public JsonObject uploadInputStream(String url, String field, final InputStream inputStream,
                                        final long contentLength, String fileName) throws IOException {
        ContentBody contentBody = new InputStreamBody(inputStream, fileName) {
            @Override
            public long getContentLength() {
                return contentLength;
            }
        };
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody

        };
        return uploadContentBody(url, field, contentBody);
    }

    public JsonObject uploadFile(String url, String field, File file) throws IOException {
        ContentBody contentBody = new FileBody(file, "multipart/form-data");
        return uploadContentBody(url, field, contentBody);
    }
View Full Code Here

Examples of org.apache.http.entity.mime.content.ContentBody

 
    public boolean isRepeatable() {
        List<?> parts = this.multipart.getBodyParts();
        for (Iterator<?> it = parts.iterator(); it.hasNext(); ) {
            FormBodyPart part = (FormBodyPart) it.next();
            ContentBody body = (ContentBody) part.getBody();
            if (body.getContentLength() < 0) {
                return false;
            }
        }
        return true;
    }
View Full Code Here

Examples of org.apache.qpid.framing.ContentBody

    }

    public AMQBody convertToBody(ContentChunk contentChunk)
    {
        return new ContentBody(contentChunk.getData());
    }
View Full Code Here

Examples of org.apache.qpid.framing.ContentBody

        return new ContentBody(contentChunk.getData());
    }

    public ContentChunk convertToContentChunk(AMQBody body)
    {
        final ContentBody contentBodyChunk = (ContentBody) body;

        return new ContentChunk()
        {

            public int getSize()
            {
                return contentBodyChunk.getSize();
            }

            public byte[] getData()
            {
                return contentBodyChunk.getPayload();
            }

            public void reduceToFit()
            {
                contentBodyChunk.reduceBufferToFit();
            }
        };

    }
View Full Code Here

Examples of org.apache.qpid.framing.ContentBody

    }

    public AMQBody convertToBody(byte[] data)
    {
        return new ContentBody(data);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.