top

File API

Published 2014-10-28 | (Compatible with SDK 2.5,3.5,4.5,5.0,5.1 and 2010,2011,2012,2013,2014 models)

File API provides the possibility to use I/O functionalities of build-in flash memory. It describes also how to use USB connected devices to store data.

File API enables applications to use the file input/output system supported by the Samsung TV application engine to store data they get while they are still working, and restore the data anytime they want. All applications perform file input/output operations in a common area. Files used in different applications may have the same name. To prevent problems due to this, a directory using application ID (curWidget.id) must be created, and the file in this directory is used. If multiple applications need to share data, they do it through a file path that they share.

File input/output operations are performed by creating a file system object and calling the interface of the object.

The File API includes the following:

Interface Description
Filesystem Generates a file system instance available to be used in an application.
openCommonFile Opens files in common storage area of an application.
closeCommonFile Closes files opened by openCommonFile.
deleteCommonFile Deletes files in the input/output area.
createCommonDir Creates directories in the file input/output area.
deleteCommonDir Deletes directories in the file input/out area.
isValidCommonPath Checks if there is a directory.
readLine Reads a line in an opened file.
writeLine Writes a line in an opened file.
readAll Reads the whole content of the opened file.
writeAll Writes multiple lines in the opened file.
readDir Enables viewing file information in USB.
openFile Opens files in an application.