sg.edu.nyp.drmPublisher
Class MIMEType

java.lang.Object
  extended bysg.edu.nyp.drmPublisher.MIMEType

public class MIMEType
extends java.lang.Object

Author:
Pierre Trocme

Constructor Summary
MIMEType()
          Create a new MIMEType object.
 
Method Summary
static java.lang.String generateRandomBoundaryString()
          Generate a random MIME boundary String.
 java.lang.String getMIMEContentType(java.io.File file)
          Return the MIME content type associated with the given file.
 java.lang.String getMIMEContentType(java.lang.String fileExtension)
          Return the MIME content type associated with the given file extension.
static boolean isValidBoundaryString(java.lang.String string)
          A filter for RFC2046 compliants bondaryStrings.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIMEType

public MIMEType()
Create a new MIMEType object.

Method Detail

getMIMEContentType

public java.lang.String getMIMEContentType(java.lang.String fileExtension)
Return the MIME content type associated with the given file extension.

Parameters:
fileExtension - the extension to be used for retrieving the file description
Returns:
the MIME content type description

getMIMEContentType

public java.lang.String getMIMEContentType(java.io.File file)
Return the MIME content type associated with the given file.

Parameters:
file - file whose type will be retrieved.
Returns:
the MIME content type description.

isValidBoundaryString

public static boolean isValidBoundaryString(java.lang.String string)
A filter for RFC2046 compliants bondaryStrings. The string is matched against
[a-zA-Z0-9'/()+_,-.:=?]+
. If its lenght is at least 1 and no more than 70, the string is considered as RFC2046 compliant.

Parameters:
string - the string to test.
Returns:
true if the string is a valid boudary string, else return false.

generateRandomBoundaryString

public static java.lang.String generateRandomBoundaryString()
Generate a random MIME boundary String.

Returns:
the generated String.