FileUtils
public
final
class
FileUtils
extends Object
java.lang.Object | |
↳ | android.os.FileUtils |
Utility methods useful for working with files.
Summary
Nested classes | |
---|---|
interface |
FileUtils.ProgressListener
Listener that is called periodically as progress is made. |
Public methods | |
---|---|
static
void
|
closeQuietly(FileDescriptor fd)
This method was deprecated
in API level 30.
This method may suppress potentially significant exceptions, particularly when
closing writable resources. With a writable resource, a failure thrown from |
static
void
|
closeQuietly(AutoCloseable closeable)
This method was deprecated
in API level 30.
This method may suppress potentially significant exceptions, particularly when
closing writable resources. With a writable resource, a failure thrown from |
static
long
|
copy(InputStream in, OutputStream out, CancellationSignal signal, Executor executor, FileUtils.ProgressListener listener)
Copy the contents of one stream to another. |
static
long
|
copy(FileDescriptor in, FileDescriptor out, CancellationSignal signal, Executor executor, FileUtils.ProgressListener listener)
Copy the contents of one FD to another. |
static
long
|
copy(FileDescriptor in, FileDescriptor out)
Copy the contents of one FD to another. |
static
long
|
copy(InputStream in, OutputStream out)
Copy the contents of one stream to another. |
Inherited methods | |
---|---|
Public methods
closeQuietly
public static void closeQuietly (FileDescriptor fd)
This method was deprecated
in API level 30.
This method may suppress potentially significant exceptions, particularly when
closing writable resources. With a writable resource, a failure thrown from close()
should be considered as significant as a failure thrown from a write method because it may
indicate a failure to flush bytes to the underlying resource.
Closes the given object quietly, ignoring any checked exceptions. Does
nothing if the given object is null
.
Parameters | |
---|---|
fd |
FileDescriptor : This value may be null . |
closeQuietly
public static void closeQuietly (AutoCloseable closeable)
This method was deprecated
in API level 30.
This method may suppress potentially significant exceptions, particularly when
closing writable resources. With a writable resource, a failure thrown from close()
should be considered as significant as a failure thrown from a write method because it may
indicate a failure to flush bytes to the underlying resource.
Closes the given object quietly, ignoring any checked exceptions. Does
nothing if the given object is null
.
Parameters | |
---|---|
closeable |
AutoCloseable : This value may be null . |
copy
public static long copy (InputStream in, OutputStream out, CancellationSignal signal, Executor executor, FileUtils.ProgressListener listener)
Copy the contents of one stream to another.
Attempts to use several optimization strategies to copy the data in the kernel before falling back to a userspace copy as a last resort.
Parameters | |
---|---|
in |
InputStream : This value cannot be null . |
out |
OutputStream : This value cannot be null . |
signal |
CancellationSignal : to signal if the copy should be cancelled early.
This value may be null . |
executor |
Executor : that listener events should be delivered via.
This value may be null . |
listener |
FileUtils.ProgressListener : to be periodically notified as the copy progresses.
This value may be null . |
Returns | |
---|---|
long |
number of bytes copied. |
Throws | |
---|---|
IOException |
copy
public static long copy (FileDescriptor in, FileDescriptor out, CancellationSignal signal, Executor executor, FileUtils.ProgressListener listener)
Copy the contents of one FD to another.
Attempts to use several optimization strategies to copy the data in the kernel before falling back to a userspace copy as a last resort.
Parameters | |
---|---|
in |
FileDescriptor : This value cannot be null . |
out |
FileDescriptor : This value cannot be null . |
signal |
CancellationSignal : to signal if the copy should be cancelled early.
This value may be null . |
executor |
Executor : that listener events should be delivered via.
This value may be null . |
listener |
FileUtils.ProgressListener : to be periodically notified as the copy progresses.
This value may be null . |
Returns | |
---|---|
long |
number of bytes copied. |
Throws | |
---|---|
IOException |
copy
public static long copy (FileDescriptor in, FileDescriptor out)
Copy the contents of one FD to another.
Attempts to use several optimization strategies to copy the data in the kernel before falling back to a userspace copy as a last resort.
Parameters | |
---|---|
in |
FileDescriptor : This value cannot be null . |
out |
FileDescriptor : This value cannot be null . |
Returns | |
---|---|
long |
number of bytes copied. |
Throws | |
---|---|
IOException |
copy
public static long copy (InputStream in, OutputStream out)
Copy the contents of one stream to another.
Attempts to use several optimization strategies to copy the data in the kernel before falling back to a userspace copy as a last resort.
Parameters | |
---|---|
in |
InputStream : This value cannot be null . |
out |
OutputStream : This value cannot be null . |
Returns | |
---|---|
long |
number of bytes copied. |
Throws | |
---|---|
IOException |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
TMZ Celebrity News – Breaking Stories, Videos & Gossip
Looking for the latest TMZ celebrity news? You've come to the right place. From shocking Hollywood scandals to exclusive videos, TMZ delivers it all in real time.
Whether it’s a red carpet slip-up, a viral paparazzi moment, or a legal drama involving your favorite stars, TMZ news is always first to break the story. Stay in the loop with daily updates, insider tips, and jaw-dropping photos.
🎥 Watch TMZ Live
TMZ Live brings you daily celebrity news and interviews straight from the TMZ newsroom. Don’t miss a beat—watch now and see what’s trending in Hollywood.
- Exclusive TMZ interviews and court updates
- Viral celebrity videos and candid photos
- Trending gossip and entertainment news