ElegantJCharts Java API Specification v2.0

com.elegantj.net.message
Class MIME

java.lang.Object
  |
  +--com.elegantj.net.message.MIME

public class MIME
extends java.lang.Object

This Class provides support for MIME


Constructor Summary
MIME()
          The default constructor which constructs a MIME object with MIME Version 1.0
MIME(java.lang.String ver)
          The constructor which constructs a MIME object with specified MIME Version
 
Method Summary
 byte[] decodeMessage(byte[] encodedMessage)
          Method to decode the message specified in byte buffer
 java.lang.String decodeMessage(java.lang.String encodedMessage, java.lang.String encodingType)
          Method to decode the specified message
 byte[] decodeMessageData(java.lang.String encodedData, java.lang.String encoding)
          Method to decode the specified string
static byte[] doBASE64Decoding(byte[] buf)
          Method to perform BASE64 decoding
static void doBASE64Decoding(java.io.FileInputStream fin, java.io.FileOutputStream fout)
          Method to perform BASE64 decoding
static java.lang.String doBASE64Decoding(java.lang.String buf)
          Method to perform BASE64 decoding
static byte[] doBASE64Encoding(byte[] buf)
          Method to perform BASE64 encoding
static java.lang.String doBASE64Encoding(java.lang.String buf)
          Method to perform BASE64 encoding
 java.lang.String getContentDisposition(java.lang.String ctype)
          Method to get Content-Disposition from the content-type
 java.lang.String getContentTransferEncoding(java.lang.String ctype)
          Method to get Content-Transfer-Encoding scheme from the content-type
 java.lang.String getContentType(java.lang.String fileName)
          Method to get the MIME type of the file from its extension
 java.lang.String getPrimaryType(java.lang.String ctype)
          Method to get primary-type from the content-type
 void printTable()
          A utility method to print content of hashtable of file-extensions and its content type.
 byte[] setByteArrayAsPart(byte[] byteBuffer, java.lang.String ctype)
          Method to set the specified byte buffer as part of the message
 byte[] setFileAsPart(java.lang.String fname)
          Method to set the specified file as part of the message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MIME

public MIME()
The default constructor which constructs a MIME object with MIME Version 1.0


MIME

public MIME(java.lang.String ver)
The constructor which constructs a MIME object with specified MIME Version

Parameters:
ver - The MIME version
Method Detail

printTable

public void printTable()
A utility method to print content of hashtable of file-extensions and its content type.


getContentType

public java.lang.String getContentType(java.lang.String fileName)
Method to get the MIME type of the file from its extension

Parameters:
fileName - The name of the file
Returns:
The content-type of the specified file name

getPrimaryType

public java.lang.String getPrimaryType(java.lang.String ctype)
Method to get primary-type from the content-type

Parameters:
ctype - The content-type
Returns:
The primary-type of the specified content-type

getContentTransferEncoding

public java.lang.String getContentTransferEncoding(java.lang.String ctype)
Method to get Content-Transfer-Encoding scheme from the content-type

Parameters:
ctype - The content-type
Returns:
The Content-Transfer-Encoding scheme

getContentDisposition

public java.lang.String getContentDisposition(java.lang.String ctype)
Method to get Content-Disposition from the content-type

Parameters:
ctype - The content-type
Returns:
The Content-Disposition

doBASE64Encoding

public static java.lang.String doBASE64Encoding(java.lang.String buf)
Method to perform BASE64 encoding

Parameters:
buf - The string to be encoded
Returns:
The encoded string

doBASE64Encoding

public static byte[] doBASE64Encoding(byte[] buf)
Method to perform BASE64 encoding

Parameters:
buf - The array of bytes to be encoded
Returns:
The encoded array of bytes

doBASE64Decoding

public static java.lang.String doBASE64Decoding(java.lang.String buf)
Method to perform BASE64 decoding

Parameters:
buf - The string to be decoded, which is encoded using BASE64 scheme
Returns:
The decoded string

doBASE64Decoding

public static void doBASE64Decoding(java.io.FileInputStream fin,
                                    java.io.FileOutputStream fout)
Method to perform BASE64 decoding

Parameters:
fin - The file which we want to decode, and which contents is encoded using BASE64 scheme
fout - The file in which we want to write decoded data

doBASE64Decoding

public static byte[] doBASE64Decoding(byte[] buf)
Method to perform BASE64 decoding

Parameters:
buf - The array of byte which content we want to decode, and which content is encoded using BASE64 scheme
Returns:
The array of bytes which contains decoded data

setFileAsPart

public byte[] setFileAsPart(java.lang.String fname)
                     throws java.io.FileNotFoundException,
                            java.io.IOException
Method to set the specified file as part of the message

Parameters:
fname - The name of the file which we want to set as a part of the message
Returns:
The array of byte which contains the part of the message
java.io.FileNotFoundException
java.io.IOException

setByteArrayAsPart

public byte[] setByteArrayAsPart(byte[] byteBuffer,
                                 java.lang.String ctype)
Method to set the specified byte buffer as part of the message

Parameters:
byteBuffer - The array of bytes which we want to set as a part of the message
ctype - The content-type
Returns:
The array of bytes which contains the part of the message

decodeMessage

public java.lang.String decodeMessage(java.lang.String encodedMessage,
                                      java.lang.String encodingType)
Method to decode the specified message

Parameters:
encodedMessage - The encoded message
encodingType - The encoding scheme using which the 'encodedMessage' is encoded
Returns:
The decoded message

decodeMessage

public byte[] decodeMessage(byte[] encodedMessage)
Method to decode the message specified in byte buffer

Parameters:
encodedMessage - The array of bytes which contains the encoded message
Returns:
The array of bytes which contains the decoded message

decodeMessageData

public byte[] decodeMessageData(java.lang.String encodedData,
                                java.lang.String encoding)
Method to decode the specified string

Parameters:
encodedData - The string containing the encoded data
encoding - The encoding scheme using which the 'encodedData' is encoded
Returns:
The array of bytes which contains the decoded data

ElegantJCharts Java API Specification v2.0

For any feedback, suggestion, or query, please revert back to support@elegantcharts.com

Copyright(c)
Elegant Microweb Technologies Pvt. Ltd.
www.elegantmicroweb.com
www.elegantjcharts.com
All Rights Reserved.