Udostępnij za pośrednictwem


OutputStream.Write Method

Definition

Overloads

Write(Byte[])

Writes b.length bytes from the specified byte array to this output stream.

Write(Int32)

Writes the specified byte to this output stream.

Write(Byte[], Int32, Int32)

Writes len bytes from the specified byte array starting at offset off to this output stream.

Write(Byte[])

Writes b.length bytes from the specified byte array to this output stream.

[Android.Runtime.Register("write", "([B)V", "GetWrite_arrayBHandler")]
public virtual void Write (byte[]? b);
[<Android.Runtime.Register("write", "([B)V", "GetWrite_arrayBHandler")>]
abstract member Write : byte[] -> unit
override this.Write : byte[] -> unit

Parameters

b
Byte[]

the data.

Attributes

Exceptions

Remarks

Writes b.length bytes from the specified byte array to this output stream. The general contract for write(b) is that it should have exactly the same effect as the call write(b, 0, b.length).

Java documentation for java.io.OutputStream.write(byte[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Write(Int32)

Writes the specified byte to this output stream.

[Android.Runtime.Register("write", "(I)V", "GetWrite_IHandler")]
public abstract void Write (int b);
[<Android.Runtime.Register("write", "(I)V", "GetWrite_IHandler")>]
abstract member Write : int -> unit

Parameters

b
Int32

the byte.

Attributes

Exceptions

if an error occurs while writing to this stream.

Remarks

Writes the specified byte to this output stream. The general contract for write is that one byte is written to the output stream. The byte to be written is the eight low-order bits of the argument b. The 24 high-order bits of b are ignored.

Subclasses of OutputStream must provide an implementation for this method.

Java documentation for java.io.OutputStream.write(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

Write(Byte[], Int32, Int32)

Writes len bytes from the specified byte array starting at offset off to this output stream.

[Android.Runtime.Register("write", "([BII)V", "GetWrite_arrayBIIHandler")]
public virtual void Write (byte[]? b, int off, int len);
[<Android.Runtime.Register("write", "([BII)V", "GetWrite_arrayBIIHandler")>]
abstract member Write : byte[] * int * int -> unit
override this.Write : byte[] * int * int -> unit

Parameters

b
Byte[]

the data.

off
Int32

the start offset in the data.

len
Int32

the number of bytes to write.

Attributes

Exceptions

if an error occurs while writing to this stream.

if offset or count , or if offset + count is bigger than the length of buffer.

Remarks

Writes len bytes from the specified byte array starting at offset off to this output stream. The general contract for write(b, off, len) is that some of the bytes in the array b are written to the output stream in order; element b[off] is the first byte written and b[off+len-1] is the last byte written by this operation.

The write method of OutputStream calls the write method of one argument on each of the bytes to be written out. Subclasses are encouraged to override this method and provide a more efficient implementation.

If b is null, a NullPointerException is thrown.

If off is negative, or len is negative, or off+len is greater than the length of the array b, then an IndexOutOfBoundsException is thrown.

Java documentation for java.io.OutputStream.write(byte[], int, int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to