Package mg.emberframework.core.data
Class File
java.lang.Object
mg.emberframework.core.data.File
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
Gets the file content as bytes.Gets the file name.void
Renames the file using a new name.void
Writes the file's content to a specified directory.
-
Constructor Details
-
File
public File()Default constructor. -
File
Constructs a file with a name and binary content.- Parameters:
fileName
- the file namefileBytes
- the file content as bytes
-
-
Method Details
-
rename
Renames the file using a new name.- Parameters:
newFileName
- the new name for the file
-
writeTo
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
Gets the file name.- Returns:
- the file name
-
getFileBytes
public byte[] getFileBytes()Gets the file content as bytes.- Returns:
- the file bytes
-