本文整理汇总了Java中net.fusejna.ErrorCodes.ENOENT属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorCodes.ENOENT属性的具体用法?Java ErrorCodes.ENOENT怎么用?Java ErrorCodes.ENOENT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.fusejna.ErrorCodes
的用法示例。
在下文中一共展示了ErrorCodes.ENOENT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readdir
@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);
}
示例2: write
@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();
}
}
示例3: rename
@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;
}
示例4: getattr
@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;
}
示例5: 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);
}
示例6: getattr
@Override
public int getattr(String path, StatWrapper stat) {
Node node = root.find(path, false);
if (node == null) {
return -ErrorCodes.ENOENT();
}
if (!node.isInitDone()) {
node.init();
}
return node.getAttr(stat);
}
示例7: 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);
}
示例8: 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);
}
示例9: open
@Override
public int open(String path, FileInfoWrapper info) {
Node node = root.find(path);
if (node == null) {
return -ErrorCodes.ENOENT();
}
if (!node.isInitDone()) {
node.init();
}
return node.open(path, info);
}
示例10: read
@Override
public int read(String path, ByteBuffer buffer, long size, long offset, FileInfoWrapper info) {
Node node = root.find(path);
if (node == null) {
return -ErrorCodes.ENOENT();
}
return node.read(path, buffer, size, offset, info);
}
示例11: readlink
@Override
public int readlink(String path, ByteBuffer buffer, long size) {
Node node = root.find(path, false);
if (node == null) {
return -ErrorCodes.ENOENT();
}
if (!node.isInitDone()) {
node.init();
}
return node.readlink(buffer, size);
}
示例12: release
@Override
public int release(String path, FileInfoWrapper info) {
Node node = root.find(path);
if (node == null) {
return -ErrorCodes.ENOENT();
}
return node.release(path, info);
}
示例13: rmdir
@Override
public int rmdir(String path) {
Node node = root.find(path, false);
if (node == null) {
return -ErrorCodes.ENOENT();
}
return node.rmdir(path);
}
示例14: 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);
}
示例15: truncate
@Override
public int truncate(String path, long offset) {
Node node = root.find(path);
if (node == null) {
return -ErrorCodes.ENOENT();
}
return node.truncate(path, offset);
}