com.infoengine.SAK
Class Content

java.lang.Object
  extended bycom.infoengine.SAK.Content

public class Content
extends Object

This class provides access to one part of a MIME multipart object stream.


Field Summary
private  String contentType
           
private  String disposition
           
private  String fileName
           
private  Hashtable headers
           
private  InputStream inputStream
           
private  String name
           
 
Constructor Summary
Content(ContentInputStream inputStream)
          Constructor that initializes the instance to read from a multipart MIME stream.
Content(InputStream inputStream, String contentType)
          Constructor that initializes the instance to read from a non-multipart MIME stream.
 
Method Summary
 String getContentType()
          Return the MIME type of the content.
 String getDisposition()
          Return the disposition of the content.
 String getFileName()
          Return the file name of the content.
 String getHeader(String key)
          Return the text specified in a MIME header associated with the content object.
 Enumeration getHeaderKeys()
          Return an Enumeration of all MIME header keywords associated with the content object.
 InputStream getInputStream()
          Return an input stream that can be used to read the body of the content object.
 String getName()
          Return the name of the content.
 String toString()
          Read the body of the content object, and return it as a String.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

contentType

private String contentType

disposition

private String disposition

fileName

private String fileName

headers

private Hashtable headers

inputStream

private InputStream inputStream

name

private String name
Constructor Detail

Content

public Content(InputStream inputStream,
               String contentType)
Constructor that initializes the instance to read from a non-multipart MIME stream.

Parameters:
inputStream - input stream
contentType - MIME content type associated with the input stream

Content

public Content(ContentInputStream inputStream)
Constructor that initializes the instance to read from a multipart MIME stream.

Parameters:
inputStream - input stream
Method Detail

getContentType

public String getContentType()
Return the MIME type of the content.

Returns:
The MIME type

getDisposition

public String getDisposition()
Return the disposition of the content. A common disposition is "form-data", indicating that the content is an element from a submitted HTML form.

Returns:
The disposition type

getName

public String getName()
Return the name of the content. When the content is an element of a submitted HTML form, the name will usually be the name of the form variable associated with the content.

Returns:
The name of the content

getFileName

public String getFileName()
Return the file name of the content. When the content is an element of a submitted HTML form, and the element represents file content being uploaded via the form, the element will usually have a file name component.

Returns:
The file name associated with the content, or null if the content is not associated with a file name

getHeader

public String getHeader(String key)
Return the text specified in a MIME header associated with the content object.

Parameters:
key - the MIME header keyword
Returns:
The text of the header identified by the keyword, or null if the content object does not have a header with the specified keyword

getHeaderKeys

public Enumeration getHeaderKeys()
Return an Enumeration of all MIME header keywords associated with the content object.

Returns:
The list of header keywords associated with the content object

getInputStream

public InputStream getInputStream()
Return an input stream that can be used to read the body of the content object.

Returns:
An input stream that be used to read the body of the content object

toString

public String toString()
Read the body of the content object, and return it as a String.

Returns:
A String containing the body of the content object