Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface...
Transcript of Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface...
![Page 1: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/1.jpg)
Tizen - Web Application
Input/Output Filesystem API
![Page 2: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/2.jpg)
Ajou Univrsity
Contents
• Filesystem API
• Interfaces of Filesystem API
• Filesystem Success Callback
![Page 3: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/3.jpg)
Ajou Univrsity
Filesystem API
![Page 4: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/4.jpg)
Ajou Univrsity
Filesystem API
• Filesystem API • The API which access the Device’s Filesystem
• The following virtual roots were supported:
• Filesystem API support the File URI(Virtual root: /tmp/, ‘file:///tmp)
• Privileges • http://tizen.org/privilege/filesystem.read
• http://tizen.org/privilege/filesystem.read
Image The location for images
Videos The location for videos
Music The location for sounds
Documents The location for documents
Downloads The location for downloaded items
Ringtones The location for ringtones (read-only location)
wgt-package The location for widget package which is read-only
wgt-private The location for a widget's private storage
wgt-private-tmp The location for a widget's private volatile storage
![Page 5: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/5.jpg)
Ajou Univrsity
Interface of Filesystem API
![Page 6: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/6.jpg)
Ajou Univrsity
FilesystemManager
• FilesystemManager • The interface access the Filesystem API
• Methods
resolve To access the file by Resolving location
getStorage To bring information in the Storage
listStorages To show the Storage list in device
addStorageStateChangeListener To indicate a change in the storage
addStorageStateChangeListener To indicate change of storage removal
![Page 7: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/7.jpg)
Ajou Univrsity
FilesystemManager
• FilesystemManager • Example of FilesystemManager
Handling a file with Resolve method
Perform the funcion(dir) in Success Method
Perform onsuccess in dir.listFilesd in Success method
To create test.txt
To write “HelloWorld” in file on Write mode and close it
To show the created file on Console window
![Page 8: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/8.jpg)
Ajou Univrsity
FilesystemStorage
• FilesystemStorage • The interface of additional Storage(Information of Device’s mount,
name, Removal)
• Attributes
readonly DOMString label Name of Storage
readonly FileSystemStorageType type Type of Storage
readonly FileSystemStorageState state State of Storage ( mount or not)
![Page 9: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/9.jpg)
Ajou Univrsity
File
• File • The interface of File abstraction (According to isFile property)
![Page 10: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/10.jpg)
Ajou Univrsity
File
• File
• Attributes
readonly File parent Parent Directory
readonly boolean readOnly State of the access in File/Directory
readonly boolean isFile The attribute whether File or not
readonly boolean isDirectory The attribute whether Directory or not
readonly Date created Information on a timestamp file is created
readonly Date modified Information on a timestamp file is modified
readonly DOMString path Information about the file’s location (except file name)
readonly DOMString fullPath The whole information about the file
readonly long length The number of file and directory in File handle
![Page 11: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/11.jpg)
Ajou Univrsity
File
• File • Methods
toURI Returns a URI for a file
listFiles Lists all files in a directory
openStream Opens a file
readAsText Reads the content with DOMString(string)
copyTo Copies and overwrites a file or a directory
moveTo Moves and overwrites a file or a directory
createDirectory To create directory
createFile To create empty file
resolve Resolves an existing file or directory relative to the current directory
deleteDirectory To delete Directory/Directory tree
deleteFile To delete File
![Page 12: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/12.jpg)
Ajou Univrsity
File
• File • Example of File interface
Handling the files through tizen.filesystem.resolve
Line 6 : Reading file name generated by createFile
Line 8 : Show the location by toURI method
Line 12 : Reads i-th file by textmode
Line 17 : Show the number of file in its Directory
![Page 13: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/13.jpg)
Ajou Univrsity
FileStream
• FileStream • Handling to a File opened for read and write operation interface
• Attributes
The interface Attribute and Method
readonly boolean eof Indicates the file pointer is at the end of the file
long position Indicate the stream position for read or write
readonly long bytesAvailable The number of bytes that are available for reading for the stream
![Page 14: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/14.jpg)
Ajou Univrsity
FileStream
• FileStream • Methods
close Close File Stream
read Read the specific number of character
readBytes Read the specified number of bytes
write Writes the specified DOMString
writeBytes Writes the specified bytes
![Page 15: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/15.jpg)
Ajou Univrsity
Filesystem Success Callback
![Page 16: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/16.jpg)
Ajou Univrsity
FileSuccessCallback
• FileSuccessCallback • File object’s input argument is a property when the success is
done
• Because of asynchronous operation, the callback function is written in advance
• Asynchronous call Success
FileSuccessCallback interface and parameter
• File from Asynchronous call
![Page 17: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/17.jpg)
Ajou Univrsity
FileSystemStorageArraySuccessCallback
• FileSystemStorageArraySuccessCallback • FileSystem Storage object’s input argument is a property when the
success is done • In Array of FileSystemStorage object Call back
• Because of asynchronous operation, the callback function is written in advance
• Asynchronous call Success
FileSystemStorageArraySuccessCallback interface and parameter
• The list of available device
![Page 18: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/18.jpg)
Ajou Univrsity
FileSystemStorageSuccessCallback
• FileSystemStorageSuccessCallback • FileSystem Storage object’s input argument is a property when the
success is done • In Array of FileSystemStorage object Call back
• Because of asynchronous operation, the callback function is written in advance
• Asynchronous call Success
FileSystemStorageSuccessCallback interface and parameter
• Storage Device Structure
![Page 19: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/19.jpg)
Ajou Univrsity
FileStringSuccessCallback
• FileStringSuccessCallback • Read the DOMString file content
• DOMString object is input argument and Call back
• Asynchronous operation
• Asynchronous call Success
FileStringSuccessCallback interface and parameter
• The file represented as a DOMString
![Page 20: Tizen - Web Application · Ajou Univrsity FilesystemManager •FilesystemManager •The interface access the Filesystem API •Methods resolve To access the file by Resolving location](https://reader030.fdocuments.us/reader030/viewer/2022040312/5e0533c937bd2e685a71bd27/html5/thumbnails/20.jpg)
Ajou Univrsity
FileStreamSuccessCallback
• FileStreamSuccessCallback • This interface is opening the File
• FileStream object is input argument and Call back
• Asynchronous operation
• Asynchronous call Success
FileStringSuccessCallback interface and parameter
• The filestream to access file content