Stay organized with collections
Save and categorize content based on your preferences.
AutoCloseOutputStream
open class AutoCloseOutputStream : ParcelFileDescriptor.AutoCloseOutputStream
An OutputStream you can create on a ParcelFileDescriptor, which will take care of calling android.os.ParcelFileDescriptor#close for you when the stream is closed.
Summary
Inherited functions |
|
From class FileOutputStream
Unit |
finalize()
Cleans up the connection to the file, and ensures that the close method of this file output stream is called when there are no more references to this stream.
|
FileChannel! |
getChannel()
Returns the unique FileChannel object associated with this file output stream.
The initial position of the returned channel will be equal to the number of bytes written to the file so far unless this stream is in append mode, in which case it will be equal to the size of the file. Writing bytes to this stream will increment the channel's position accordingly. Changing the channel's position, either explicitly or by writing, will change this stream's file position.
|
FileDescriptor! |
getFD()
Returns the file descriptor associated with this stream.
|
Unit |
write(b: ByteArray!)
Writes b.length bytes from the specified byte array to this file output stream.
|
Unit |
write(b: ByteArray!, off: Int, len: Int)
Writes len bytes from the specified byte array starting at offset off to this file output stream.
|
Unit |
write(b: Int)
Writes the specified byte to this file output stream. Implements the write method of OutputStream .
|
|
From class OutputStream
Unit |
flush()
Flushes this output stream and forces any buffered output bytes to be written out. The general contract of flush is that calling it is an indication that, if any bytes previously written have been buffered by the implementation of the output stream, such bytes should immediately be written to their intended destination.
If the intended destination of this stream is an abstraction provided by the underlying operating system, for example a file, then flushing the stream guarantees only that bytes previously written to the stream are passed to the operating system for writing; it does not guarantee that they are actually written to a physical device such as a disk drive.
The flush method of OutputStream does nothing.
|
OutputStream! |
nullOutputStream()
Returns a new OutputStream which discards all bytes. The returned stream is initially open. The stream is closed by calling the close() method. Subsequent calls to close() have no effect.
While the stream is open, the write(int) , write(byte[]) , and write(byte[], int, int) methods do nothing. After the stream has been closed, these methods all throw IOException .
The flush() method does nothing.
|
|
Public constructors
Public methods
write
open fun write(buffer: ByteArray!): Unit
Exceptions |
java.io.IOException |
if an I/O error occurs. |
write
open fun write(
buffer: ByteArray!,
offset: Int,
count: Int
): Unit
Parameters |
b |
the data. |
off |
the start offset in the data. |
len |
the number of bytes to write. |
Exceptions |
java.io.IOException |
if an I/O error occurs. |
write
open fun write(oneByte: Int): Unit
Parameters |
b |
the byte to be written. |
Exceptions |
java.io.IOException |
if an I/O error occurs. |
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 2024-12-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-18 UTC."],[],[]]