Package com.naver.ads.persistence.files
Object FileHelper
-
- All Implemented Interfaces:
public class FileHelperA helper object for file operations.
-
-
Field Summary
Fields Modifier and Type Field Description public final static FileHelperINSTANCE
-
Method Summary
Modifier and Type Method Description final FilegetDir()Returns the directory of NaverAdsServices final FilegetFile(String fileName)Returns the file. final BooleanwriteFile(String fileName, String content)Writes a String to a file. final JSONObjectreadFileAsJSONObject(String fileName)Reads the content of a File into a JSONObject. final BooleandeleteFile(String fileName)Deletes a file. final StringreadText(String fileName)Reads the content of a File into a String. final StringreadText(File file)Reads the content of a File into a String. -
-
Method Detail
-
getFile
final File getFile(String fileName)
Returns the file. if does not exist or is not a file, null is returned.
- Parameters:
fileName- the fileName- Returns:
the file that associates fileName.
-
writeFile
final Boolean writeFile(String fileName, String content)
Writes a String to a file.
- Parameters:
fileName- the fileName to write.content- the content to write.- Returns:
trueif the file is successfully wrote,falseotherwise.
-
readFileAsJSONObject
final JSONObject readFileAsJSONObject(String fileName)
Reads the content of a File into a JSONObject. If the file does not exist or is not a file, null is returned.
- Parameters:
fileName- the fileName to read.- Returns:
a JSONObject containing all the content of the file, or null if it doesn't exists.
-
deleteFile
final Boolean deleteFile(String fileName)
Deletes a file.
- Parameters:
fileName- the fileName to delete.- Returns:
trueif the file is successfully deleted,falseotherwise.
-
readText
final String readText(String fileName)
Reads the content of a File into a String. If the file does not exist or is not a file, null is returned.
- Parameters:
fileName- the fileName to read.- Returns:
a String containing all the content of the file, or null if it doesn't exists.
-
-
-
-