Persistence in computing terms usually means some state that remains within the system after the computer has been restarted. For example, the user rightly expects the file storage to be persistent.

File store

The file store is the main persistence mechanism, although, it is more accurate to refer to the storage medium itself. So, a hard disk drive provides non-volatile storage on which a persistent file system can be built.

Persistence Interface

At the simplest level, an operating system provides the base persistence interface by supporting the creation and update of files.

Commonly, many file-based applications simply read all the data from a file and internalize it for in memory manipulation, before at some point writing out a new external representation of the modified data. Saving a word processing file for example.

This approach tho' is not sufficient in a world where an application may need to process many megabytes of data. For these applications a finer granularity of data access is required which is where databases fit in, providing efficient and scalable access to the data contained.

IStore

Although the Cut The Crap IStore implementations were designed to support the Generic Persistence Object Model the fundamental functionality they provide can be used for more general purposes.

Here is the interface:

public interface IStore {
  public PSOutputStream allocStream();
  public PSInputStream getStream(int streamID);
  public void freeStream(int streamID);
  public PSOutputStream reallocStream(int streamID);
}
public interface PSOutputStream extends OutputStream {
  public int commit(); // returns streamID
}

PSOutputStream implements the standard OutputStream and PSInputStream the standard InputStream. They can be compared with FileOutputStream and FileInputStream with the important addition of the commit method on the PSOutputStream allowing the subsequent retrieval of the PSInputStream.