/** * Closes the <tt>Channel</tt>. * <p> * This closes the underlying native file descriptor. * </p> * @throws java.io.IOException */ public void close() throws IOException { if (!isOpen) { throw new IllegalStateException("file already closed"); } isOpen = false; libc.close(fd); } }
/** * Closes the <tt>Channel</tt>. * <p> * This closes the underlying native file descriptor. * </p> * @throws java.io.IOException */ public void close() throws IOException { if (!isOpen) { throw new IllegalStateException("file already closed"); } isOpen = false; libc.close(fd); } }
/** * Closes the <tt>Channel</tt>. * <p> * This closes the underlying native file descriptor. * </p> * @throws java.io.IOException */ public void close() throws IOException { if (!isOpen) { throw new IllegalStateException("file already closed"); } isOpen = false; libc.close(fd); } }
/** * Closes the <tt>Channel</tt>. * <p> * This closes the underlying native file descriptor. * </p> * @throws java.io.IOException */ public void close() throws IOException { if (!isOpen) { throw new IllegalStateException("file already closed"); } isOpen = false; libc.close(fd); } }
public int close(int fd) { return libc().close(fd); }
public int close(int fd) { return libc().close(fd); }
public int close(int fd) { return libc().close(fd); }
public int truncate(CharSequence path, long length) { // Windows doesn't have a native truncate() equivalent, but it does have a native ftruncate() equivalent. // In order to call the ftruncate() equivalent, we must convert a path to a FD. We do that by wrapping the // ftruncate() call with open() and close(). // Permissions are ignored since we're not using O_CREAT. int fd = libc().open(path, OpenFlags.O_WRONLY.intValue(), 0); if (fd == -1) { return -1; } if (libc().ftruncate(fd, length) == -1) { return -1; } if (libc().close(fd) == -1) { return -1; } // truncate() returns 0 on success. return 0; }
public int truncate(CharSequence path, long length) { // Windows doesn't have a native truncate() equivalent, but it does have a native ftruncate() equivalent. // In order to call the ftruncate() equivalent, we must convert a path to a FD. We do that by wrapping the // ftruncate() call with open() and close(). // Permissions are ignored since we're not using O_CREAT. int fd = libc().open(path, OpenFlags.O_WRONLY.intValue(), 0); if (fd == -1) { return -1; } if (libc().ftruncate(fd, length) == -1) { return -1; } if (libc().close(fd) == -1) { return -1; } // truncate() returns 0 on success. return 0; }
public int truncate(CharSequence path, long length) { // Windows doesn't have a native truncate() equivalent, but it does have a native ftruncate() equivalent. // In order to call the ftruncate() equivalent, we must convert a path to a FD. We do that by wrapping the // ftruncate() call with open() and close(). // Permissions are ignored since we're not using O_CREAT. int fd = libc().open(path, OpenFlags.O_WRONLY.intValue(), 0); if (fd == -1) { return -1; } if (libc().ftruncate(fd, length) == -1) { return -1; } if (libc().close(fd) == -1) { return -1; } // truncate() returns 0 on success. return 0; }