当前位置: 首页>>代码示例>>Java>>正文


Java ErrorCodes.EEXIST属性代码示例

本文整理汇总了Java中net.fusejna.ErrorCodes.EEXIST属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorCodes.EEXIST属性的具体用法?Java ErrorCodes.EEXIST怎么用?Java ErrorCodes.EEXIST使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.fusejna.ErrorCodes的用法示例。


在下文中一共展示了ErrorCodes.EEXIST属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: create

@Override
public int create(String path, ModeWrapper mode, FileInfoWrapper info) {
    Node node = root.find(path);
    if (node != null) {
        return -ErrorCodes.EEXIST();
    }

    int pos = path.lastIndexOf('/');
    if (pos < 0) {
        return -ErrorCodes.ENOENT();
    }
    String name = path.substring(pos + 1);
    if (name.length() < 1) {
        return -ErrorCodes.ENOENT();
    }
    path = path.substring(0, pos);
    if (path.length() < 1) {
        path = "/";
    }

    node = root.find(path);
    if (node == null || !node.isDir()) {
        return -ErrorCodes.ENOENT();
    }

    return node.create(name, mode, info);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:27,代码来源:FuseIotFS.java

示例2: link

@Override
public int link(String path, String target) {
    Node targetNode = root.find(target);
    if (targetNode == null) {
        return -ErrorCodes.ENOENT();
    }

    Node node = root.find(path);
    if (node != null) {
        return -ErrorCodes.EEXIST();
    }

    int pos = path.lastIndexOf('/');
    if (pos < 0) {
        return -ErrorCodes.ENOENT();
    }
    String name = path.substring(pos + 1);
    if (name.length() < 1) {
        return -ErrorCodes.ENOENT();
    }
    path = path.substring(0, pos);
    if (path.length() < 1) {
        path = "/";
    }

    node = root.find(path);
    if (node == null || !node.isDir()) {
        return -ErrorCodes.ENOENT();
    }

    return node.link(name, targetNode);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:32,代码来源:FuseIotFS.java

示例3: mkdir

@Override
public int mkdir(String path, ModeWrapper mode) {
    Node node = root.find(path);
    if (node != null) {
        return -ErrorCodes.EEXIST();
    }

    int pos = path.lastIndexOf('/');
    if (pos < 0) {
        return -ErrorCodes.ENOENT();
    }
    String name = path.substring(pos + 1);
    if (name.length() < 1) {
        return -ErrorCodes.ENOENT();
    }
    path = path.substring(0, pos);
    if (path.length() < 1) {
        path = "/";
    }

    node = root.find(path);
    if (node == null || !node.isDir()) {
        return -ErrorCodes.ENOENT();
    }

    return node.mkdir(name, mode);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:27,代码来源:FuseIotFS.java

示例4: symlink

@Override
public int symlink(String path, String target) {
    Node node = root.find(target);
    if (node != null) {
        return -ErrorCodes.EEXIST();
    }

    int pos = target.lastIndexOf('/');
    if (pos < 0) {
        return -ErrorCodes.ENOENT();
    }
    String name = target.substring(pos + 1);
    if (name.length() < 1) {
        return -ErrorCodes.ENOENT();
    }
    String targetPath = target.substring(0, pos);
    if (targetPath.length() < 1) {
        targetPath = "/";
    }

    node = root.find(targetPath);
    if (node == null || !node.isDir()) {
        return -ErrorCodes.ENOENT();
    }

    return node.symlink(name, path);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:27,代码来源:FuseIotFS.java

示例5: create

@Override
public int create(final String path, final ModeWrapper mode, final FileInfoWrapper info)
{
	if (getPath(path) != null) {
		return -ErrorCodes.EEXIST();
	}
	final MemoryPath parent = getParentPath(path);
	if (parent instanceof MemoryDirectory) {
		((MemoryDirectory) parent).mkfile(getLastComponent(path));
		return 0;
	}
	return -ErrorCodes.ENOENT();
}
 
开发者ID:lisgie,项目名称:ChallengeTask_Group2,代码行数:13,代码来源:MemoryFS.java

示例6: mkdir

@Override
public int mkdir(final String path, final ModeWrapper mode)
{
	if (getPath(path) != null) {
		return -ErrorCodes.EEXIST();
	}
	final MemoryPath parent = getParentPath(path);
	if (parent instanceof MemoryDirectory) {
		((MemoryDirectory) parent).mkdir(getLastComponent(path));
		return 0;
	}
	return -ErrorCodes.ENOENT();
}
 
开发者ID:lisgie,项目名称:ChallengeTask_Group2,代码行数:13,代码来源:MemoryFS.java

示例7: create

@Override
public int create(String path, ModeWrapper mode, FileInfoWrapper info) {
	if(gdrive.findPath(path, null) != null) return -ErrorCodes.EEXIST();
	String parentname = path.substring(0, path.lastIndexOf('/'));
	String name = path.substring(path.lastIndexOf('/') + 1);
	Node parent = gdrive.findPath(parentname, null);
	if (parent == null)
		return -ErrorCodes.ENOENT();
	gdrive.createFile(parent, name);
	return 0;
}
 
开发者ID:tbutter,项目名称:gyingpan,代码行数:11,代码来源:FuseFS.java

示例8: mkdir

@Override
public int mkdir(String path, ModeWrapper mode) {
	System.out.println("mkdir " + path);
	if(gdrive.findPath(path, null) != null) return -ErrorCodes.EEXIST();
	String parentname = path.substring(0, path.lastIndexOf('/'));
	String name = path.substring(path.lastIndexOf('/') + 1);
	Node parent = gdrive.findPath(parentname, null);
	if (parent == null)
		return -ErrorCodes.ENOENT();
	gdrive.createDir(parent, name);
	return 0;
}
 
开发者ID:tbutter,项目名称:gyingpan,代码行数:12,代码来源:FuseFS.java


注:本文中的net.fusejna.ErrorCodes.EEXIST属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。