Class FileAccessor

java.lang.Object
io.extact.rms.application.persistence.file.io.FileAccessor

public class FileAccessor extends Object
ファイルアクセスクラス
  • Constructor Details

    • FileAccessor

      public FileAccessor(Path csvFilePath)
      コンストラクタ

      Parameters:
      csvFilePath - ファイルパス
  • Method Details

    • getFilePath

      public Path getFilePath()
      ファイルパスを取得する。

      Returns:
      ファイルパス
    • load

      public int load(List<String[]> dataList) throws IOException
      ファイルを読み込む。

      Parameters:
      dataList - 読み込んだデータを埋めて返す(in/out)
      Returns:
      読み込み件数
      Throws:
      IOException - 読み込みエラーが発生した場合
    • save

      public void save(String[] targetData) throws IOException
      ファイルに書き込む。

      Parameters:
      targetData - 書き込みデータ
      Throws:
      IOException - 読み込みエラーが発生した場合
    • saveAll

      public void saveAll(List<String[]> allData) throws IOException
      全件をファイルに書き込む。 ファイルに既にあるデータは削除される。
      Parameters:
      allData - 書き込みデータ
      Throws:
      IOException - 読み込みエラーが発生した場合
    • copyResourceToRealPath

      public static Path copyResourceToRealPath(String resourcePath, PathResolver resolver)
      指定されたリソースファイルを一時ディレクトリにコピーする。

      Parameters:
      resourcePath - リソースファイル
      resolver - コピー先の一時ディレクトリが指定されたPathResolver
      Returns:
      一時ディレクトリにコピーされたファイルのパス
      Throws:
      IOException - ファイル入出力エラーが発生した場合
    • copyResourceToRealPath

      public static Path copyResourceToRealPath(String resourcePath, PathResolver resolver, String outputFileName)