本文整理汇总了Java中net.fusejna.ErrorCodes.ENOSPC属性的典型用法代码示例。如果您正苦于以下问题:Java ErrorCodes.ENOSPC属性的具体用法?Java ErrorCodes.ENOSPC怎么用?Java ErrorCodes.ENOSPC使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.fusejna.ErrorCodes
的用法示例。
在下文中一共展示了ErrorCodes.ENOSPC属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readlink
@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;
}
示例2: write
@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;
}
示例3: write
@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;
}