# sys::MemoryFileStore

    sys::Obj
      sys::Virtual
        sys::FileStore
          sys::MemoryFileStore

`public abstract class MemoryFileStore`

A file store implementation where the file contents are backed by an in- memory byte[]. The memory file is modeled by a MemoryFile object. When a sys::File is opened by this file store, the "fp" field of the File will be assigned to a MemoryFile. Therefore, any open memory file can be accessed by casting the fp field of the sys::File to a MemoryFile. Sub-classes must implement the following abstract methods:

       int getMemorySize(File f)
       bool openMemoryFile(MemoryFile m)

close

  `public override bool close(File f)`

flush

  `public virtual override void flush(File f)`

getMemorySize

  `public abstract int getMemorySize(File f)`

  Return the size of the memory buffer back the file represented by "f".

open

  `public override bool open(File f, Str mode)`

openMemoryFile

  `public abstract bool openMemoryFile(MemoryFile m)`

  Given a MemoryFile, the implementation must set the mem byte[] to point to the contents being backed by the memory file. Pre-Condition: all fields of the MemoryFile are initialized except for the mem field. return true on success, false on error.

read

  `public virtual override int read(File f)`

readBytes

  `public virtual override int readBytes(File f, byte[] b, int off, int len)`

seek

  `public virtual override bool seek(File f, int pos)`

size

  `public override int size(File f)`

  Must be implemented by getMemorySize(File f)

tell

  `public virtual override int tell(File f)`

write

  `public virtual override bool write(File f, int b)`

writeBytes

  `public virtual override bool writeBytes(File f, byte[] b, int off, int len)`