Class File

java.lang.Object
mg.emberframework.core.data.File

public class File extends Object
Represents a file with a name and binary content.

This class provides methods to rename the file and write its content to a directory.

Since:
1.0.0
Version:
1.0.0
Author:
Sandratra NIAINA
  • Constructor Details

    • File

      public File()
      Default constructor.
    • File

      public File(String fileName, byte[] fileBytes)
      Constructs a file with a name and binary content.
      Parameters:
      fileName - the file name
      fileBytes - the file content as bytes
  • Method Details

    • rename

      public void rename(String newFileName)
      Renames the file using a new name.
      Parameters:
      newFileName - the new name for the file
    • writeTo

      public void writeTo(String dirPath) throws IOException
      Writes the file's content to a specified directory.
      Parameters:
      dirPath - the directory path to write to
      Throws:
      IOException - if an I/O error occurs during writing
    • getFileName

      public String getFileName()
      Gets the file name.
      Returns:
      the file name
    • getFileBytes

      public byte[] getFileBytes()
      Gets the file content as bytes.
      Returns:
      the file bytes