com.gauce.common
Class CommonUtil

java.lang.Object
  extended bycom.gauce.common.CommonUtil

public class CommonUtil
extends java.lang.Object

Gauce¿¡¼­ °øÅëÀûÀ¸·Î »ç¿ëµÇ´Â Utility¸¦ ¸ð¾ÆµÐ Class

Since:
Gauce 2.9
Version:
1.0 2002.08
Author:
Shift Information & Communication CO.

Constructor Summary
CommonUtil()
           
 
Method Summary
static int b2Int(byte[] b)
          ÀÔ·ÂµÈ 4¹ÙÀÌÆ®¸¦ int°ªÀ¸·Î º¯È¯ÇÏ¿© ¹ÝȯÇÑ´Ù.
static long b2long(byte[] b)
          ÀÔ·ÂµÈ 8¹ÙÀÌÆ®¸¦ long°ªÀ¸·Î º¯È¯ÇÏ¿© ¹ÝȯÇÑ´Ù.
static char[] byte2Char(byte[] bytes, java.lang.String encoding)
          ÁöÁ¤µÈ byte[] ¹è¿­À» char[] ¹è¿­·Î º¯È¯ÇÏ¿© ¹ÝȯÇÑ´Ù.
static byte[] compress(byte[] b)
          ÁöÁ¤µÈ Byte¸¦ HUFFMAN_ONLY ¾ÐÃà¹æ½ÄÀ¸·Î ¾ÐÃàÇÑ´Ù, ¾ÐÃà ·¹º§Àº BEST_COMPRESSIONÀ» »ç¿ëÇÑ´Ù.
static char[] compress(char[] c)
          »ý¼ºµÈ GauceDataSetÀÇ DataºÎºÐÀ» ¾ÐÃàÇÑ´Ù.
static void copy(java.io.InputStream in, java.io.OutputStream out)
          InputStreamÀ» OutputStreamÀ¸·Î Ãâ·ÂÇÑ´Ù.
static void copy(java.io.InputStream in, java.io.OutputStream out, int bufSize)
          InputStreamÀ» OutputStreamÀ¸·Î Ãâ·ÂÇÑ´Ù.
static byte[] deCompress(byte[] b)
          ¾ÐÃàµÈ byte¹è¿­À» Ç®¾î¼­ ¹ÝȯÇÑ´Ù.
static java.lang.String installDir()
          GacueÀÇ ¼³Ä¡ µð·ºÅ͸®¸¦ ¹ÝȯÇÑ´Ù.
static byte[] int2B(int v)
          int°ªÀ» 4¹ÙÀÌÆ® °ªÀ¸·Î º¯È¯ÇÑ´Ù.
static java.lang.String[][] loadCSV(java.io.InputStream is)
          CSV FileÀ» Àо String¹è¿­·Î ¹ÝȯÇÑ´Ù.
static java.lang.String[][] loadCSV(java.io.InputStream is, java.lang.String enc)
          CSV FileÀ» Àо String¹è¿­·Î ¹ÝȯÇÑ´Ù.
static void skip(java.io.InputStream in, int size)
          sizeÅ©±â ¸¸Å­ÀÇ buffer¸¦ »ý¼ºÇÏ¿© InputStreamÀ» skip()ÇÑ´Ù.
static byte[] toPacketNumber(int num)
          Á¤ÀÇµÈ int¼ýÀÚ¸¦ 10¹ÙÀÌÆ®ÀÇ ¹®ÀÚÇü ¼ýÀÚ·Î º¯È¯ÇÑ´Ù.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommonUtil

public CommonUtil()
Method Detail

copy

public static final void copy(java.io.InputStream in,
                              java.io.OutputStream out)
InputStreamÀ» OutputStreamÀ¸·Î Ãâ·ÂÇÑ´Ù. ÆÄÀÏÀ» º¹»çÇϰųª ¾Æ´Ï¸é inputStreamÀ» ´Ù¸¥ OutputStreamÀ¸·Î WritingÇÒ¶§ À¯¿ëÇÏ°Ô »ç¿ëµÈ´Ù.

