lindhorst.servlet.http
Class ReadableMultipartBlock

java.lang.Object
  |
  +--lindhorst.servlet.http.ReadableMultipartBlock

public class ReadableMultipartBlock
extends java.lang.Object

A class representing one block in a Multipart Request. If instantiated given the raw byte data, it will be decoded and can then be used to access the information contained in it.


Constructor Summary
ReadableMultipartBlock(byte[] rawData)
          converts the raw data beginning with a boundary to information accessible by this object's getXXX methods
 
Method Summary
 java.lang.String getBlockAsString()
           
 byte[] getContentData()
           
 java.lang.String getContentName()
           
 java.lang.String getContentType()
           
 java.lang.String getParameterName()
          returns the name of the parameter contained in this block
 java.lang.String getParameterValue()
          returns the value of this block if it holds a text-based parameter
 byte[] getRawData()
           
 boolean isNormalParameter()
          determines if this block holds a normal text-based parameter
 boolean isUploadedContent()
          determines whether this block holds content
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReadableMultipartBlock

public ReadableMultipartBlock(byte[] rawData)
                       throws java.io.IOException
converts the raw data beginning with a boundary to information accessible by this object's getXXX methods

Parameters:
rawData - the byte array holding this block's raw data
Method Detail

isUploadedContent

public boolean isUploadedContent()
determines whether this block holds content

Returns:
true if this block holds a content parameter, false otherwise

isNormalParameter

public boolean isNormalParameter()
determines if this block holds a normal text-based parameter

Returns:
true if this block holds a normal parameter, false otherwise

getParameterName

public java.lang.String getParameterName()
returns the name of the parameter contained in this block

Returns:
the parameter name of this block

getParameterValue

public java.lang.String getParameterValue()
                                   throws java.lang.IllegalAccessException
returns the value of this block if it holds a text-based parameter

Returns:
the value of this block (text-based)
Throws:
java.lang.IllegalAccessException - if this block holds a content parameter

getContentType

public java.lang.String getContentType()
                                throws java.lang.IllegalAccessException
Returns:
the content type of this block's content
Throws:
java.lang.IllegalAccessException - if this block holds text-based information

getContentName

public java.lang.String getContentName()
                                throws java.lang.IllegalAccessException
Returns:
the filename assigned to the content's file
Throws:
java.lang.IllegalAccessException - if this block holds text-based information

getContentData

public byte[] getContentData()
                      throws java.lang.IllegalAccessException
Returns:
a byte array holding this block's content's data
Throws:
java.lang.IllegalAccessException - if this block holds text-based information

getBlockAsString

public java.lang.String getBlockAsString()
Returns:
this block's String representation

getRawData

public byte[] getRawData()
Returns:
this block's raw data as bytes