Android Guides | Samples

Java.IO.OutputStream Class

A writable sink for bytes.

See Also: OutputStream

Syntax

[Android.Runtime.Register("java/io/OutputStream", DoNotGenerateAcw=true)]
public abstract class OutputStream : Object, ICloseable, IFlushable, IDisposable

Remarks

A writable sink for bytes.

Most clients will use output streams that write data to the file system (FileOutputStream), the network (Socket.OutputStream/URLConnection.OutputStream), or to an in-memory byte array (ByteArrayOutputStream).

Use OutputStreamWriter to adapt a byte stream like this one into a character stream.

Most clients should wrap their output stream with BufferedOutputStream. Callers that do only bulk writes may omit buffering.

Subclassing OutputStream

Subclasses that decorate another output stream should consider subclassing FilterOutputStream, which delegates all calls to the target output stream.

All output stream subclasses should override bothOutputStream.Write(Int32) and OutputStream.Write(Byte[],Int32,Int32). The three argument overload is necessary for bulk access to the data. This is much more efficient than byte-by-byte access.

See Also

[Android Documentation]

Requirements

Namespace: Java.IO
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Java.IO.OutputStream are listed below.

See Also: Object

Public Constructors

Default constructor.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

Close()
Closes this stream.
Flush()
Flushes this stream.
Write(Byte[])
Equivalent to write(buffer, 0, buffer.length).
abstract
Write(Int32)
Writes a single byte to this stream.
Write(Byte[], Int32, Int32)
Writes count bytes from the byte array buffer starting at position offset to this stream.
WriteAsync(Byte[]) : Task
WriteAsync(Int32) : Task
WriteAsync(Byte[], Int32, Int32) : Task