當前位置: 首頁>>代碼示例>>Java>>正文


Java TypeMode類代碼示例

本文整理匯總了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
	}
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:21,代碼來源:DropboxVirtualFile.java

示例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);
	}
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:24,代碼來源:DropboxVirtualFile.java

示例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;
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:18,代碼來源:StructStat.java

示例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());
    }
}
 
開發者ID:lisgie,項目名稱:ChallengeTask_Group2,代碼行數:15,代碼來源:TreeController.java

示例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;
}
 
開發者ID:lisgie,項目名稱:ChallengeTask_Group2,代碼行數:9,代碼來源:FuseFilesystem.java

示例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;
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:9,代碼來源:FuseFilesystem.java

示例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));
}
 
開發者ID:stepank,項目名稱:jdbox,代碼行數:10,代碼來源:GetAttrTest.java

示例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));
}
 
開發者ID:stepank,項目名稱:jdbox,代碼行數:10,代碼來源:GetAttrTest.java

示例9: _chmod

import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _chmod(final String path, final TypeMode mode)
{
	return chmod(path, new ModeWrapper(mode));
}
 
開發者ID:lisgie,項目名稱:ChallengeTask_Group2,代碼行數:6,代碼來源:FuseFilesystem.java

示例10: _mkdir

import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _mkdir(final String path, final TypeMode mode)
{
	return mkdir(path, new ModeWrapper(mode));
}
 
開發者ID:lisgie,項目名稱:ChallengeTask_Group2,代碼行數:6,代碼來源:FuseFilesystem.java

示例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());
}
 
開發者ID:lisgie,項目名稱:ChallengeTask_Group2,代碼行數:6,代碼來源:FuseFilesystem.java

示例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;
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:6,代碼來源:FuseFilesystem.java

示例13: _mkdir

import net.fusejna.types.TypeMode; //導入依賴的package包/類
@FuseMethod
final int _mkdir(final String path, final TypeMode mode) {
	return mkdir(path, new ModeWrapper(mode));
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:5,代碼來源:FuseFilesystem.java

示例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());
}
 
開發者ID:Rohde-Schwarz-Cybersecurity,項目名稱:PanBox,代碼行數:5,代碼來源:FuseFilesystem.java

示例15: type

import net.fusejna.types.TypeMode; //導入依賴的package包/類
public TypeMode.NodeType type() {
    return wrapper.type();
}
 
開發者ID:stepank,項目名稱:jdbox,代碼行數:4,代碼來源:StatHolder.java


注:本文中的net.fusejna.types.TypeMode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。