us.monoid.web
Class Content

java.lang.Object
  extended by us.monoid.web.AbstractContent
      extended by us.monoid.web.Content
Direct Known Subclasses:
FormContent

public class Content
extends AbstractContent

Class to encapsulate content being sent as payload of a POST or PUT request. You can use Resty.content(...) to create content objects.

Author:
beders

Field Summary
 
Fields inherited from class us.monoid.web.AbstractContent
CRLF
 
Constructor Summary
Content(String aMimeType, byte[] someBytes)
          Create a new content object with given mime type and the content as bytes.
 
Method Summary
 void writeContent(OutputStream os)
           
 void writeHeader(OutputStream os)
          Used as a mime part, writing content headers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Content

public Content(String aMimeType,
               byte[] someBytes)
Create a new content object with given mime type and the content as bytes. No check if mime type is 'valid' or similar non-sense is done. You are all grown-ups.

Parameters:
aMimeType - the mime type. example: text/plain;charset=UTF-8
someBytes - the content to deliver as bytes
Method Detail

writeContent

public void writeContent(OutputStream os)
                  throws IOException
Specified by:
writeContent in class AbstractContent
Throws:
IOException

writeHeader

public void writeHeader(OutputStream os)
                 throws IOException
Used as a mime part, writing content headers

Specified by:
writeHeader in class AbstractContent
Throws:
IOException


Copyright © 2013. All Rights Reserved.