本文整理汇总了Java中net.fusejna.ErrorCodes.EISDIR属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorCodes.EISDIR属性的具体用法?Java ErrorCodes.EISDIR怎么用?Java ErrorCodes.EISDIR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.fusejna.ErrorCodes
的用法示例。
在下文中一共展示了ErrorCodes.EISDIR属性的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: read
@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();
}
}
示例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: read
@Override
public int read(final String path, final ByteBuffer buffer, final long size, final long offset, final FileInfoWrapper info)
{
final MemoryPath p = getPath(path);
if (p == null) {
return -ErrorCodes.ENOENT();
}
if (!(p instanceof MemoryFile)) {
return -ErrorCodes.EISDIR();
}
return ((MemoryFile) p).read(buffer, size, offset);
}
示例4: truncate
@Override
public int truncate(final String path, final long offset)
{
final MemoryPath p = getPath(path);
if (p == null) {
return -ErrorCodes.ENOENT();
}
if (!(p instanceof MemoryFile)) {
return -ErrorCodes.EISDIR();
}
((MemoryFile) p).truncate(offset);
return 0;
}
示例5: write
@Override
public int write(final String path, final ByteBuffer buf, final long bufSize, final long writeOffset,
final FileInfoWrapper wrapper)
{
final MemoryPath p = getPath(path);
if (p == null) {
return -ErrorCodes.ENOENT();
}
if (!(p instanceof MemoryFile)) {
return -ErrorCodes.EISDIR();
}
return ((MemoryFile) p).write(buf, bufSize, writeOffset);
}
示例6: unlink
@Override
public int unlink(String path) {
Node n = gdrive.findPath(path, null);
if (n == null)
return -ErrorCodes.ENOENT();
if (n.children != null && n.children.size() > 0)
return -ErrorCodes.ENOTEMPTY();
if (n.isDirectory())
return -ErrorCodes.EISDIR();
String parentname = path.substring(0, path.lastIndexOf('/'));
n.delete(gdrive.findPath(parentname, null));
return 0;
}