rath.msnm.msg
Class MimeMessage

java.lang.Object
  |
  +--rath.msnm.msg.MimeMessage
Direct Known Subclasses:
FileTransferMessage

public class MimeMessage
extends Object

MIME ¸Þ½ÃÁöµéÀ» °ü¸®Çϴ Ŭ·¡½ºÀÌ´Ù.

Version:
$Id: MimeMessage.java,v 1.1.1.1 2002/03/03 21:32:36 xrath Exp $, since 2001/11/07
Author:
Jang-Ho Hwang, rath@xrath.com

Field Summary
static int KIND_FILE_TRANSFER
           
static int KIND_MESSAGE
           
static int KIND_PROFILE
           
static int KIND_TYPING_USER
           
static int KIND_UNKNOWN
           
static String STR_FILE_TRANSFER
           
static String STR_MESSAGE
           
static String STR_PROFILE
           
static String STR_TYPING_USER
           
 
Constructor Summary
MimeMessage()
           
MimeMessage(String message)
          ÁÖ¾îÁø ¸Þ½ÃÁö¸¦ °¡Áö´Â MIME ¸Þ½ÃÁö ÀνºÅϽº¸¦ »ý¼ºÇÑ´Ù.
 
Method Summary
protected  boolean addProperty(String line)
          ÁÖ¾îÁø lineÀ» ÆĽÌÇÏ¿© property¸¦ Çϳª Ãß°¡ÇÑ´Ù.
protected  StringBuffer createMimeHeader(String header)
          Æ¯Á¤ Content-TypeÀ» °¡Áö´Â Mime header·Î mime message¸¦ »ý¼ºÇØÁØ´Ù.
protected  StringBuffer fillMimeProperties(StringBuffer buf)
          ÇöÀç ¼³Á¤µÈ ¸ðµç Properties¸¦ buf¿¡ Ãß°¡ÇÏ°í, ¸¶Áö¸·¿¡ \r\n¸¦ Çѹø ´õ ºÙ¿©ÁÖ°Ô µÈ´Ù.
 byte[] getBytes()
          ¼³Á¤µÈ Á¾·ù(Kind)¿¡ µû¶ó ÀûÀýÇÏ°Ô byteº¯È¯ÇØÁØ´Ù.
 String getEffectCode()
           
 byte[] getInstantMessageBytes()
          Mime formatÀ» °¡Áö´Â UTF-8 base¿¡ URL encodedµÈ byte array·Î º¯ÇüÇØ ÁØ´Ù.
 int getKind()
          ÀÌ MimeMessageÀÇ typeÀ» ¹ÝȯÇØÁØ´Ù.
 String getMessage()
          KIND_MESSAGE Á¾·ùÀÏ ¶§ µµÂøÇÑ ÀνºÅÏÆ® ¸Þ½ÃÁö ³»¿ëÀ» ¾ò¾î¿À´Âµ¥ »ç¿ëµÈ´Ù.
 Properties getProperties()
          ÇöÀç ¼³Á¤µÇ¾îÀÖ´Â ÇÁ·ÎÆÛƼµéÀ» ´ã°í ÀÖ´Â Properties °´Ã¼¸¦ °¡Á®¿Â´Ù.
 String getProperty(String key)
          Æ¯Á¤ Mime header °ªÀ» °¡Á®¿Â´Ù.
 byte[] getTypingMessageBytes()
           
 boolean hasProperty(String key)
          ÁÖ¾îÁø key°¡ ÇöÀç mime properties¿¡ Á¸ÀçÇÏ´ÂÁö¿¡ ´ëÇÑ ¿©ºÎ¸¦ ¾ò¾î¿Â´Ù.
 void parse(String raw)
          UTF-8·Î ±¸¼ºµÈ raw ÇüÅÂÀÇ MIME ¸Þ½ÃÁö¸¦ ¹Þ¾Æ MIME Çü½Ä¿¡ ¸ÂÃç ÆĽÌ/ºÐ¼®ÇÏ¿© µ¥ÀÌÅ͸¦ ä¿î´Ù.
 void setEffectCode(String ef)
           
 void setKind(int kind)
           
 void setMessage(String msg)
          Àü¼ÛÇÏ°íÀÚ ÇÏ´Â ¸Þ½ÃÁö¸¦ ¼³Á¤ÇÑ´Ù.
 void setProperty(String key, String value)
          ÇÁ·ÎÆÛƼ¸¦ ¼³Á¤ÇÑ´Ù.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KIND_PROFILE

public static final int KIND_PROFILE
See Also:
Constant Field Values

KIND_TYPING_USER

public static final int KIND_TYPING_USER
See Also:
Constant Field Values

KIND_MESSAGE

public static final int KIND_MESSAGE
See Also:
Constant Field Values

KIND_FILE_TRANSFER

public static final int KIND_FILE_TRANSFER
See Also:
Constant Field Values

KIND_UNKNOWN

public static final int KIND_UNKNOWN
See Also:
Constant Field Values

STR_PROFILE

public static final String STR_PROFILE
See Also:
Constant Field Values

STR_TYPING_USER

public static final String STR_TYPING_USER
See Also:
Constant Field Values

STR_MESSAGE

public static final String STR_MESSAGE
See Also:
Constant Field Values

STR_FILE_TRANSFER

public static final String STR_FILE_TRANSFER
See Also:
Constant Field Values
Constructor Detail

MimeMessage

public MimeMessage()

MimeMessage

public MimeMessage(String message)
ÁÖ¾îÁø ¸Þ½ÃÁö¸¦ °¡Áö´Â MIME ¸Þ½ÃÁö ÀνºÅϽº¸¦ »ý¼ºÇÑ´Ù.

