|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectkr.co.hit.live.util.FtpUtil
public class FtpUtil
FTP client 기능을 제공하는 유틸리티 클래스이다. 이 기능을 사용하기 위하여 우선 ftp 접속정보 설정을 위한 프로퍼티 파일을 작성해야하며, 이 파일 명을 live config 파일에 "live.ftp.configuration"를 Key하여 지정해야한다. ftp 접속정보 설정파일은 다음과 같은 구조이다.
# EJB 서버에서 FTP 서버로 temp 파일들을 송수신 temp.service.ip = 172.17.200.17 temp.user.id = ftp temp.user.pwd = ftp temp.dir.local = C:\\temp temp.dir.remote = /file/temp temp.service.host = unix temp.service.mode = bin # EJB 서버에서 FTP 서버로 RMS 파일들을 송수신 (개발) rms.service.ip = 172.17.200.58 rms.user.id = rmsuftp rms.user.pwd = rmsuftp() rms.dir.local = C:\\temp rms.dir.remote = /rms/sam/cf rms.service.host = unix
설정 파일 내의 설정 Key는 서비스명.속성명 의 구조를 같는다. 속성명의 종류와 의미는 다음과 같다.
| Field Summary | |
|---|---|
static int |
ASCII_MODE
ASC-II 전송 모드 |
static int |
BINARY_MODE
이진 전송 모드 |
static String |
FTP_CHARACTER_ENCODING
|
protected String |
FTP_CONFIG_FILE_KEY
ftp 설정 파일을 가져오기 위한 Key. live-config.properties에 정의되어 있다. |
protected static String |
FTPCLIENT_FILE_SEPARATOR
FTP client 쪽의 파일 시스템 구분자이다. |
| Constructor Summary | |
|---|---|
FtpUtil(String serviceName)
FtpUtil 생성자이다. |
|
| Method Summary | |
|---|---|
boolean |
deleteFile(String remoteFileName)
ftp 에 접속하고 파일을 삭제하는 기능을 수행한다. |
boolean[] |
deleteMultipleFiles(String[] remoteFileName)
ftp 에 접속하고 파일을 삭제하는 기능을 수행한다. |
boolean[] |
deleteMultipleFiles(ValueObject fileVO,
String fnameKey)
ftp 에 접속하고 파일을 삭제하는 기능을 수행한다. |
String |
getFile(String remoteFileName)
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 local에 저장한다. |
String |
getFile(String remoteFileName,
int mode)
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 local에 저장한다. |
String |
getFile(String remoteFileName,
String localFileName,
int mode)
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 local에 저장한다. |
byte[] |
getFileAsByte(String remoteFileName,
int mode)
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 byte[]로 반환한다. |
String |
sendFile(InputStream data,
String remoteFileName,
int mode)
InputStream으로 주어진 데이터를 FTP 서버에 remoteFileName으로 저장한다. |
String |
sendFile(String localFileName)
localFileName으로 지정된 파일을 FTP 서버에 저장한다. |
String |
sendFile(String localFileName,
int mode)
localFileName으로 지정된 파일을 FTP 서버에 저장한다. |
String |
sendFile(String localFileName,
String remoteFileName,
int mode)
localFileName으로 지정된 파일을 FTP 서버에 remoteFileName으로 저장한다. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ASCII_MODE
public static final int BINARY_MODE
public static final String FTP_CHARACTER_ENCODING
protected final String FTP_CONFIG_FILE_KEY
protected static final String FTPCLIENT_FILE_SEPARATOR
| Constructor Detail |
|---|
public FtpUtil(String serviceName)
FtpUtil 생성자이다. Ftp 설정파일에서 serviceName에 해당되는 설정 값들을 사용하여 내부 설정값을 정의한다.
String - serviceName properties 파일에 정의되 있는 key값| Method Detail |
|---|
public String getFile(String remoteFileName)
throws LiveException
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 local에 저장한다. local에 저장할 경로는 remoteFileName을 사용한다. 전송모드는 프로퍼티 파일에 설정된 값을 사용한다.
String - remoteFileName 가져올 파일 명
(경로 포함, 프로퍼티 파일의 remote.dir 디렉토리를 기준으로 그 하위 경로를 지정)
LiveException
public String getFile(String remoteFileName,
int mode)
throws LiveException
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 local에 저장한다. local에 저장할 경로는 remoteFileName을 사용한다.
String - remoteFileName 가져올 파일 명
(경로 포함, 프로퍼티 파일의 remote.dir 디렉토리를 기준으로 그 하위 경로를 지정)int - mode 전송모드
LiveException
public String getFile(String remoteFileName,
String localFileName,
int mode)
throws LiveException
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 local에 저장한다.
String - remoteFileName 가져올 파일 명
(경로 포함, 프로퍼티 파일의 remote.dir 디렉토리를 기준으로 그 하위 경로를 지정)String - localFileName 자장할 파일 명
(경로 포함, 프로퍼티 파일의 local.dir 디렉토리를 기준으로 그 하위 경로를 지정)int - mode 전송모드
LiveException
public byte[] getFileAsByte(String remoteFileName,
int mode)
throws LiveException
파일에 대해 가져오기 기능을 수행한다. ftp서버로 접속한 후에 파일을 읽어와 byte[]로 반환한다.
String - remoteFileName 가져올 파일 명
(경로 포함, 프로퍼티 파일의 remote.dir 디렉토리를 기준으로 그 하위 경로를 지정)int - mode 전송모드
LiveException
public String sendFile(String localFileName)
throws LiveException
localFileName으로 지정된 파일을 FTP 서버에 저장한다. 저장시 localFileName을 사용하여 저장한다. 전송 모드는 프로퍼티 파일에 설정된 값을 사용한다.
String - localFileName 전송할 파일 명
(경로포함, 프로퍼티파일의 local.dir을 기준으로 경로를 지정)
LiveException
public String sendFile(String localFileName,
int mode)
throws LiveException
localFileName으로 지정된 파일을 FTP 서버에 저장한다. 저장시 localFileName을 사용하여 저장한다.
String - localFileName 전송할 파일 명
(경로포함, 프로퍼티파일의 local.dir을 기준으로 경로를 지정)int - mode 전송 모드
LiveException
public String sendFile(String localFileName,
String remoteFileName,
int mode)
throws LiveException
localFileName으로 지정된 파일을 FTP 서버에 remoteFileName으로 저장한다.
String - localFileName 전송할 파일 명
(경로포함, 프로퍼티파일의 local.dir을 기준으로 경로를 지정)String - remoteFileName 서버에 저장할 파일명
(경로포함, 프로퍼티파일의 remote.dir을 기준으로 경로를 지정)int - mode 전송 모드
LiveException
public String sendFile(InputStream data,
String remoteFileName,
int mode)
throws LiveException
InputStream으로 주어진 데이터를 FTP 서버에 remoteFileName으로 저장한다.
InputStream - data 전송할 데이터String - remoteFileName 서버에 저장할 파일명
(경로포함, 프로퍼티파일의 remote.dir을 기준으로 경로를 지정)int - mode 전송 모드
LiveException
public boolean deleteFile(String remoteFileName)
throws LiveException
ftp 에 접속하고 파일을 삭제하는 기능을 수행한다.
String - remoteFileName
LiveException
public boolean[] deleteMultipleFiles(ValueObject fileVO,
String fnameKey)
throws LiveException
ftp 에 접속하고 파일을 삭제하는 기능을 수행한다.
ValueObject - fileVO 삭제할 파일 목록을 담고 있는 VOString - fnameKey 삭제할 파일 목록에서 파일 경로를 꺼낼 Key
LiveException
public boolean[] deleteMultipleFiles(String[] remoteFileName)
throws LiveException
ftp 에 접속하고 파일을 삭제하는 기능을 수행한다.
String - remoteFileName
LiveException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||