• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ErrorCodes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: rmdir

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int rmdir(String path) {
    if (!children.isEmpty()) {
        return -ErrorCodes.ENOTEMPTY();
    }

    int r = iotClient.updateCertificate(certificateId, false);
    if (r != 0) {
        return r;
    }

    r = iotClient.deleteCertificate(certificateId);
    if (r != 0) {
        return r;
    }

    return super.rmdir(path);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:19,代码来源:CertificateNode.java


示例2: symunlink

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int symunlink(String name) {
    Node node = getChild(name);
    if (node == null) {
        return -ErrorCodes.ENODEV();
    }

    Node sourceNode = this.find(name);
    if (sourceNode instanceof PolicyNode) {
        int r = iotClient.detachPolicy(certificateArn, sourceNode.getName());
        if (r != 0) {
            return r;
        }
    } else {
        return -ErrorCodes.ENODEV();
    }

    return 0;
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:20,代码来源:CertificatePoliciesNode.java


示例3: read

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public synchronized int read(String path, ByteBuffer buf, long bufSize, long offset, FileInfoWrapper info) {
    try {
        document = getDocument();
    } catch (Exception e) {
        return -ErrorCodes.EIO();
    }
    size = document.length();

    if (offset < 0) {
        offset = 0;
    }
    if (offset >= size) {
        return 0;
    }
    if (bufSize < 0) {
        bufSize = size;
    }
    if (offset + bufSize > size) {
        bufSize = size - offset;
    }

    buf.put(document.getBytes(), (int) offset, (int) bufSize);
    return (int) bufSize;
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:26,代码来源:DocumentNode.java


示例4: symunlink

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int symunlink(String name) {
    Node node = getChild(name);
    if (node == null) {
        return -ErrorCodes.ENODEV();
    }

    Node sourceNode = this.find(name);
    if (sourceNode instanceof CertificateNode) {
        CertificateNode certificateNode = (CertificateNode) sourceNode;
        int r = iotClient.detachCertificate(certificateNode.getCertificateArn(), thingName);
        if (r != 0) {
            return r;
        }
    } else {
        return -ErrorCodes.ENODEV();
    }

    return 0;
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:21,代码来源:PrincipalsNode.java


示例5: readlink

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int readlink(ByteBuffer buffer, long size) {
       String path;
       if (this.parent == source.parent) {
           path = source.name;
       } else {
           path = this.getRelativePathToRoot() + source.getAbsolutePath();
       }
       byte[] bytes = path.getBytes();
       if (size < bytes.length) {
           return -ErrorCodes.ENOSPC();
       }
       
       buffer.put(bytes);
       return 0;
   }
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:17,代码来源:LinkNode.java


示例6: readdir

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int readdir(String path, DirectoryFiller filler) {
    Node node = root.find(path);
    if (node == null) {
        return -ErrorCodes.ENOENT();
    }

    if (!node.isDir()) {
        return -ErrorCodes.ENOTDIR();
    }

    if (!node.isInitDone()) {
        node.init();
    }
    return node.readdir(filler);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:17,代码来源:FuseIotFS.java


示例7: truncate

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int truncate(final String path, final long offset)
{
	// TODO: verify that the file at path is writable, in
	// accordance w/ man pages. Perhaps this is always the case?
	try {
		getPath(path).truncate(offset);
		FileWriteCollector collector = openFiles.get(path);
		if (collector != null) {
			collector.truncate(offset);
		}
	} catch (IOException e) {
		e.printStackTrace();
		return -ErrorCodes.EIO();
	}
	return 0;
}
 
开发者ID:smacke,项目名称:gdrivefs,代码行数:18,代码来源:GoogleDriveLinuxFs.java


示例8: release

import net.fusejna.ErrorCodes; //导入依赖的package包/类
/**
 * According to fuse documentation, this is always
 * preceded by a flush().
 * Ref: http://fuse.sourceforge.net/doxygen/structfuse__operations.html
 */
@Override
public int release(String path, FileInfoWrapper info)
{
	File f = fileHandles.remove(info.fh());
	if (f == null) {
		return ErrorCodes.EBADF(); // bad fd
	}
	try
	{
		f.close();
	}
	catch(IOException e)
	{
		e.printStackTrace();
		return ErrorCodes.EIO();
	}
	openFiles.remove(f);
	return 0;
}
 
开发者ID:smacke,项目名称:gdrivefs,代码行数:25,代码来源:GoogleDriveLinuxFs.java


示例9: setxattr

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int setxattr(final String path, final String xattr, final ByteBuffer buf, final long size, final int flags,
		final int position)
{
	if (!path.equals(filename)) {
		return -ErrorCodes.ENOTSUP();
	}
	byte[] attr;
	if (!helloTxtAttrs.containsKey(xattr)) {
		attr = new byte[(int) (size + position)];
		helloTxtAttrs.put(xattr, attr);
	}
	else {
		attr = helloTxtAttrs.get(xattr);
		if (attr.length < size + position) {
			attr = Arrays.copyOf(attr, (int) (size + position));
		}
	}
	buf.get(attr, position, (int) size);
	return 0;
}
 
开发者ID:lisgie,项目名称:ChallengeTask_Group2,代码行数:22,代码来源:XattrExampleFS.java


示例10: rename

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int rename(final String path, final String newName)
{
	final MemoryPath p = getPath(path);
	if (p == null) {
		return -ErrorCodes.ENOENT();
	}
	final MemoryPath newParent = getParentPath(newName);
	if (newParent == null) {
		return -ErrorCodes.ENOENT();
	}
	if (!(newParent instanceof MemoryDirectory)) {
		return -ErrorCodes.ENOTDIR();
	}
	p.delete();
	p.rename(newName.substring(newName.lastIndexOf("/")));
	((MemoryDirectory) newParent).add(p);
	return 0;
}
 
开发者ID:lisgie,项目名称:ChallengeTask_Group2,代码行数:20,代码来源:MemoryFS.java


示例11: getattr

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int getattr(String path, StatWrapper stat) {
	Node n = gdrive.findPath(path, null);
	if (n == null)
		return -ErrorCodes.ENOENT();
	stat.setAllTimesMillis(n.lastModified);
	stat.size(n.getSize());
	if (n.isDirectory())
		stat.setMode(NodeType.DIRECTORY);
	else {
		if (n.isGoogleFile())
			stat.setMode(NodeType.FILE, true, false, false);
		else
			stat.setMode(NodeType.FILE, true, true, false);
	}
	return 0;
}
 
开发者ID:tbutter,项目名称:gyingpan,代码行数:18,代码来源:FuseFS.java


示例12: read

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int read(String path, ByteBuffer buffer, long size, long offset,
		FileInfoWrapper info) {
	//System.out.println("read " + path + " " + offset + " " + size);
	Node n = gdrive.findPath(path, info);
	if (n.isDirectory())
		return -ErrorCodes.EISDIR();
	try {
		synchronized (n) {
			File f = n.cache();
			RandomAccessFile aFile = new RandomAccessFile(f, "r");
			FileChannel inChannel = aFile.getChannel();
			buffer.limit((int) size);
			int len = inChannel.read(buffer, offset);
			aFile.close();
			if(len < 0) len = 0;
			return len;
		}
	} catch (IOException e) {
		e.printStackTrace();
		return -ErrorCodes.EAGAIN();
	}
}
 
开发者ID:tbutter,项目名称:gyingpan,代码行数:24,代码来源:FuseFS.java


示例13: rename

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int rename(String path, String newName) {
	System.out.println("rename " + path + " " + newName);
	Node n = gdrive.findPath(path, null);
	if (n == null)
		return -ErrorCodes.ENOENT();
	String fromDir = path.substring(0, path.lastIndexOf('/'));
	String fromName = path.substring(path.lastIndexOf('/') + 1);
	String toDir = newName.substring(0, newName.lastIndexOf('/'));
	String toName = newName.substring(newName.lastIndexOf('/') + 1);
	if (fromDir.equals(toDir)) {
		n.rename(toName);
	} else {
		if (!fromName.equals(toName)) {
			n.rename(toName);
		}
		Node toNode = gdrive.findPath(toDir, null);
		if (toNode == null)
			return -ErrorCodes.ENOENT();
		n.move(gdrive.findPath(fromDir, null), toNode);
	}
	return 0;
}
 
开发者ID:tbutter,项目名称:gyingpan,代码行数:24,代码来源:FuseFS.java


示例14: write

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int write(String path, ByteBuffer buf, long bufSize,
		long writeOffset, FileInfoWrapper info) {
	Node n = gdrive.findPath(path, info);
	if(n == null) return -ErrorCodes.ENOENT();
	if (n.isDirectory())
		return -ErrorCodes.EISDIR();
	try {
		synchronized (n) {
			File f = n.cache();
			RandomAccessFile aFile = new RandomAccessFile(f, "rw");
			FileChannel inChannel = aFile.getChannel();
			buf.limit((int)bufSize);
			int len = inChannel.write(buf, writeOffset);
			n.markDirty();
			n.size = aFile.length();
			aFile.close();
			return len;
		}
	} catch (IOException e) {
		e.printStackTrace();
		return -ErrorCodes.EAGAIN();
	}
}
 
开发者ID:tbutter,项目名称:gyingpan,代码行数:25,代码来源:FuseFS.java


示例15: translateException

import net.fusejna.ErrorCodes; //导入依赖的package包/类
private int translateException(Exception e) {
    if (e instanceof ResourceNotFoundException) {
        return -ErrorCodes.ENODEV();
    } else if (e instanceof UnauthorizedException) {
        return -ErrorCodes.EACCES();
    } else if (e instanceof InvalidRequestException) {
        return -ErrorCodes.EINVAL();
    } else if (e instanceof DeleteConflictException) {
        return -ErrorCodes.EBUSY();
    }

    return -ErrorCodes.EIO();
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:14,代码来源:AwsIot.java


示例16: write

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public synchronized int write(String path, ByteBuffer buf, long bufSize, long offset, FileInfoWrapper info) {
    if (bufSize <= 0) {
        return 0;
    }
    if (offset < 0) {
        return 0;
    }
    if (offset + bufSize > MAX_BUFFER_SIZE) {
        return -ErrorCodes.ENOSPC();
    }

    if (offset + bufSize > buffer.capacity()) {
        long newSize = offset + bufSize + DEFAULT_BUFFER_SIZE;
        ByteBuffer newBuffer = ByteBuffer.allocate((int) newSize);
        buffer.flip();
        newBuffer.put(buffer);
        buffer = newBuffer;
    }

    byte[] data = new byte[(int) bufSize];
    buf.get(data);

    int pos = buffer.position();
    buffer.position((int) offset);
    buffer.put(data);

    if (pos > buffer.position()) {
        buffer.position(pos);
    }

    return (int) bufSize;
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:34,代码来源:PublishNode.java


示例17: symlink

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int symlink(String name, String path) {
    Node sourceNode = this.find(path);
    if (sourceNode instanceof PolicyNode) {
        int r = iotClient.attachPolicy(certificateArn, sourceNode.getName());
        if (r != 0) {
            return r;
        }
    } else {
        return -ErrorCodes.ENODEV();
    }

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


示例18: write

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public synchronized int write(String path, ByteBuffer buf, long bufSize, long offset, FileInfoWrapper info) {
    if (bufSize <= 0) {
        return 0;
    }
    if (offset < 0) {
        return 0;
    }
    if (offset + bufSize > maxDocumentSize) {
        return -ErrorCodes.ENOSPC();
    }

    StringBuffer strBuffer = new StringBuffer();
    if (offset > 0) {
        if (offset <= document.length()) {
            strBuffer.append(document.substring(0, (int) offset));
        } else {
            strBuffer.append(document);
            long len = document.length();
            while (len < offset) {
                strBuffer.append(" ");
                len++;
            }
        }
    }

    byte[] data = new byte[(int) bufSize];
    buf.get(data);
    strBuffer.append(new String(data));

    if (offset + bufSize < document.length()) {
        strBuffer.append(document.substring((int) (offset + bufSize)));
    }

    document = strBuffer.toString();
    size = document.length();
    isDirty = true;

    return (int) bufSize;
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:41,代码来源:DocumentNode.java


示例19: release

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public synchronized int release(String path, FileInfoWrapper info) {
    try {
        if (isDirty) {
            try {
                setDocument(document);
            } catch (Exception e) {
                return -ErrorCodes.EIO();
            }
        }
    } finally {
        isDirty = false;
    }
    return 0;
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:16,代码来源:DocumentNode.java


示例20: rmdir

import net.fusejna.ErrorCodes; //导入依赖的package包/类
@Override
public int rmdir(String path) {
    if (!children.isEmpty()) {
        return -ErrorCodes.ENOTEMPTY();
    }

    int r = iotClient.deleteTopicRule(name);
    if (r != 0) {
        return r;
    }

    return super.rmdir(path);
}
 
开发者ID:awslabs,项目名称:aws-iot-fuse,代码行数:14,代码来源:TopicRuleNode.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java TextAreaBuilder类代码示例发布时间:2022-05-22
下一篇:
Java RecyclerViewPager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap