@Private
@Unstable
public class NativeIO
extends java.lang.Object
| Modifier and Type | Class | Description |
|---|---|---|
static class |
NativeIO.POSIX |
|
static class |
NativeIO.Windows |
| Constructor | Description |
|---|---|
NativeIO() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
copyFileUnbuffered(java.io.File src,
java.io.File dst) |
Unbuffered file copy from src to dst without tainting OS buffer cache
In POSIX platform:
It uses FileChannel#transferTo() which internally attempts
unbuffered IO on OS with native sendfile64() support and falls back to
buffered IO otherwise.
|
static java.io.FileOutputStream |
getCreateForWriteFileOutputStream(java.io.File f,
int permissions) |
|
static java.lang.String |
getOwner(java.io.FileDescriptor fd) |
|
static java.io.FileDescriptor |
getShareDeleteFileDescriptor(java.io.File f,
long seekOffset) |
Create a FileDescriptor that shares delete permission on the
file opened at a given offset, i.e.
|
static boolean |
isAvailable() |
|
static void |
link(java.io.File src,
java.io.File dst) |
Deprecated.
|
static void |
renameTo(java.io.File src,
java.io.File dst) |
A version of renameTo that throws a descriptive exception when it fails.
|
public static boolean isAvailable()
public static java.lang.String getOwner(java.io.FileDescriptor fd)
throws java.io.IOException
java.io.IOExceptionpublic static java.io.FileDescriptor getShareDeleteFileDescriptor(java.io.File f,
long seekOffset)
throws java.io.IOException
f - input f.seekOffset - input seekOffset.java.io.IOException - raised on errors performing I/O.public static java.io.FileOutputStream getCreateForWriteFileOutputStream(java.io.File f,
int permissions)
throws java.io.IOException
f - the file that we want to createpermissions - we want to have on the file (if security is enabled)SecureIOUtils.AlreadyExistsException - if the file already existsjava.io.IOException - if any other error occurredpublic static void renameTo(java.io.File src,
java.io.File dst)
throws java.io.IOException
src - The source pathdst - The destination pathNativeIOException - On failure.java.io.IOException@Deprecated
public static void link(java.io.File src,
java.io.File dst)
throws java.io.IOException
Files API.src - source filedst - hardlink locationjava.io.IOException - raised on errors performing I/O.public static void copyFileUnbuffered(java.io.File src,
java.io.File dst)
throws java.io.IOException
src - The source pathdst - The destination pathjava.io.IOException - raised on errors performing I/O.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.