Class OutputStream
Object
A stream of binary or character data which can be written to. The various write
methods output
binary data, whereas print
outputs text. This means that out.write(65)
will write an "A"
(which has numeric value 65) to the stream, while out.print(65)
will print the two characters
"6"
and "5"
.
- Source Code:
- View Source
Field Summary
byteOrder :ByteOrder - Determines the endianness of the data in this stream when writing multi-byte values.
lineEnding :String - The string used to terminate lines written by the various
printLine
methods.
Instance Method Summary
write (value :
):UInt8 Error? - Writes a single byte.
write (value :
):UInt16 Error? - Writes the two bytes comprising a
UInt16
. write (value :
):UInt32 Error? - Writes the four bytes comprising a
UInt32
. write (value :
):UInt64 Error? - Writes the eight bytes comprising a
UInt64
. write (value :
):Int8 Error? - Writes a single byte.
write (value :
):Int16 Error? - Writes the two bytes comprising an
Int16
. write (value :
):Int32 Error? - Writes the four bytes comprising an
Int32
. write (value :
):Int64 Error? - Writes the eight bytes comprising an
Int64
. write (ptr :
,Pointer<UInt8> count :
):Int Error? - Writes a block of data to this stream.
write (ptr :
,Pointer<Int8> count :
):Int Error? - Writes a block of data to this stream.
write (ptr :
,Pointer<Char8> count :
):Int Error? - Writes a block of data to this stream.
write (a :
,Array<UInt8> count :
):Int Error? - Writes a portion of an array of bytes to this stream.
write (a :
,Array<Int8> count :
):Int Error? - Writes a portion of an array of bytes to this stream.
write (a :
,Array<Char8> count :
):Int Error? - Writes a portion of an array of bytes to this stream.
write (value :
):Char8 Error? - Writes a single byte.
print (s :
):String Error? - Prints a string to the stream.
print (o :
):Object Error? - Prints the string represention of an object (as given by toString) to the stream.
printLine (s :
):String Error? - Prints a string to the stream.
printLine (o :
):Object Error? - Prints the string represention of an object (as given by toString) to the stream, followed by a line ending.
printLine ():Error? - Prints a line ending.
flush ():Error? - Flushes any buffers associated with this stream.
close ():Error? - Closes this
OutputStream
.
Fields
Determines the endianness of the data in this stream when writing multi-byte values. Defaults to
LITTLE_ENDIAN
, but may be freely changed.
The string used to terminate lines written by the various printLine
methods. Defaults to the
correct line ending sequence for the current platform.
Instance Methods
Writes a single byte.
- Parameters:
-
-value the value to write
Writes the two bytes comprising a UInt16
. The byte order is controlled by the byteOrder
field.
- Parameters:
-
-value the value to write
Writes the four bytes comprising a UInt32
. The byte order is controlled by the byteOrder
field.
- Parameters:
-
-value the value to write
Writes the eight bytes comprising a UInt64
. The byte order is controlled by the byteOrder
field.
- Parameters:
-
-value the value to write
Writes the two bytes comprising an Int16
. The byte order is controlled by the byteOrder
field.
- Parameters:
-
-value the value to write
Writes the four bytes comprising an Int32
. The byte order is controlled by the byteOrder
field.
- Parameters:
-
-value the value to write
Writes the eight bytes comprising an Int64
. The byte order is controlled by the byteOrder
field.
- Parameters:
-
-value the value to write
@extendable
method write
(ptr :Pointer<UInt8>
,
count :Int
):Error?
Writes a block of data to this stream.
- Parameters:
-
-ptr Pointer to the data to write
-count number of bytes to write
method write
(ptr :Pointer<Int8>
,
count :Int
):Error?
Writes a block of data to this stream.
- Parameters:
-
-ptr Pointer to the data to write
-count number of bytes to write
method write
(ptr :Pointer<Char8>
,
count :Int
):Error?
Writes a block of data to this stream.
- Parameters:
-
-ptr Pointer to the data to write
-count number of bytes to write
method write
(a :Array<UInt8>
,
count :Int
):Error?
Writes a portion of an array of bytes to this stream. The write begins at index 0
and the last
byte written is at index count - 1
.
- Parameters:
-
-a the array to write
-count number of bytes to write
method write
(a :Array<Int8>
,
count :Int
):Error?
Writes a portion of an array of bytes to this stream. The write begins at index 0
and the last
byte written is at index count - 1
.
- Parameters:
-
-a the array to write
-count number of bytes to write
method write
(a :Array<Char8>
,
count :Int
):Error?
Writes a portion of an array of bytes to this stream. The write begins at index 0
and the last
byte written is at index count - 1
.
- Parameters:
-
-a the array to write
-count number of bytes to write
Prints the string represention of an object (as given by toString) to the stream.
- Parameters:
-
-o the object to write
Prints a string to the stream., followed by a line ending.
- Parameters:
-
-s the string to write
Prints the string represention of an object (as given by toString) to the stream, followed by a line ending.
- Parameters:
-
-o the object to write
method printLine
():Error?
Prints a line ending.
@extendable
method flush
():Error?
Flushes any buffers associated with this stream. OutputStream
does not itself perform any
buffering, so the base implementation of this method does nothing, but subclasses which buffer
their output should override this.
@extendable
method close
():Error?
Closes this OutputStream
. The default implementation does nothing.