Sedona

sys::FileStore


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

public class FileStore

FileStore is used to implement the backing storage of File based I/O. Typically each storage device such as static RAM or EEPROM implements a subclass of FileStore and declares a singleton instance, inserting it into the FileStore static linked list at runtime. Filenames are mapped to a FileStore instance via 'FileStore.lookup', which steps through the static linked list and calls accept() on each one, returning the first instance that returns true.


next

public FileStore next

Pointer to next FileStore object in linked list.

sys

public static inline FileStore sys

Built-in system file storage implementation.

  Also head of linked list of other FileStores, if any
accept

public virtual bool accept(Str filename)

Parse the given filename, and return true if this is the appropriate FileStore instance to handle it. Default is to return false.

close

public virtual bool close(File f)

Implementation for 'File.close'.

doClose

public static native bool doClose(Obj fp)

doFlush

public static native void doFlush(Obj fp)

doOpen

public static native Obj doOpen(Str name, Str mode)

doRead

public static native int doRead(Obj fp)

doReadBytes

public static native int doReadBytes(Obj fp, byte[] b, int off, int len)

doSeek

public static native bool doSeek(Obj fp, int pos)

doSize

public static native int doSize(Str name)

doTell

public static native int doTell(Obj fp)

doWrite

public static native bool doWrite(Obj fp, int b)

doWriteBytes

public static native bool doWriteBytes(Obj fp, byte[] b, int off, int len)

flush

public virtual void flush(File f)

Implementation for 'File.out.flush'.

insert

public static bool insert(FileStore fsObj)

Insert fsObj at end of FileStore list.

This function should be called by the constructor of an instance of a FileStore subclass, to insert itself into the list.

Always returns true. No protection against adding an instance multiple times.

lookup

public static FileStore lookup(Str filename)

Return first FileStore instance from list that returns true from accept(). Returns FileStore.sys if no instance returns true.

open

public virtual bool open(File f, Str mode)

Implementation for 'File.open'.

read

public virtual int read(File f)

Implementation for 'File.in.read'.

readBytes

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

Implementation for 'File.in.readBytes'.

rename

public static native bool rename(Str from, Str to)

Rename a file. Return true on success, false on failure.

seek

public virtual bool seek(File f, int pos)

Implementation for 'File.seek'.

size

public virtual int size(File f)

Implementation for 'File.size'. Must work without opening the file.

tell

public virtual int tell(File f)

Implementation for 'File.tell'.

write

public virtual bool write(File f, int b)

Implementation for 'File.out.write'.

writeBytes

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

Implementation for 'File.out.writeBytes'.