本文整理了Java中jnr.posix.POSIX.lseek()
方法的一些代码示例,展示了POSIX.lseek()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。POSIX.lseek()
方法的具体详情如下:
包路径:jnr.posix.POSIX
类名称:POSIX
方法名:lseek
暂无
代码示例来源:origin: com.github.jnr/jnr-posix
public int lseek(int fd, long offset, int whence) {
return posix().lseek(fd, offset, whence);
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int lseek(int fd, long offset, int whence) {
return posix().lseek(fd, offset, whence);
}
代码示例来源:origin: com.github.jnr/jnr-posix
public int lseek(int fd, long offset, int whence) {
try { return posix.lseek(fd, offset, whence); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: io.prestosql.cassandra/cassandra-driver
public int lseek(int fd, long offset, int whence) {
try { return posix.lseek(fd, offset, whence); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int lseek(int fd, long offset, int whence) {
try { return posix.lseek(fd, offset, whence); } catch (UnsatisfiedLinkError ule) { return unimplementedInt(); }
}
代码示例来源:origin: com.facebook.presto.cassandra/cassandra-driver
public int lseek(int fd, long offset, int whence) {
return posix().lseek(fd, offset, whence);
}
代码示例来源:origin: org.jruby/jruby-complete
private static long transfer(ThreadContext context, ReadableByteChannel from, FileChannel to, long length, long position) throws IOException {
// handle large files on 32-bit JVMs
long chunkSize = 128 * 1024 * 1024;
long transferred = 0;
long bytes;
long startPosition = to.position();
if (position != -1) {
if (from instanceof NativeSelectableChannel) {
int ret = context.runtime.getPosix().lseek(((NativeSelectableChannel)from).getFD(), position, PosixShim.SEEK_SET);
if (ret == -1) {
throw context.runtime.newErrnoFromErrno(Errno.valueOf(context.runtime.getPosix().errno()), from.toString());
}
}
}
if (length > 0) {
while ((bytes = to.transferFrom(from, startPosition+transferred, Math.min(chunkSize, length))) > 0) {
transferred += bytes;
length -= bytes;
}
} else {
while ((bytes = to.transferFrom(from, startPosition+transferred, chunkSize)) > 0) {
transferred += bytes;
}
}
// transforFrom does not change position of target
to.position(startPosition + transferred);
return transferred;
}
代码示例来源:origin: org.jruby/jruby-core
private static long transfer(ThreadContext context, ReadableByteChannel from, FileChannel to, long length, long position) throws IOException {
// handle large files on 32-bit JVMs
long chunkSize = 128 * 1024 * 1024;
long transferred = 0;
long bytes;
long startPosition = to.position();
if (position != -1) {
if (from instanceof NativeSelectableChannel) {
int ret = context.runtime.getPosix().lseek(((NativeSelectableChannel)from).getFD(), position, PosixShim.SEEK_SET);
if (ret == -1) {
throw context.runtime.newErrnoFromErrno(Errno.valueOf(context.runtime.getPosix().errno()), from.toString());
}
}
}
if (length > 0) {
while ((bytes = to.transferFrom(from, startPosition+transferred, Math.min(chunkSize, length))) > 0) {
transferred += bytes;
length -= bytes;
}
} else {
while ((bytes = to.transferFrom(from, startPosition+transferred, chunkSize)) > 0) {
transferred += bytes;
}
}
// transforFrom does not change position of target
to.position(startPosition + transferred);
return transferred;
}
代码示例来源:origin: org.jruby/jruby-complete
int ret = context.runtime.getPosix().lseek(((NativeSelectableChannel)from).getFD(), position, PosixShim.SEEK_SET);
if (ret == -1) {
throw context.runtime.newErrnoFromErrno(Errno.valueOf(context.runtime.getPosix().errno()), from.toString());
代码示例来源:origin: org.jruby/jruby-core
int ret = context.runtime.getPosix().lseek(((NativeSelectableChannel)from).getFD(), position, PosixShim.SEEK_SET);
if (ret == -1) {
throw context.runtime.newErrnoFromErrno(Errno.valueOf(context.runtime.getPosix().errno()), from.toString());
代码示例来源:origin: org.python/jython
public static long lseek(PyObject fd, long pos, int how) {
Object javaobj = fd.__tojava__(RawIOBase.class);
if (javaobj != Py.NoConversion) {
try {
return ((RawIOBase) javaobj).seek(pos, how);
} catch (PyException pye) {
throw badFD();
}
} else {
return posix.lseek(getFD(fd).getIntFD(), pos, how);
}
}
内容来源于网络,如有侵权,请联系作者删除!