Class FlatStorage

  • All Implemented Interfaces:
    java.lang.AutoCloseable, Storage

    public class FlatStorage
    extends java.lang.Object
    implements Storage
    A Storage that stores the cache as a series of flat files, designed to be git revisioned.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String EXTENSION  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected FlatStorage()  
        FlatStorage​(java.io.File directory)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      void init​(Store store)  
      protected java.lang.String[] listFlatcacheFiles()  
      byte[] load​(int index, int archive)  
      void load​(Store store)  
      protected java.io.InputStream openReader​(java.lang.String filename)  
      protected java.io.OutputStream openWriter​(java.lang.String filename)  
      void save​(Store store)  
      void store​(int index, int archive, byte[] bytes)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • FlatStorage

        public FlatStorage​(java.io.File directory)
                    throws java.io.IOException
        Throws:
        java.io.IOException
      • FlatStorage

        protected FlatStorage()
    • Method Detail

      • openReader

        protected java.io.InputStream openReader​(java.lang.String filename)
                                          throws java.io.IOException
        Throws:
        java.io.IOException
      • openWriter

        protected java.io.OutputStream openWriter​(java.lang.String filename)
                                           throws java.io.IOException
        Throws:
        java.io.IOException
      • listFlatcacheFiles

        protected java.lang.String[] listFlatcacheFiles()
                                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • init

        public void init​(Store store)
                  throws java.io.IOException
        Specified by:
        init in interface Storage
        Throws:
        java.io.IOException
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface Storage
        Throws:
        java.io.IOException
      • load

        public void load​(Store store)
                  throws java.io.IOException
        Specified by:
        load in interface Storage
        Throws:
        java.io.IOException
      • save

        public void save​(Store store)
                  throws java.io.IOException
        Specified by:
        save in interface Storage
        Throws:
        java.io.IOException
      • load

        public byte[] load​(int index,
                           int archive)
        Specified by:
        load in interface Storage
      • store

        public void store​(int index,
                          int archive,
                          byte[] bytes)
        Specified by:
        store in interface Storage