Parameters:
in - InputStream
out - OutputStream
Since:
Gauce 2.9

copy

public static final void copy(java.io.InputStream in,
                              java.io.OutputStream out,
                              int bufSize)
InputStreamÀ» OutputStreamÀ¸·Î Ãâ·ÂÇÑ´Ù. ÆÄÀÏÀ» º¹»çÇϰųª ¾Æ´Ï¸é inputStreamÀ» ´Ù¸¥ OutputStreamÀ¸·Î WritingÇÒ¶§ À¯¿ëÇÏ°Ô »ç¿ëµÈ´Ù.

Parameters:
in - InputStream
out - OutputStream
bufSize - ¹öÆÛÀÇ Å©±â
Since:
Gauce 2.9

installDir

public static final java.lang.String installDir()
                                         throws java.io.IOException
GacueÀÇ ¼³Ä¡ µð·ºÅ͸®¸¦ ¹ÝȯÇÑ´Ù.

ÀÌ µð·ºÅ͸®´Â Gauce¸¦ ¼³Ä¡ÇÒ ¶§ ÁöÁ¤ÇÑ µð·ºÅ͸®¸¦ ¸»ÇÑ´Ù.

Returns:
GauceÀÇ ¼³Ä¡ µð·ºÅ͸®
Throws:
java.io.IOException - ¼³Ä¡µð·ºÅ͸®¸¦ Àд µ¿¾È ¹ß»ýÇÏ´Â ¿À·ù
Since:
Gauce 2.9

b2Int

public static final int b2Int(byte[] b)
ÀÔ·ÂµÈ 4¹ÙÀÌÆ®¸¦ int°ªÀ¸·Î º¯È¯ÇÏ¿© ¹ÝȯÇÑ´Ù.

Parameters:
b - º¯È¯ÇÒ 4¹ÙÀÌÆ® °ª
Returns:
º¯È¯µÈ int°ª
Since:
Gauce 2.9

b2long

public static final long b2long(byte[] b)
ÀÔ·ÂµÈ 8¹ÙÀÌÆ®¸¦ long°ªÀ¸·Î º¯È¯ÇÏ¿© ¹ÝȯÇÑ´Ù.

Parameters:
b - º¯È¯ÇÒ 8¹ÙÀÌÆ® °ª
Returns:
º¯È¯µÈ long°ª
Since:
4.1

int2B

public static final byte[] int2B(int v)
int°ªÀ» 4¹ÙÀÌÆ® °ªÀ¸·Î º¯È¯ÇÑ´Ù.

Parameters:
v - º¯È¯ÇÒ int°ª
Returns:
º¯È¯µÈ 4¹ÙÀÌÆ®ÀÇ °ª
Since:
Gauce 2.9

byte2Char

public static final char[] byte2Char(byte[] bytes,
                                     java.lang.String encoding)
ÁöÁ¤µÈ byte[] ¹è¿­À» char[] ¹è¿­·Î º¯È¯ÇÏ¿© ¹ÝȯÇÑ´Ù.

Parameters:
bytes - º¯È¯ÇÒ byte[]¹è¿­
encoding - »ý¼ºÇÒ char[]¹è¿­¿¡ ´ëÇÑ ÀÎÄÚµù Á¤º¸
Returns:
º¯È¯µÈ char[] ¹è¿­
Since:
Gauce 2.9

compress

public static final byte[] compress(byte[] b)
ÁöÁ¤µÈ Byte¸¦ HUFFMAN_ONLY ¾ÐÃà¹æ½ÄÀ¸·Î ¾ÐÃàÇÑ´Ù, ¾ÐÃà ·¹º§Àº BEST_COMPRESSIONÀ» »ç¿ëÇÑ´Ù.

