Package com.jcabi.github.mock
Class MkStorage.InFile
- java.lang.Object
-
- com.jcabi.github.mock.MkStorage.InFile
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.github.mock.MkStorage
MkStorage.InFile, MkStorage.Synced
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
apply(Iterable<org.xembly.Directive> dirs)
Update XML with this directives.void
lock()
Locks storage to the current thread.String
toString()
void
unlock()
Unlock storage.com.jcabi.xml.XML
xml()
Get full XML.
-
-
-
Constructor Detail
-
InFile
public InFile() throws IOException
Public ctor.- Throws:
IOException
- If there is any I/O problem
-
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 interfaceMkStorage
- 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 interfaceMkStorage
- 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.
-
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.
-
-