kr.co.hit.live.util
Class SystemHelper

java.lang.Object
  extended by kr.co.hit.live.util.SystemHelper

public class SystemHelper
extends Object

System 관련 Live Framework의 Helper Class

아래 Method들은 모두 static으로 선언 되었기 때문에 유념하기 바란다.

Since:
3.0
Version:
$Revision: 1.1 $ $Date: 2006/09/26 08:20:10 $
Author:
노준훈

Field Summary
static String SYSTEM_SPACE
           
static String URL_SPACE
           
 
Method Summary
static ClassLoader getClassLoader()
           ThreadgetContextClassLoader를 이용하여 ClassLoader을 리턴
static String getHostname()
           
static String getHostname(String defName)
           
static String getPackagePath(Class<?> clazz)
          주어진 클래스의 package 구조를 경로 형태로 반환한다.
static String getPackagePath(Object obj)
          주어진 객체의 package 구조를 경로 형태로 반환한다.
static File getResourceAsFile(ClassLoader loader, String name)
           Classpath 상의 Resource를 File으로 리턴한다.
static File getResourceAsFile(String name)
           Classpath 상의 Resource를 File으로 리턴한다.
static Properties getResourceAsProperties(ClassLoader loader, String name)
           Classpath 상의 Resource를 Properties으로 리턴한다.
static Properties getResourceAsProperties(String name)
           Classpath 상의 Resource를 Properties으로 리턴한다.
static Reader getResourceAsReader(ClassLoader loader, String name)
           Classpath 상의 Resource를 Reader으로 리턴한다.
static Reader getResourceAsReader(String name)
           Classpath 상의 Resource를 Reader으로 리턴한다.
static InputStream getResourceAsStream(ClassLoader loader, String name)
           Classpath 상의 Resource를 InputStream으로 리턴한다.
static InputStream getResourceAsStream(String name)
           Classpath 상의 Resource를 InputStream으로 리턴한다.
static File[] getResourcesAsFile(ClassLoader loader, String name)
           Classpath 상의 Resource들을 File의 배열으로 리턴한다.
static File[] getResourcesAsFile(String name)
           Classpath 상의 Resource들을 File의 배열으로 리턴한다.
static URL getResourceURL(ClassLoader loader, String name)
           Classpath 상의 Resource를 URL으로 리턴한다.
static URL getResourceURL(String name)
           Classpath 상의 Resource를 URL으로 리턴한다.
static Enumeration<URL> getResourceURLs(ClassLoader loader, String name)
           Classpath 상의 Resource들을 URL으로 리턴한다.
static Enumeration<URL> getResourceURLs(String name)
           Classpath 상의 Resource들을 URL으로 리턴한다.
static String getSystemProperty(String key)
           SystemgetProperty Method의 LiveFramework의 Helper Method
static String getSystemProperty(String key, String defaultValue)
           SystemgetProperty Method의 LiveFramework의 Helper Method
static Properties getUrlAsProperties(String urlString)
           URLProperties으로 리턴한다.
static Reader getUrlAsReader(String urlString)
           URLReader으로 리턴한다.
static InputStream getUrlAsStream(String urlString)
           URLInputStream으로 리턴한다.
static String setSystemProperty(String key, String value)
           SystemsetProperty Method의 LiveFramework의 Helper Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

URL_SPACE

public static final String URL_SPACE
See Also:
Constant Field Values

SYSTEM_SPACE

public static final String SYSTEM_SPACE
See Also:
Constant Field Values
Method Detail

getSystemProperty

public static String getSystemProperty(String key,
                                       String defaultValue)

SystemgetProperty Method의 LiveFramework의 Helper Method

Parameters:
key - SystemProperty의 정의된 key
defaultValue - SystemProperty의 정의된 key에 해당하는 value가 없는 경우 default값
Returns:
SystemProperty의 정의된 key에 해당하는 value

setSystemProperty

public static String setSystemProperty(String key,
                                       String value)

SystemsetProperty Method의 LiveFramework의 Helper Method

Parameters:
key - System Property로 정의할 key
value - System Property로 정의할 value
Returns:
이전에 정의되어 있던 value

getSystemProperty

public static String getSystemProperty(String key)

SystemgetProperty Method의 LiveFramework의 Helper Method

Parameters:
key - SystemProperty의 정의된 key
Returns:
SystemProperty의 정의된 key에 해당하는 value

getResourceAsStream

public static InputStream getResourceAsStream(String name)
                                       throws IOException

Classpath 상의 Resource를 InputStream으로 리턴한다.

Parameters:
name - 찾기위한 Resource
Returns:
Resource의 InputStream
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsStream

public static InputStream getResourceAsStream(ClassLoader loader,
                                              String name)
                                       throws IOException

Classpath 상의 Resource를 InputStream으로 리턴한다.

Parameters:
loader - Resource을 찾기 위한 ClassLoader
name - 찾기위한 Resource
Returns:
Resource의 InputStream
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceURL

public static URL getResourceURL(String name)
                          throws IOException

Classpath 상의 Resource를 URL으로 리턴한다.

Parameters:
name - 찾기위한 Resource
Returns:
Resource의 URL
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceURLs

public static Enumeration<URL> getResourceURLs(String name)
                                        throws IOException

