Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.lutris.mime
Class MimeHeader  view MimeHeader download MimeHeader.java

java.lang.Object
  extended bycom.lutris.mime.MimeHeader
Direct Known Subclasses:
ContentHeader

public class MimeHeader
extends java.lang.Object

Represents a generic parsed Mime header. Specific header types, such as Content-Type are represented by classes derived from this header. The constructor for this class parses only parameters according to the rules specified in RFC2045 Section 5.1 Page 11. It is left to derived classes to parse type-specifiec information such as the Mime type (Content-Type) or content disposition (Content-Disposition).


Field Summary
private  java.lang.String myHeaderType
          Contains the Mime header type value, defined as the characters before the first colon (':') character.
private  java.util.Hashtable myParams
          Contains the parsed parameters for this hash table.
private  java.lang.String myValue
          Contains the type-independent value (if any) for the header.
private  java.lang.String rawHeaderLine
          The raw, unparsed header line passed to the constructor.
 
Constructor Summary
MimeHeader(java.lang.String headerLine)
          Constructs a generic MimeHeader object and initializes its internal parameter list.
 
Method Summary
 java.lang.String getHeaderType()
          Returns the header type of this header.
 java.lang.String getParameter(java.lang.String name)
          Returns a single String value representing the last occurence of the parameter named by name.
 java.util.Enumeration getParameterNames()
          Returns an enumeration of all of the parameter names parsed from the current Mime header.
 java.lang.String[] getParameters(java.lang.String name)
          Returns an array of String containing all occurences of values named by name.
 java.lang.String getRawHeaderLine()
          Returns the string passed to the constructor without any parsing.
 java.lang.String getValue()
          Returns the "value" of this header.
protected  void parseParameters(java.lang.String headerLine)
          Parses the a given string into key=parameter pairs in accordance with RFC2045 Section 5.1 Page 11.
private  java.lang.String parseQuotedString(java.io.PushbackReader input)
           
private  java.lang.String parseToken(java.io.PushbackReader input, boolean trim)
           
protected  void putParameter(java.lang.String name, java.lang.String value)
          Used by derived classes to put a parameter into the internal parameter value holder.
private static void skipComment(java.io.PushbackReader input)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

myParams

private java.util.Hashtable myParams
Contains the parsed parameters for this hash table.


myValue

private java.lang.String myValue
Contains the type-independent value (if any) for the header.


myHeaderType

private java.lang.String myHeaderType
Contains the Mime header type value, defined as the characters before the first colon (':') character.


rawHeaderLine

private java.lang.String rawHeaderLine
The raw, unparsed header line passed to the constructor.

Constructor Detail

MimeHeader

public MimeHeader(java.lang.String headerLine)
Constructs a generic MimeHeader object and initializes its internal parameter list.

Method Detail

putParameter

protected void putParameter(java.lang.String name,
                            java.lang.String value)
Used by derived classes to put a parameter into the internal parameter value holder.


getValue

public java.lang.String getValue()
Returns the "value" of this header. This is defined to be the trimmed substring between the first colon (':') character and the first semicolon (';') character. For example, observe the following header line:
 	Content-Type: multipart/form-data; boundary="000572A9AD4"
 
The value of this header is multipart/form-data, the header type is Content-Type, and the first parameter is named boundary and has the value 00572A9AD4.


getHeaderType

public java.lang.String getHeaderType()
Returns the header type of this header. This is defined to be the substring from the first character up to first colon (':') character. For example, observe the following header line:
 	Content-Type: multipart/form-data; boundary="000572A9AD4"
 
The value of this header is multipart/form-data, the header type is Content-Type, and the first parameter is named boundary and has the value 00572A9AD4.


getRawHeaderLine

public java.lang.String getRawHeaderLine()
Returns the string passed to the constructor without any parsing.


getParameter

public java.lang.String getParameter(java.lang.String name)
Returns a single String value representing the last occurence of the parameter named by name. For example, observe the following header line:
 	Content-Type: multipart/form-data; boundary="000572A9AD4"
 
The value of this header is multipart/form-data, the header type is Content-Type, and the first parameter is named boundary and has the value 00572A9AD4.


getParameters

public java.lang.String[] getParameters(java.lang.String name)
Returns an array of String containing all occurences of values named by name. For example, observe the following header line:
 	Content-Type: multipart/form-data; boundary="000572A9AD4"
 
The value of this header is multipart/form-data, the header type is Content-Type, and the first parameter is named boundary and has the value 00572A9AD4.


getParameterNames

public java.util.Enumeration getParameterNames()
Returns an enumeration of all of the parameter names parsed from the current Mime header.


skipComment

private static void skipComment(java.io.PushbackReader input)
                         throws java.io.IOException

parseToken

private final java.lang.String parseToken(java.io.PushbackReader input,
                                          boolean trim)
                                   throws java.io.IOException

parseQuotedString

private final java.lang.String parseQuotedString(java.io.PushbackReader input)
                                          throws java.io.IOException

parseParameters

protected void parseParameters(java.lang.String headerLine)
Parses the a given string into key=parameter pairs in accordance with RFC2045 Section 5.1 Page 11. Quoted strings are parsed in accordance with the RFC822 definition of the "quoted-string" grammatic construct. According to RFC822, quoted strings are strings, enclosed in double-quote marks, which contain any character except LF or double-quote. The backslash character is used to literally quote the following character. Octal or hex code backquoting is not supported.