kr.co.hit.live.web.upload
Class FormFile

java.lang.Object
  extended by kr.co.hit.live.web.upload.FormFile

public class FormFile
extends Object


Field Summary
protected static org.slf4j.Logger logger
           
 
Constructor Summary
FormFile(org.apache.commons.fileupload.FileItem fileItem)
           FormFile 클래스의 생성자로써 FileItem 객체를 저장한다.
 
Method Summary
 void destroy()
           파일을 삭제한다.
protected  String getBaseFileName(String filePath)
           경로명을 제외한 파일명을 리턴한다.
 String getContentType()
           업로드 파일에 대한 컨텐트 타입을 리턴한다.
 String getFieldName()
           리퀘스트로부터 업로드 파일을 식별하기 위한 키를 리턴한다.
 byte[] getFileData()
           파일의 내용을 byte[] 형태로 리턴한다.
 String getFileName()
           파일의 이름을 리턴한다.
 int getFileSize()
           파일의 사이즈를 리턴한다.
 InputStream getInputStream()
           파일의 내용을 InputStream 형태로 리턴한다.
 String toString()
           파일 명을 리턴한다.
 void write(File file)
          지정한 파일객체로 파일 내용을 저장한다.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected static org.slf4j.Logger logger
Constructor Detail

FormFile

public FormFile(org.apache.commons.fileupload.FileItem fileItem)

FormFile 클래스의 생성자로써 FileItem 객체를 저장한다.

Parameters:
fileItem - 파일 업로드 리퀘스트로부터 얻어지는 FileItem 객체
key - FileItem 객체에 대한 키 값
Method Detail

getContentType

public String getContentType()

업로드 파일에 대한 컨텐트 타입을 리턴한다.

Returns:
업로드 파일의 컨텐트 타입에 대한 문자열

getFileSize

public int getFileSize()

파일의 사이즈를 리턴한다.

Returns:
파일 사이즈

getFileName

public String getFileName()

파일의 이름을 리턴한다.

Returns:
파일명

getFileData

public byte[] getFileData()
                   throws FileNotFoundException,
                          IOException

파일의 내용을 byte[] 형태로 리턴한다.

Returns:
파일의 내용(byte[])
Throws:
FileNotFoundException - 해당 파일을 찾지 못하는 경우
IOException - 해당 파일로 부터 내용을 읽지 못하는 경우

getInputStream

public InputStream getInputStream()
                           throws FileNotFoundException,
                                  IOException

파일의 내용을 InputStream 형태로 리턴한다.

Returns:
파일의 내용(InputStream)
Throws:
FileNotFoundException - 해당 파일을 찾지 못하는 경우
IOException - 해당 파일로 부터 내용을 읽지 못하는 경우

destroy

public void destroy()

파일을 삭제한다.


getFieldName

public String getFieldName()

리퀘스트로부터 업로드 파일을 식별하기 위한 키를 리턴한다.

Returns:
업로드 파일에 대한 키

toString

public String toString()

파일 명을 리턴한다.

Overrides:
toString in class Object
Returns:
파일명

write

public void write(File file)
           throws Exception
지정한 파일객체로 파일 내용을 저장한다.

Parameters:
file -
Throws:
Exception

getBaseFileName

protected String getBaseFileName(String filePath)

경로명을 제외한 파일명을 리턴한다.

Parameters:
filePath - 파일의 전체 경로명
Returns:
경로명을 제외한 파일명


Copyright © 2014. All Rights Reserved.