Class MkStorage.InFile

    • Constructor Detail

      • InFile

        public InFile​(File file)
               throws IOException
        Public ctor.
        Parameters:
        file - File to use
        Throws:
        IOException - If there is any I/O problem
    • Method Detail

      • xml

        public com.jcabi.xml.XML xml()
                              throws IOException
        Description copied from interface: MkStorage
        Get full XML.
        Specified by:
        xml in interface MkStorage
        Returns:
        XML
        Throws:
        IOException - If there is any I/O problem, or if the current storage is locked by another thread.
      • apply

        public void apply​(Iterable<org.xembly.Directive> dirs)
                   throws IOException
        Description copied from interface: MkStorage
        Update XML with this directives.
        Specified by:
        apply in interface MkStorage
        Parameters:
        dirs - Directives
        Throws:
        IOException - If there is any I/O problem, or if the current storage is locked by another thread.
      • lock

        public void lock()
        Description copied from interface: MkStorage
        Locks storage to the current thread.

        If the lock is available, grant it to the calling thread and block all operations from other threads. If not available, wait for the holder of the lock to release it with MkStorage.unlock() before any other operations can be performed.

        Locking behavior is reentrant, which means a thread can invoke MkStorage.lock() multiple times, where a hold count is maintained.

        Specified by:
        lock in interface MkStorage
      • unlock

        public void unlock()
        Description copied from interface: MkStorage
        Unlock storage.

        Locking behavior is reentrant, thus if the thread invoked MkStorage.lock() multiple times, the hold count is decremented. If the hold count reaches 0, the lock is released.

        If the current thread does not hold the lock, an IllegalMonitorStateException will be thrown.

        Specified by:
        unlock in interface MkStorage