Class FileUtils

java.lang.Object
io.github.enxign.shed.toolkit.FileUtils

public class FileUtils extends Object
FileUtils 파일 관련 유틸리티 클래스
Since:
2021-02-01
Version:
1.0
 수정일        수정자       수정내용
 ----------   ---------   -------------------------------
 2021-02-01   first       create
 
Author:
enxign
  • Constructor Details

    • FileUtils

      public FileUtils()
  • Method Details

    • filePathBlank1

      public static String filePathBlank1(String path)
      경로 제거
      Parameters:
      path - 대상 경로
      Returns:
      경로 제거된 문자열
    • getFilename

      public static String getFilename(File file)
      getFilename
      Parameters:
      file - 파일 객체
      Returns:
      파일명
    • getFilename

      public static String getFilename(String filePath)
      getFilename
      Parameters:
      filePath - 파일 경로
      Returns:
      파일명
    • getFileExtension

      public static String getFileExtension(String filePath)
      getFileExtension
      Parameters:
      filePath - 파일 경로
      Returns:
      파일 확장자
    • getFileExtension

      public static String getFileExtension(File file)
      getFileExtension
      Parameters:
      file - 파일 객체
      Returns:
      파일 확장자
    • readObject

      public static Object readObject(String fileName) throws Exception
      readObject
      Parameters:
      fileName - 파일명
      Returns:
      객체
      Throws:
      Exception - 예외처리
    • readObject

      public static <T> T readObject(String fileName, Class<T> clazz) throws Exception
      readObject
      Type Parameters:
      T - 객체 타입
      Parameters:
      fileName - 파일명
      clazz - 클래스 타입
      Returns:
      객체
      Throws:
      Exception - 예외처리
    • readObject

      public static <T> T readObject(File file, Class<T> clazz) throws Exception
      readObject
      Type Parameters:
      T - 객체 타입
      Parameters:
      file - 파일 객체
      clazz - 클래스 타입
      Returns:
      객체
      Throws:
      Exception - 예외처리
    • writeObject

      public static Object writeObject(Object o, String fileName) throws Exception
      writeObject
      Parameters:
      o - 객체
      fileName - 파일명
      Returns:
      객체
      Throws:
      Exception - 예외처리
    • writeObject

      public static Object writeObject(Object o, File file) throws Exception
      writeObject
      Parameters:
      o - 객체
      file - 파일 객체
      Returns:
      객체
      Throws:
      Exception - 예외처리
    • deleteFile

      public static void deleteFile(String filePath) throws Exception
      파일 삭제
      Parameters:
      filePath - 파일 경로
      Throws:
      Exception - 예외처리
    • getNewFileName

      public static File getNewFileName(String path, String fileName) throws Exception
      새 파일명 생성
      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 - 예외처리