本文整理匯總了Java中net.fusejna.types.TypeMode類的典型用法代碼示例。如果您正苦於以下問題:Java TypeMode類的具體用法?Java TypeMode怎麽用?Java TypeMode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
TypeMode類屬於net.fusejna.types包,在下文中一共展示了TypeMode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: DropboxVirtualFile
import net.fusejna.types.TypeMode; //導入依賴的package包/類
DropboxVirtualFile(String fileName, VirtualVolume volume) throws IOException {
super(fileName, volume);
if (file.exists()) {
Set<PosixFilePermission> perms = Files.getPosixFilePermissions(Paths.get(fileName));
long attr = (perms.contains(PosixFilePermission.OWNER_READ) ? TypeMode.S_IRUSR : 0L) |
(perms.contains(PosixFilePermission.OWNER_WRITE) ? TypeMode.S_IWUSR : 0L) |
(perms.contains(PosixFilePermission.OWNER_EXECUTE) ? TypeMode.S_IXUSR : 0L) |
(perms.contains(PosixFilePermission.GROUP_READ) ? TypeMode.S_IRGRP : 0L) |
(perms.contains(PosixFilePermission.GROUP_WRITE) ? TypeMode.S_IWGRP : 0L) |
(perms.contains(PosixFilePermission.GROUP_EXECUTE) ? TypeMode.S_IXGRP : 0L) |
(perms.contains(PosixFilePermission.OTHERS_READ) ? TypeMode.S_IROTH : 0L) |
(perms.contains(PosixFilePermission.OTHERS_WRITE) ? TypeMode.S_IWOTH : 0L) |
(perms.contains(PosixFilePermission.OTHERS_EXECUTE) ? TypeMode.S_IXOTH : 0L);
this.attr = attr;
} else {
this.attr = 256; // 420 init: owner R+W, group+other R
}
}
示例2: setAttr
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@Override
public void setAttr(long attr) throws IOException {
this.attr = attr;
if (file.exists()) {
Set<PosixFilePermission> perms = new HashSet<PosixFilePermission>();
// add owners permission
if ((attr & TypeMode.S_IRUSR) > 0) perms.add(PosixFilePermission.OWNER_READ);
if ((attr & TypeMode.S_IWUSR) > 0) perms.add(PosixFilePermission.OWNER_WRITE);
if ((attr & TypeMode.S_IXUSR) > 0) perms.add(PosixFilePermission.OWNER_EXECUTE);
// add group permissions
if ((attr & TypeMode.S_IRGRP) > 0) perms.add(PosixFilePermission.GROUP_READ);
if ((attr & TypeMode.S_IWGRP) > 0) perms.add(PosixFilePermission.GROUP_WRITE);
if ((attr & TypeMode.S_IXGRP) > 0) perms.add(PosixFilePermission.GROUP_EXECUTE);
// add others permissions
if ((attr & TypeMode.S_IROTH) > 0) perms.add(PosixFilePermission.OTHERS_READ);
if ((attr & TypeMode.S_IWOTH) > 0) perms.add(PosixFilePermission.OTHERS_WRITE);
if ((attr & TypeMode.S_IXOTH) > 0) perms.add(PosixFilePermission.OTHERS_EXECUTE);
Files.setPosixFilePermissions(Paths.get(file.getPath()), perms);
}
}
示例3: setMode
import net.fusejna.types.TypeMode; //導入依賴的package包/類
public StatWrapper setMode(final NodeType type, long attr) {
if (attr != -1) {
modeWrapper.setMode( type,
((attr & TypeMode.S_IRUSR) > 0),
((attr & TypeMode.S_IWUSR) > 0),
((attr & TypeMode.S_IXUSR) > 0),
((attr & TypeMode.S_IRGRP) > 0),
((attr & TypeMode.S_IWGRP) > 0),
((attr & TypeMode.S_IXGRP) > 0),
((attr & TypeMode.S_IROTH) > 0),
((attr & TypeMode.S_IWOTH) > 0),
((attr & TypeMode.S_IXOTH) > 0));
} else {
setMode(type);
}
return this;
}
示例4: updateFileMetaData
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@Override
public void updateFileMetaData(String path, final StructStat.StatWrapper stat) throws ClassNotFoundException, FsException, IOException {
Entry entry = resolvePath(path);
if (entry.getType() == Entry.TYPE.DIRECTORY) {
stat.setMode(TypeMode.NodeType.DIRECTORY);
}
if (entry.getType() == Entry.TYPE.FILE) {
stat.setMode(TypeMode.NodeType.FILE);
File file = (File) entry;
stat.setMode(TypeMode.NodeType.FILE).size(entry.getSize());
stat.atime(file.getAtime());
stat.ctime(file.getCtime());
}
}
示例5: _create
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _create(final String path, final TypeMode mode, final StructFuseFileInfo info)
{
final FileInfoWrapper wrapper = new FileInfoWrapper(path, info);
final int result = create(path, new ModeWrapper(mode), wrapper);
wrapper.write();
return result;
}
示例6: _create
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _create(final String path, final TypeMode mode,
final StructFuseFileInfo info) {
final FileInfoWrapper wrapper = new FileInfoWrapper(path, info);
final int result = create(path, new ModeWrapper(mode), wrapper);
wrapper.write();
return result;
}
示例7: file
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@Test(timeout = 10000)
public void file() throws IOException {
drive.createFile(getTestFileName(), testFolder, getTestContent());
StatHolder stat = Export.createStatHolder();
String path = Paths.get("/").resolve(getTestFileName()).toString();
assertThat(fs.getattr(path, stat.wrapper), equalTo(0));
assertThat(stat.size(), equalTo(getTestContentBytes().length));
assertThat(stat.type(), equalTo(TypeMode.NodeType.FILE));
}
示例8: directory
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@Test(timeout = 10000)
public void directory() throws IOException {
drive.createFolder(getTestFolderName(), testFolder);
StatHolder stat = Export.createStatHolder();
String path = Paths.get("/").resolve(getTestFolderName()).toString();
assertThat(fs.getattr(path, stat.wrapper), equalTo(0));
assertThat(stat.size(), equalTo(0));
assertThat(stat.type(), equalTo(TypeMode.NodeType.DIRECTORY));
}
示例9: _chmod
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _chmod(final String path, final TypeMode mode)
{
return chmod(path, new ModeWrapper(mode));
}
示例10: _mkdir
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _mkdir(final String path, final TypeMode mode)
{
return mkdir(path, new ModeWrapper(mode));
}
示例11: _mknod
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _mknod(final String path, final TypeMode mode, final TypeDev dev)
{
return mknod(path, new ModeWrapper(mode), dev.longValue());
}
示例12: _chmod
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _chmod(final String path, final TypeMode mode) {
chmod(path, new ModeWrapper(mode));
return 0;
}
示例13: _mkdir
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _mkdir(final String path, final TypeMode mode) {
return mkdir(path, new ModeWrapper(mode));
}
示例14: _mknod
import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _mknod(final String path, final TypeMode mode, final TypeDev dev) {
return mknod(path, new ModeWrapper(mode), dev.longValue());
}
示例15: type
import net.fusejna.types.TypeMode; //導入依賴的package包/類
public TypeMode.NodeType type() {
return wrapper.type();
}