Classpath 상의 Resource들을 URL으로 리턴한다.

Parameters:
name - 찾기위한 Resource
Returns:
같은 이름에 해당되는 Resource들의 URL을 Enumeration 으로 반환
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceURL

public static URL getResourceURL(ClassLoader loader,
                                 String name)
                          throws IOException

Classpath 상의 Resource를 URL으로 리턴한다.

Parameters:
loader - Resource을 찾기 위한 ClassLoader
name - 찾기위한 Resource
Returns:
Resource의 URL
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceURLs

public static Enumeration<URL> getResourceURLs(ClassLoader loader,
                                               String name)
                                        throws IOException

Classpath 상의 Resource들을 URL으로 리턴한다.

Parameters:
loader - Resource을 찾기 위한 ClassLoader
name - 찾기위한 Resource
Returns:
같은 이름에 해당되는 Resource들의 URL을 Enumeration 으로 반환
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsProperties

public static Properties getResourceAsProperties(String name)
                                          throws IOException

Classpath 상의 Resource를 Properties으로 리턴한다.

Parameters:
name - 찾기위한 Resource
Returns:
Resource의 Properties
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsProperties

public static Properties getResourceAsProperties(ClassLoader loader,
                                                 String name)
                                          throws IOException

Classpath 상의 Resource를 Properties으로 리턴한다.

Parameters:
loader - Resource을 찾기 위한 ClassLoader
name - 찾기위한 Resource
Returns:
Resource의 Properties
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsReader

public static Reader getResourceAsReader(String name)
                                  throws IOException

Classpath 상의 Resource를 Reader으로 리턴한다.

Parameters:
name - 찾기위한 Resource
Returns:
Resource의 Reader
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsReader

public static Reader getResourceAsReader(ClassLoader loader,
                                         String name)
                                  throws IOException

Classpath 상의 Resource를 Reader으로 리턴한다.

Parameters:
loader - Resource을 찾기 위한 ClassLoader
name - 찾기위한 Resource
Returns:
Resource의 Reader
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsFile

public static File getResourceAsFile(String name)
                              throws IOException

Classpath 상의 Resource를 File으로 리턴한다. 내부적으로 URL 경로를 가져오는 구조이므로 resource 명에 공백이 있을 경우 %20 으로 치환되며 이 경우에는 실제 파일 경로와 달라지므로 해당 파일을 찾을 수 없게 된다. 따라서 resource 명에 공백이 포함되지 않도록 한다.

Parameters:
name - 찾기위한 Resource
Returns:
Resource의 File
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourcesAsFile

public static File[] getResourcesAsFile(ClassLoader loader,
                                        String name)
                                 throws IOException

Classpath 상의 Resource들을 File의 배열으로 리턴한다.

Parameters:
name - 찾기위한 Resource 이름
Returns:
동일한 이름의 Resource들이 담긴 File의 배열
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourcesAsFile

public static File[] getResourcesAsFile(String name)
                                 throws IOException

Classpath 상의 Resource들을 File의 배열으로 리턴한다.

Parameters:
name - 찾기위한 Resource 이름
Returns:
동일한 이름의 Resource들이 담긴 File의 배열
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getResourceAsFile

public static File getResourceAsFile(ClassLoader loader,
                                     String name)
                              throws IOException

Classpath 상의 Resource를 File으로 리턴한다.

Parameters:
loader - Resource을 찾기 위한 ClassLoader
name - 찾기위한 Resource
Returns:
Resource의 File
Throws:
IOException - Resource를 찾을 수 없거나 읽을 수 경우

getUrlAsStream

public static InputStream getUrlAsStream(String urlString)
                                  throws IOException

URLInputStream으로 리턴한다.

Parameters:
urlString - - 가져오고자 하는 URL
Returns:
URL로 부터 데이터를 읽은 InputStream
Throws:
IOException - URL을 찾을 수 없거나 읽을 수 경우

getUrlAsReader

public static Reader getUrlAsReader(String urlString)
                             throws IOException

URLReader으로 리턴한다.

Parameters:
urlString - - 가져오고자 하는 URL
Returns:
URL로 부터 데이터를 읽은 Reader
Throws:
IOException - URL을 찾을 수 없거나 읽을 수 경우

getUrlAsProperties

public static Properties getUrlAsProperties(String urlString)
                                     throws IOException

URLProperties으로 리턴한다.

Parameters:
urlString - - 가져오고자 하는 URL
Returns:
URL로 부터 데이터를 읽은 Properties
Throws:
IOException - URL을 찾을 수 없거나 읽을 수 경우

getPackagePath

public static String getPackagePath(Object obj)
주어진 객체의 package 구조를 경로 형태로 반환한다.

Parameters:
obj -
Returns:

getPackagePath

public static String getPackagePath(Class<?> clazz)
주어진 클래스의 package 구조를 경로 형태로 반환한다.

Parameters:
clazz -
Returns:

getClassLoader

public static ClassLoader getClassLoader()

ThreadgetContextClassLoader를 이용하여 ClassLoader을 리턴

Returns:
classloader

getHostname

public static String getHostname()

getHostname

public static String getHostname(String defName)


Copyright © 2014. All Rights Reserved.