Package io.github.enxign.shed.toolkit
Class FileUtils
java.lang.Object
io.github.enxign.shed.toolkit.FileUtils
FileUtils
파일 관련 유틸리티 클래스
- Since:
- 2021-02-01
- Version:
- 1.0
수정일 수정자 수정내용 ---------- --------- ------------------------------- 2021-02-01 first create
- Author:
- enxign
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
deleteFile
(String filePath) 파일 삭제static String
filePathBlank1
(String path) 경로 제거static String
getFileExtension
(File file) getFileExtensionstatic String
getFileExtension
(String filePath) getFileExtensionstatic String
getFilename
(File file) getFilenamestatic String
getFilename
(String filePath) getFilenamestatic String
getFileName
(String orgFileName, javax.servlet.http.HttpServletRequest request) 파일명 인코딩static File
getNewFileName
(String path, String fileName) 새 파일명 생성static <T> T
readObject
(File file, Class<T> clazz) readObjectstatic Object
readObject
(String fileName) readObjectstatic <T> T
readObject
(String fileName, Class<T> clazz) readObjectstatic Object
writeObject
(Object o, File file) writeObjectstatic Object
writeObject
(Object o, String fileName) writeObject
-
Constructor Details
-
FileUtils
public FileUtils()
-
-
Method Details
-
filePathBlank1
경로 제거- Parameters:
path
- 대상 경로- Returns:
- 경로 제거된 문자열
-
getFilename
getFilename- Parameters:
file
- 파일 객체- Returns:
- 파일명
-
getFilename
getFilename- Parameters:
filePath
- 파일 경로- Returns:
- 파일명
-
getFileExtension
getFileExtension- Parameters:
filePath
- 파일 경로- Returns:
- 파일 확장자
-
getFileExtension
getFileExtension- Parameters:
file
- 파일 객체- Returns:
- 파일 확장자
-
readObject
readObject- Parameters:
fileName
- 파일명- Returns:
- 객체
- Throws:
Exception
- 예외처리
-
readObject
readObject- Type Parameters:
T
- 객체 타입- Parameters:
fileName
- 파일명clazz
- 클래스 타입- Returns:
- 객체
- Throws:
Exception
- 예외처리
-
readObject
readObject- Type Parameters:
T
- 객체 타입- Parameters:
file
- 파일 객체clazz
- 클래스 타입- Returns:
- 객체
- Throws:
Exception
- 예외처리
-
writeObject
writeObject- Parameters:
o
- 객체fileName
- 파일명- Returns:
- 객체
- Throws:
Exception
- 예외처리
-
writeObject
writeObject- Parameters:
o
- 객체file
- 파일 객체- Returns:
- 객체
- Throws:
Exception
- 예외처리
-
deleteFile
파일 삭제- Parameters:
filePath
- 파일 경로- Throws:
Exception
- 예외처리
-
getNewFileName
새 파일명 생성- Parameters:
path
- 경로fileName
- 파일명- Returns:
- 새 파일 객체
- Throws:
Exception
- 예외처리
-
getFileName
public static String getFileName(String orgFileName, javax.servlet.http.HttpServletRequest request) throws Exception 파일명 인코딩- Parameters:
orgFileName
- 원본 파일명request
- HttpServletRequest 객체- Returns:
- 인코딩된 파일명
- Throws:
Exception
- 예외처리
-