FileUtils
class FileUtils
kotlin.Any | |
↳ | android.os.FileUtils |
Utility methods useful for working with files.
Summary
Nested classes | |
---|---|
abstract |
Listener that is called periodically as progress is made. |
Public methods | |
---|---|
static Unit |
closeQuietly(fd: FileDescriptor?) Closes the given object quietly, ignoring any checked exceptions. |
static Unit |
closeQuietly(closeable: AutoCloseable?) Closes the given object quietly, ignoring any checked exceptions. |
static Long |
copy(in: FileDescriptor, out: FileDescriptor) Copy the contents of one FD to another. |
static Long |
copy(in: FileDescriptor, out: FileDescriptor, signal: CancellationSignal?, executor: Executor?, listener: FileUtils.ProgressListener?) Copy the contents of one FD to another. |
static Long |
copy(in: InputStream, out: OutputStream) Copy the contents of one stream to another. |
static Long |
copy(in: InputStream, out: OutputStream, signal: CancellationSignal?, executor: Executor?, listener: FileUtils.ProgressListener?) Copy the contents of one stream to another. |
Public methods
closeQuietly
static funcloseQuietly(fd: FileDescriptor?): Unit
Deprecated: 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
static funcloseQuietly(closeable: AutoCloseable?): Unit
Deprecated: 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
static fun copy(
in: FileDescriptor,
out: FileDescriptor
): Long
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 . |
Return | |
---|---|
Long |
number of bytes copied. |
copy
static fun copy(
in: FileDescriptor,
out: FileDescriptor,
signal: CancellationSignal?,
executor: Executor?,
listener: FileUtils.ProgressListener?
): Long
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 | |
---|---|
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 . |
in |
FileDescriptor: This value cannot be null . |
out |
FileDescriptor: This value cannot be null . |
Return | |
---|---|
Long |
number of bytes copied. |
copy
static fun copy(
in: InputStream,
out: OutputStream
): Long
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 . |
Return | |
---|---|
Long |
number of bytes copied. |
copy
static fun copy(
in: InputStream,
out: OutputStream,
signal: CancellationSignal?,
executor: Executor?,
listener: FileUtils.ProgressListener?
): Long
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 | |
---|---|
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 . |
in |
InputStream: This value cannot be null . |
out |
OutputStream: This value cannot be null . |
Return | |
---|---|
Long |
number of bytes copied. |