Method Detail

getKind

public int getKind()
ÀÌ MimeMessageÀÇ typeÀ» ¹ÝȯÇØÁØ´Ù. ÇöÀç´Â ·Î±×Àνà ¹Þ´Â profile Á¤º¸(KIND_PROFILE), Typing Áß¿¡ Àü¼ÛµÇ´Â typing Á¤º¸(KIND_TYPING_USER), ÀνºÅÏÆ® ¸Þ½ÃÁö°¡ Àü¼ÛµÉ¶§ »ç¿ëµÇ´Â Á¤º¸(KIND_MESSAGE) ¸¸À¸·Î ±¸¼ºµÇ¾îÀÖ´Ù. ¸¸¾à ¾Ë ¼ö ÀÌ ¿ÜÀÇ ¸Þ½ÃÁö°¡ ¿Ã °æ¿ì´Â KIND_UNKNOWNÀÌ ¹ÝȯµÉ °ÍÀÌ´Ù.


setKind

public void setKind(int kind)

setMessage

public void setMessage(String msg)
Àü¼ÛÇÏ°íÀÚ ÇÏ´Â ¸Þ½ÃÁö¸¦ ¼³Á¤ÇÑ´Ù. ´Ù¼Ò ¾î»öÇÏÁö¸¸, ÀÌ ¸Þ¼Òµå´Â KIND_MESSAGE¸¦ »ç¿ëÇÒ °æ¿ì¿¡¸¸ »ç¿ëµÈ´Ù.


getMessage

public String getMessage()
KIND_MESSAGE Á¾·ùÀÏ ¶§ µµÂøÇÑ ÀνºÅÏÆ® ¸Þ½ÃÁö ³»¿ëÀ» ¾ò¾î¿À´Âµ¥ »ç¿ëµÈ´Ù. ¸¸¾à KIND_UNKNOWNÀÌ¿´´Ù¸é, raw ÇüÅÂÀÇ Àüü ¹®ÀÚ¿­ÀÌ ¹ÝȯµÉ °ÍÀÌ´Ù.


addProperty

protected boolean addProperty(String line)
ÁÖ¾îÁø lineÀ» ÆĽÌÇÏ¿© property¸¦ Çϳª Ãß°¡ÇÑ´Ù. ¸¸¾à ÆĽÌÇÒ ¼ö ¾ø´Ù¸é false¸¦ ¸®ÅÏÇÒ °ÍÀÌ°í, Á¤»óÀûÀÎ Çü½ÄÀ» °¡Áö°í ÀÖ´Ù¸é, property¿¡ Ãß°¡°¡ µÈ ÈÄ true¸¦ ¹ÝȯÇÒ °ÍÀÌ´Ù.


setProperty

public void setProperty(String key,
                        String value)
ÇÁ·ÎÆÛƼ¸¦ ¼³Á¤ÇÑ´Ù.

Parameters:
key - ÇÁ·ÎÆÛƼ Å°.
value - ÇÁ·ÎÆÛƼ °ª.

getProperties

public Properties getProperties()
ÇöÀç ¼³Á¤µÇ¾îÀÖ´Â ÇÁ·ÎÆÛƼµéÀ» ´ã°í ÀÖ´Â Properties °´Ã¼¸¦ °¡Á®¿Â´Ù.


getProperty

public String getProperty(String key)
ƯÁ¤ Mime header °ªÀ» °¡Á®¿Â´Ù.


hasProperty

public boolean hasProperty(String key)
ÁÖ¾îÁø key°¡ ÇöÀç mime properties¿¡ Á¸ÀçÇÏ´ÂÁö¿¡ ´ëÇÑ ¿©ºÎ¸¦ ¾ò¾î¿Â´Ù.


parse

public void parse(String raw)
           throws Exception
UTF-8·Î ±¸¼ºµÈ raw ÇüÅÂÀÇ MIME ¸Þ½ÃÁö¸¦ ¹Þ¾Æ MIME Çü½Ä¿¡ ¸ÂÃç ÆĽÌ/ºÐ¼®ÇÏ¿© µ¥ÀÌÅ͸¦ ä¿î´Ù.

Parameters:
raw - StringÇüÅÂÀÇ MIME Àüü ¸Þ½ÃÁö.
Exception

getEffectCode

public String getEffectCode()

setEffectCode

public void setEffectCode(String ef)

getInstantMessageBytes

public byte[] getInstantMessageBytes()
                              throws UnsupportedEncodingException
Mime formatÀ» °¡Áö´Â UTF-8 base¿¡ URL encodedµÈ byte array·Î º¯ÇüÇØ ÁØ´Ù.

UnsupportedEncodingException

getTypingMessageBytes

public byte[] getTypingMessageBytes()
                             throws UnsupportedEncodingException
UnsupportedEncodingException

createMimeHeader

protected StringBuffer createMimeHeader(String header)
ƯÁ¤ Content-TypeÀ» °¡Áö´Â Mime header·Î mime message¸¦ »ý¼ºÇØÁØ´Ù.


fillMimeProperties

protected StringBuffer fillMimeProperties(StringBuffer buf)
ÇöÀç ¼³Á¤µÈ ¸ðµç Properties¸¦ buf¿¡ Ãß°¡ÇÏ°í, ¸¶Áö¸·¿¡ \r\n¸¦ Çѹø ´õ ºÙ¿©ÁÖ°Ô µÈ´Ù.


getBytes

public byte[] getBytes()
                throws UnsupportedEncodingException
¼³Á¤µÈ Á¾·ù(Kind)¿¡ µû¶ó ÀûÀýÇÏ°Ô byteº¯È¯ÇØÁØ´Ù.

UnsupportedEncodingException