Class CurrentGroup
java.lang.Object
com.github.marschall.memoryfilesystem.CurrentGroup
Provides access to the group of the current user.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface for a task during which a certain group should be used.static interfaceFunctional interface for a task during which a certain group should be used. -
Method Summary
Modifier and TypeMethodDescriptionstatic <V> VuseDuring(GroupPrincipal group, CurrentGroup.GroupTask<V> task) Sets the current group for a certain period.static voiduseDuring(GroupPrincipal group, CurrentGroup.VoidGroupTask task) Sets the current group for a certain period.
-
Method Details
-
useDuring
public static <V> V useDuring(GroupPrincipal group, CurrentGroup.GroupTask<V> task) throws IOException Sets the current group for a certain period.- Type Parameters:
V- the type of the return value- Parameters:
group- the group to usetask- during this task the given group will be used, will be called immediately by the current thread- Returns:
- what the task returned
- Throws:
IOException- if any of the code in the task throws anIOException
-
useDuring
public static void useDuring(GroupPrincipal group, CurrentGroup.VoidGroupTask task) throws IOException Sets the current group for a certain period.- Parameters:
group- the group to usetask- during this task the given group will be used, will be called immediately by the current thread- Throws:
IOException- if any of the code in the task throws anIOException- Since:
- 2.4.0
-