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.
public FileStore next
Pointer to next FileStore object in linked list.
public static inline FileStore sys
Built-in system file storage implementation.
Also head of linked list of other FileStores, if any
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.
public virtual bool close(File f)
Implementation for 'File.close'.
public static native bool doClose(Obj fp)
public static native void doFlush(Obj fp)
public static native int doRead(Obj fp)
public static native int doReadBytes(Obj fp, byte[] b, int off, int len)
public static native bool doSeek(Obj fp, int pos)
public static native int doSize(Str name)
public static native int doTell(Obj fp)
public static native bool doWrite(Obj fp, int b)
public static native bool doWriteBytes(Obj fp, byte[] b, int off, int len)
public virtual void flush(File f)
Implementation for 'File.out.flush'.
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.
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.
public virtual bool open(File f, Str mode)
Implementation for 'File.open'.
public virtual int read(File f)
Implementation for 'File.in.read'.
public virtual int readBytes(File f, byte[] b, int off, int len)
Implementation for 'File.in.readBytes'.
public static native bool rename(Str from, Str to)
Rename a file. Return true on success, false on failure.
public virtual bool seek(File f, int pos)
Implementation for 'File.seek'.
public virtual int size(File f)
Implementation for 'File.size'. Must work without opening the file.
public virtual int tell(File f)
Implementation for 'File.tell'.
public virtual bool write(File f, int b)
Implementation for 'File.out.write'.
public virtual bool writeBytes(File f, byte[] b, int off, int len)
Implementation for 'File.out.writeBytes'.