Parameters:
b - ¾ÐÃàÇÒ byte¹è¿­
Returns:
¾ÐÃàµÈ byte¹è¿­
Since:
Gauce 2.9

compress

public static final char[] compress(char[] c)
»ý¼ºµÈ GauceDataSetÀÇ DataºÎºÐÀ» ¾ÐÃàÇÑ´Ù. ÁöÁ¤µÈ Character¸¦ ¾ÐÃàÇÑ´Ù.

Parameters:
c - ¾ÐÃàÇÒ byte¹è¿­
Returns:
¾ÐÃàµÈ character¹è¿­
Since:
Gauce 2.9

deCompress

public static final byte[] deCompress(byte[] b)
¾ÐÃàµÈ byte¹è¿­À» Ç®¾î¼­ ¹ÝȯÇÑ´Ù.

Parameters:
b - ¾ÐÃàµÈ byte¹è¿­
Returns:
¾ÐÃàÀ» Ǭ byte¹è¿­

toPacketNumber

public static final byte[] toPacketNumber(int num)
Á¤ÀÇµÈ int¼ýÀÚ¸¦ 10¹ÙÀÌÆ®ÀÇ ¹®ÀÚÇü ¼ýÀÚ·Î º¯È¯ÇÑ´Ù.

¿¹¸¦ µé¸é 123ÀÇ ¼ýÀÚ¸¦ º¯°æÇϸé 0000000123°ú °°ÀÌ º¯°æµÈ´Ù.

Parameters:
num - º¯°æÇÒ ¼ýÀÚ
Returns:
º¯°æµÈ ¹ÙÀÌÆ® ¹è¿­
Since:
Gauce 2.9

loadCSV

public static final java.lang.String[][] loadCSV(java.io.InputStream is)
                                          throws java.io.IOException
CSV FileÀ» Àо String¹è¿­·Î ¹ÝȯÇÑ´Ù. StringÀ» ÀÐÀ» ¶§ÀÇ ÀÎÄÚµùÀº ½Ã½ºÅÛÀÇ ±âº» localeÀ» »ç¿ëÇÑ´Ù.

Parameters:
is - CSV¸¦ ÀÐÀ» InputStream
Returns:
CSV¸¦ ÆĽÌÇÏ¿© °ªÀÌ ÀúÀåµÈ ¹è¿­
Throws:
java.io.IOException - CSVÆÄÀÏÀ» Àд µ¿¾È ¹ß»ýÇÏ´Â ¿À·ù
Since:
Gauce 2.9

loadCSV

public static final java.lang.String[][] loadCSV(java.io.InputStream is,
                                                 java.lang.String enc)
                                          throws java.io.IOException
CSV FileÀ» Àо String¹è¿­·Î ¹ÝȯÇÑ´Ù. StringÀ» ÀÐÀ» ¶§ÀÇ ÀÎÄÚµùÀº ÁÖ¾îÁø encodingÀ» »ç¿ëÇÑ´Ù.

Parameters:
is - CSV¸¦ ÀÐÀ» InputStream
enc - StringÀ» ÀÐÀ» ¶§ Àû¿ëÇÒ ÀÎÄÚµù
Returns:
CSV¸¦ ÆĽÌÇÏ¿© °ªÀÌ ÀúÀåµÈ ¹è¿­
Throws:
java.io.IOException - CSVÆÄÀÏÀ» Àд µ¿¾È ¹ß»ýÇÏ´Â ¿À·ù
Since:
Gauce 4.0

skip

public static final void skip(java.io.InputStream in,
                              int size)
sizeÅ©±â ¸¸Å­ÀÇ buffer¸¦ »ý¼ºÇÏ¿© InputStreamÀ» skip()ÇÑ´Ù.

Parameters:
in - InputStream
size - read()ÇÒ »çÀÌÁî
Since:
Gauce 4.0.1.5