jaulib
v1.3.6
Jau Support Library (C++, Java, ..)
Loading...
Searching...
No Matches
java_jni
org
jau
fs
MountFlags.java
Go to the documentation of this file.
1
/**
2
* Author: Sven Gothel <sgothel@jausoft.com>
3
* Copyright (c) 2022 Gothel Software e.K.
4
*
5
* Permission is hereby granted, free of charge, to any person obtaining
6
* a copy of this software and associated documentation files (the
7
* "Software"), to deal in the Software without restriction, including
8
* without limitation the rights to use, copy, modify, merge, publish,
9
* distribute, sublicense, and/or sell copies of the Software, and to
10
* permit persons to whom the Software is furnished to do so, subject to
11
* the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be
14
* included in all copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23
*/
24
package
org.jau.fs;
25
26
/**
27
* Generic flag bit values for mount() `flags`.
28
*
29
* See mount(2) for a detailed description.
30
*
31
* @see FileUtil#mount_image(String, String, String, long, String)
32
* @see FileUtil#mount(String, String, String, long, String)
33
*/
34
public
class
MountFlags
{
35
36
public
static
interface
Bit
{
37
String
name
();
38
long
value
();
39
}
40
public
static
enum
Bit0
implements
Bit
{
41
none
( 0 );
42
43
Bit0
(
final
long
v) { _value = v; }
44
private
final
long
_value;
45
46
@Override
47
public
long
value
() {
return
_value; }
48
}
49
protected
Bit
[]
bit_values
() {
return
Bit0
.values(); }
50
51
private
long
mask;
52
53
public
long
value
() {
return
mask; }
54
55
protected
MountFlags
(
final
long
v) {
56
mask = v;
57
}
58
public
MountFlags
() {
59
mask = 0;
60
}
61
62
public
boolean
isSet
(
final
Bit
bit) {
return
bit.
value
() == ( mask & bit.
value
() ); }
63
64
public
MountFlags
set
(
final
Bit
bit) { mask = mask | bit.value();
return
this
; }
65
66
@Override
67
public
String
toString
() {
68
int
count = 0;
69
final
StringBuilder out =
new
StringBuilder();
70
for
(
final
Bit
dt :
bit_values
()) {
71
if
( 0 != dt.value() &&
isSet
(dt) ) {
72
if
( 0 < count ) { out.append(
", "
); }
73
out.append(dt.name()); count++;
74
}
75
}
76
if
( 1 < count ) {
77
out.insert(0,
"["
);
78
out.append(
"]"
);
79
}
80
return
out.toString();
81
}
82
83
@Override
84
public
boolean
equals
(
final
Object other) {
85
if
(
this
== other) {
86
return
true
;
87
}
88
return
(other instanceof
MountFlags
) &&
89
this.mask == ((
MountFlags
)other).mask;
90
}
91
}
org.jau.fs.MountFlags.bit_values
Bit[] bit_values()
Definition
MountFlags.java:49
org.jau.fs.MountFlags.MountFlags
MountFlags()
Definition
MountFlags.java:58
org.jau.fs.MountFlags.MountFlags
MountFlags(final long v)
Definition
MountFlags.java:55
org.jau.fs.MountFlags.value
long value()
Definition
MountFlags.java:53
org.jau.fs.MountFlags.toString
String toString()
Definition
MountFlags.java:67
org.jau.fs.MountFlags.isSet
boolean isSet(final Bit bit)
Definition
MountFlags.java:62
org.jau.fs.MountFlags.equals
boolean equals(final Object other)
Definition
MountFlags.java:84
org.jau.fs.MountFlags.Bit0
Definition
MountFlags.java:40
org.jau.fs.MountFlags.Bit0.none
none
Definition
MountFlags.java:41
org.jau.fs.MountFlags.Bit0.value
long value()
Definition
MountFlags.java:47
org.jau.fs.MountFlags.Bit0.Bit0
Bit0(final long v)
Definition
MountFlags.java:43
org.jau.fs.MountFlags.Bit
Definition
MountFlags.java:36
org.jau.fs.MountFlags.Bit.value
long value()
org.jau.fs.MountFlags.Bit.name
String name()
Generated on Tue Feb 18 2025 00:30:40 for jaulib by
1.13.2