Class FileReader

java.lang.Object
me.axolotl.api.tool.FileReader

public final class FileReader extends Object
FileReader類別提供了用於從文件讀取和保存數據的實用方法。
Since:
2024-02-08
  • Constructor Details

    • FileReader

      public FileReader()
  • Method Details

    • read

      @NotNull public static @NotNull Collection<String> read(File file) throws IOException
      將文件的內容讀取到一個字符串集合中。
      Parameters:
      file - 要讀取的文件。
      Returns:
      包含從文件讀取的行的集合。
      Throws:
      IOException - 如果在讀取文件時發生I/O錯誤。
    • save

      public static void save(File file, String @NotNull ... data) throws IOException
      將指定的數據保存到文件中。
      Parameters:
      file - 要保存數據的文件。
      data - 要保存的數據。
      Throws:
      IOException - 如果在寫入文件時發生I/O錯誤。
    • writeBelow

      public static void writeBelow(File file, @NotNull @NotNull String data) throws IOException
      將指定的數據寫入文件現有內容的下方。
      Parameters:
      file - 要將數據寫入的文件。
      data - 要寫入的數據。
      Throws:
      IOException - 如果在寫入文件時發生I/O錯誤。