Skip to content

What is a File System

Devrath edited this page Jun 7, 2021 · 1 revision

Definition:

  • FileSystem is a way of storing data in documents instead of key-value mapping mechanism.
  • Using this mechanism, we can fetch, add, delete, and move it to a different location.
  • We use it to store large size of data like images, audio, video and so on.
  • We can store the data here instead of shared preferences or local database.

How to use the file system

  • We need to get access to the root-file or root-directory.
  • Once we have the access, we can add more children files within the accessed location.
  • The file is created with a name using the stream

How the streams work

  • Stream is a pipe that can send data in one direction, or receive the data from the other direction.
  • We have two types of streams an input stream and an output stream.
    • Input streams ---> Used for reading data from a file.
    • Output streams --> Used for writing data to a file.
  • We get a reference to file or directory, Then Using that obtained reference create an input stream or the output stream. Then using the particular stream we modify or read the data.
Clone this wiki locally