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