本文整理了Java中jnr.posix.POSIX.allocateStat()
方法的一些代码示例,展示了POSIX.allocateStat()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.allocateStat()
方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:allocateStat
暂无
代码示例来源:origin: com.github.jnr/jnr-posix
public FileStat allocateStat() {
return posix().allocateStat();
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public FileStat allocateStat() {
try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public FileStat allocateStat() {
return posix().allocateStat();
}
代码示例来源:origin: com.github.jnr/jnr-posix
public FileStat allocateStat() {
try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public FileStat allocateStat() {
return posix().allocateStat();
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public FileStat allocateStat() {
try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
}
代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep
public FileStat allocateStat() {
return posix().allocateStat();
}
代码示例来源:origin: com.cloudbees.util/jnr-unixsocket-nodep
public FileStat allocateStat() {
try { return posix.allocateStat(); } catch (UnsatisfiedLinkError ule) { return unimplementedNull(); }
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public FileStat stat() {
FileStat stat = posix.allocateStat();
return posix.stat(file.getAbsolutePath(), stat) < 0 ? null : stat;
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public FileStat lstat() {
FileStat stat = posix.allocateStat();
return posix.lstat(file.getAbsolutePath(), stat) < 0 ? null : stat;
}
代码示例来源:origin: org.jruby/jruby-complete
@Override
public FileStat lstat() {
FileStat stat = posix.allocateStat();
return posix.lstat(file.getAbsolutePath(), stat) < 0 ? null : stat;
}
代码示例来源:origin: org.jruby/jruby-core
@Override
public FileStat stat() {
FileStat stat = posix.allocateStat();
return posix.stat(file.getAbsolutePath(), stat) < 0 ? null : stat;
}
代码示例来源:origin: org.jruby/jruby-complete
public ChannelFD getWrapperFromFileno(int fileno) {
ChannelFD fd = filenoMap.get(fileno);
// This is a hack to get around stale ChannelFD that are closed when a descriptor is reused.
// It appears to happen for openpty, and in theory could happen for any IO call that produces
// a new descriptor.
if (fd != null && !fd.ch.isOpen() && !isFake(fileno)) {
FileStat stat = posix.allocateStat();
if (posix.fstat(fileno, stat) >= 0) {
// found ChannelFD is closed, but actual fileno is open; clear it.
filenoMap.remove(fileno);
fd = null;
}
}
return fd;
}
代码示例来源:origin: org.jruby/jruby-core
public ChannelFD getWrapperFromFileno(int fileno) {
ChannelFD fd = filenoMap.get(fileno);
// This is a hack to get around stale ChannelFD that are closed when a descriptor is reused.
// It appears to happen for openpty, and in theory could happen for any IO call that produces
// a new descriptor.
if (fd != null && !fd.ch.isOpen() && !isFake(fileno)) {
FileStat stat = posix.allocateStat();
if (posix.fstat(fileno, stat) >= 0) {
// found ChannelFD is closed, but actual fileno is open; clear it.
filenoMap.remove(fileno);
fd = null;
}
}
return fd;
}
代码示例来源:origin: org.jruby/jruby-complete
public long size(ChannelFD fd) {
if (fd.chNative != null) { // native fd, use fstat
FileStat stat = posix.allocateStat();
int ret = posix.fstat(fd.chNative.getFD(), stat);
if (ret == -1) {
errno = Errno.valueOf(posix.errno());
return -1;
}
return stat.st_size();
} else if (fd.chSeek != null) { // if it is seekable, get size directly
try {
return fd.chSeek.size();
} catch (IOException ioe) {
errno = Helpers.errnoFromException(ioe);
return -1;
}
} else {
// otherwise just return -1 (should be rare, since size is only defined on File
errno = Errno.EINVAL;
return -1;
}
}
代码示例来源:origin: org.jruby/jruby-core
public long size(ChannelFD fd) {
if (fd.chNative != null) { // native fd, use fstat
FileStat stat = posix.allocateStat();
int ret = posix.fstat(fd.chNative.getFD(), stat);
if (ret == -1) {
errno = Errno.valueOf(posix.errno());
return -1;
}
return stat.st_size();
} else if (fd.chSeek != null) { // if it is seekable, get size directly
try {
return fd.chSeek.size();
} catch (IOException ioe) {
errno = Helpers.errnoFromException(ioe);
return -1;
}
} else {
// otherwise just return -1 (should be rare, since size is only defined on File
errno = Errno.EINVAL;
return -1;
}
}
内容来源于网络,如有侵权,请联系作者删除!