±Û¾´ÀÌ :±è´öÅ 1998³â 5¿ù 04ÀÏ 18:14:25
In Reply to: JDK 1.1, 1.2ÀÇ ÇÑ±Û °ü·Ã ÀÎÄÚµù°ú ±âŸ posted by ±è´öÅ on 1998³â 4¿ù 22ÀÏ 16:13:34:
´ÙÀ½Àº han.comp.lang.java ´º½º ±×·ì¿¡¼ ÆÛ¿Â ³»¿ëÀÓ.
In <6hmojf$35t$1@photon.hgs.yale.edu>, Jungshik Shin wrote:
: JDK 1.1.5°¡ ±âº»À¸·Î Á¦°øÇÏ´Â font.properties* ÆÄÀÏ¿¡¼ ¾²Áö ¾Ê´Â
: "glyph index scheme"À» °¡Áö´Â ÆùÆ®¸¦ ¾²±â À§ÇØ ¾Æ·¡ µÎ ¹®¼¸¦ º¸¾Ò´Âµ¥,
: Á¦°¡ ÇÏ·Á´Â ÀÏ¿¡ Á÷Á¢ ÀÀ¿ëÇϱⰡ Èûµç °Í °°¾Æ Áú¹®ÇÕ´Ï´Ù.
: http://java.sun.com/products/jdk/1.1/docs/guide/intl/fontprop.html
: http://java.sun.com/products/jdk/1.1/docs/guide/intl/unicode_font.doc.html
: º¸´Ù ±¸Ã¼ÀûÀ¸·Î Unix/X11¿¡¼ UCS-2¿Í ¶È°°Àº "ÆùÆ® ÀÎÄÚµù"À» °¡Áö´Â
: ÇÑ±Û ÆùÆ®(11,172ÀÚ¸¦ ¸ðµÎ ´Ù °¡Áö°í ÀÖ´Â)¸¦ Java application/applet ¿¡¼
: ¾²·Á°í ÇÕ´Ï´Ù. À§ÀÇ µÎ ÆÄÀÏ¿¡ º¸¸é Java ³»ºÎÀÇ UCS-2 encodingÀ» ¾²°íÀÚ
±×³É ù ¹ø° ¹®¼¿¡ ³ª¿Â º¸±â¸¦ ¾Æ·¡Ã³·³ »ì¦ ¹Ù²å´õ´Ï Àß µ¿ÀÛÇϴ±º¿ä.
byte-orderingÀÌ Á¶±Ý °É¸®±ä ÇÏÁö¸¸(Ȥ½Ã ´õ ³ªÀº ¹æ¹ýÀÌ ÀÖÀ¸¸é ¾Ë·Á
ÁֽʽÿÀ), ¾Æ·¡¿Í °°Àº ÆÄÀÏÀ» ÄÄÆÄÀÏÇÑ ´ÙÀ½¿¡ ÀûÀýÇÑ µð·ºÅ丮¿¡ class
ÆÄÀÏÀ» µÎ°í, À§ÀÇ ¹®¼¿¡¼ ¼³¸íÇÑ ¹æ½Ä´ë·Î font.properties¿¡ converter¿Í
ÆùÆ®(ÇÑ±Û À½Àý 11,172ÀÚ¸¦ UCS-2 encodingÀÇ code point¿Í °°Àº °÷¿¡ °¡Áö°í
ÀÖ´Â)¸¦ ÁöÁ¤Çß´õ´Ï, applet¿¡¼ ÇÑ±Û À½Àý ¸ðµÎ°¡ Àß º¸ÀÌ´õ±º¿ä. UCS-2
encoding ȤÀº ´Ù¸¥ ÀÎÄÚµùÀ¸·Î ÇÑ±Û À½Àý ¸ðµÎ¸¦ Á¦°øÇÏ´Â ÆùÆ®¸¦ °¡Áø
°æ¿ì¿¡´Â(Solaris 2.6À̳ª IRIX 6.x »ç¿ëÀÚ, ¶Ç Linux »ç¿ëÀÚ Áß¿¡ miziÀÇ
ÆùÆ® ¼¹ö¸¦ ¼³Ä¡ÇÑ ºÐÀº ÇØ º¸¼¼¿ä) X11¿¡¼µµ Java
applet/application¿¡¼ ÇÑ±Û À½Àý ¸ðµÎ¸¦ º¼ ¼ö ÀÖ°Ú±º¿ä. ¾î¼¸é, ÇÑÅÒ¿¡¼
¾²´Â Á¶ÇÕ ÆùÆ®ÀÇ °æ¿ì¿¡µµ °¡´ÉÇÒ ¼öµµ ÀÖ´Ù´Â »ý°¢ÀÌ µì´Ï´Ù.
½ÅÁ¤½Ä
----------Cut--------here-----------
package mypkg.converter;
import sun.io.CharToByte8859_1;
import sun.io.CharToByteConverter;
import sun.io.ConversionBufferFullException;
public class CharToByteUCS2KR extends sun.io.CharToByte8859_1 {
/*
* This method indicates the range this font covers.
*/
public boolean canConvert(char ch) {
if (ch >= 0xac00 && ch <= 0xd7af) {
return true;
}
return false;
}
/*
* This method converts the unicode to this font index.
*/
public int convert(char[] input, int inStart, int inEnd,
byte[] output, int outStart, int outEnd)
throws ConversionBufferFullException {
int outIndex = outStart;
for (int i = inStart; i < inEnd; i++) {
char ch = input[i];
if (ch >= 0xac00 && ch <= 0xd7af) {
if (outIndex >= outEnd)
throw new ConversionBufferFullException();
output[outIndex++] = (byte)( ch / 256 );
output[outIndex++] = (byte)( ch % 256 );
}
}
return outIndex - outStart;
}
/*
* This method indicates the charset name for this font.
*/
public String toString() {
return "UCS2KR";
}
}
-----------------------