Class NikeFS2LazyRandomAccessStorageImpl

  • All Implemented Interfaces:
    java.io.DataInput, java.io.DataOutput, NikeFS2RandomAccessStorage

    public class NikeFS2LazyRandomAccessStorageImpl
    extends NikeFS2RandomAccessStorageImpl
    Lazy implementation of the random access storage in NikeFS2: Blocks are copied as late as possible (soft copies), while retaining soft links otherwise.
    Author:
    Christian W. Guenther (christian@deckfour.org)
    • Field Detail

      • isSoftCopy

        protected boolean isSoftCopy
        Whether this instance is still a soft copy (i.e., actually empty).
    • Constructor Detail

      • NikeFS2LazyRandomAccessStorageImpl

        public NikeFS2LazyRandomAccessStorageImpl​(NikeFS2VirtualFileSystem virtualFileSystem)
        Creates a new instance.
        Parameters:
        virtualFileSystem - Virtual file system to store data to.
      • NikeFS2LazyRandomAccessStorageImpl

        public NikeFS2LazyRandomAccessStorageImpl​(NikeFS2LazyRandomAccessStorageImpl template)
        Creates a new instance.
        Parameters:
        template - Storage of which this instance is a soft copy.
    • Method Detail

      • registerSoftCopy

        public void registerSoftCopy​(NikeFS2LazyRandomAccessStorageImpl copycat)
        This method is used by child copies to register with their parent.
        Parameters:
        copycat - The child soft copy to register.
      • deregisterSoftCopy

        public void deregisterSoftCopy​(NikeFS2LazyRandomAccessStorageImpl copycat)
        This method is used by child copies to deregister with their parent.
        Parameters:
        copycat - The child soft copy to deregister.
      • alertSoftCopies

        public void alertSoftCopies()
                             throws java.io.IOException
        This method alerts all child soft copies of this storage to consolidate; called prior to modification of this instance. The child soft copies so alerted will detach from this instance consequently.
        Throws:
        java.io.IOException
      • consolidateSoftCopy

        public void consolidateSoftCopy()
                                 throws java.io.IOException
        Consolidates this soft copy prior to modification. This will detach this instance from its parent, creating a true copy of its current data.
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b,
                          int off,
                          int len)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • write

        public void write​(byte[] b)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • write

        public void write​(int b)
                   throws java.io.IOException
        Specified by:
        write in interface java.io.DataOutput
        Overrides:
        write in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeBoolean

        public void writeBoolean​(boolean v)
                          throws java.io.IOException
        Specified by:
        writeBoolean in interface java.io.DataOutput
        Overrides:
        writeBoolean in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeByte

        public void writeByte​(int b)
                       throws java.io.IOException
        Specified by:
        writeByte in interface java.io.DataOutput
        Overrides:
        writeByte in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeBytes

        public void writeBytes​(java.lang.String str)
                        throws java.io.IOException
        Specified by:
        writeBytes in interface java.io.DataOutput
        Overrides:
        writeBytes in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeChar

        public void writeChar​(int c)
                       throws java.io.IOException
        Specified by:
        writeChar in interface java.io.DataOutput
        Overrides:
        writeChar in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeChars

        public void writeChars​(java.lang.String str)
                        throws java.io.IOException
        Specified by:
        writeChars in interface java.io.DataOutput
        Overrides:
        writeChars in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeDouble

        public void writeDouble​(double d)
                         throws java.io.IOException
        Specified by:
        writeDouble in interface java.io.DataOutput
        Overrides:
        writeDouble in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeFloat

        public void writeFloat​(float f)
                        throws java.io.IOException
        Specified by:
        writeFloat in interface java.io.DataOutput
        Overrides:
        writeFloat in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeInt

        public void writeInt​(int i)
                      throws java.io.IOException
        Specified by:
        writeInt in interface java.io.DataOutput
        Overrides:
        writeInt in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeLong

        public void writeLong​(long l)
                       throws java.io.IOException
        Specified by:
        writeLong in interface java.io.DataOutput
        Overrides:
        writeLong in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeShort

        public void writeShort​(int s)
                        throws java.io.IOException
        Specified by:
        writeShort in interface java.io.DataOutput
        Overrides:
        writeShort in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • writeUTF

        public void writeUTF​(java.lang.String str)
                      throws java.io.IOException
        Specified by:
        writeUTF in interface java.io.DataOutput
        Overrides:
        writeUTF in class NikeFS2RandomAccessStorageImpl
        Throws:
        java.io.IOException
      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable