Close the output stream. This method is guaranteed to never throw an IOErr. Return true if the stream was closed successfully or false if the stream was closed abnormally. Default implementation does nothing and returns true.
Return a negative integer, zero, or a positive integer if this object is less than, equal to, or greater than the specified object:
this < that => <0
this == that => 0
this > that => >0
This method may also be accessed via the <
<=
<=>
>=
and >
shortcut operators. If not overridden the default
implementation compares the toStr
representations. Also see docLang.
Examples:
3.compare(8) => -1
8.compare(3) => 1
8.compare(8) => 0
3 <=> 8 => -1 // shortcut for 3.compare(8)
Byte order mode for binary writes. Default is Endian.big (network byte order).
Byte order mode for binary writes. Default is Endian.big (network byte order).
Compare this object to the specified for equality. This
method may be accessed via the == and != shortcut operators.
If not overridden the default implementation compares for
reference equality using the === operator. If this method
is overridden, then hash() must also be overridden such that
any two objects which return true for equals() must return
the same value for hash(). This method must accept null
and
return false.
Flush the stream so any buffered bytes are written out. Default implementation does nothing. Throw IOErr on error. Return this.
Return a unique hashcode for this object. If a class overrides hash() then it must ensure if equals() returns true for any two objects then they have same hash code.
Convenience for writeChars(obj.toStr)
. If obj is null, then
print the string "null". Return this.
Convenience for writeChars(obj.toStr + "\n")
. If obj is
null then print the string "null\n". Return this.
Optional
obj: JsObjIf this output stream is mapped to a file device, then synchronize all memory buffers to the physical storage device. Throw IOErr on error. Return this.
Get an immutable representation of this instance or throw NotImmutableErr if this object cannot be represented as an immutable:
Return a string representation of this object.
Trap a dynamic call for handling. Dynamic calls are invoked with the -> shortcut operator:
a->x a.trap("x", null)
a->x() a.trap("x", null)
a->x = b a.trap("x", [b])
a->x(b) a.trap("x", [b])
a->x(b, c) a.trap("x", [b, c])
The default implementation provided by Obj attempts to use reflection. If name maps to a method, it is invoked with the specified arguments. If name maps to a field and args.size is zero, get the field. If name maps to a field and args.size is one, set the field and return args[0]. Otherwise throw UnknownSlotErr.
This method called whenever an it-block is applied to an
object. The default implementation calls the function with this
,
and then returns this
.
Write a byte to the output stream. Throw IOErr on error. Return this.
Write between 0 and 64 bits of the given integer value. Bits which are only a partial byte are bufferred in RAM until flush.
Write one byte, one if true or zero if false. This method is paired with InStream.readBool. Throw IOErr on error. Return this.
Write n bytes from the specified Buf at its current position to this output stream. If n is defaulted to buf.remaining(), then everything left in the buffer is drained to this output stream. The buf's position is advanced n bytes upon return. Throw IOErr on error. Return this.
Optional
n: numberWrite one or more bytes to the stream for the specified Unicode character based on the current charset encoding. Return this.
Write the Unicode characters in the specified string to the stream using the current charset encoding. The off arg specifies the index offset to start writing characters and len the number of characters in str to write. Return this.
Optional
off: numberOptional
len: numberWrite four bytes as a 32-bit floating point number using configured endian order according to Float.bits32. This is paired with InStream.readF4. Throw IOErr on error. Return this.
Write eight bytes as a 64-bit floating point number using configured endian order according to Float.bits. This is paired with InStream.readF8. Throw IOErr on error. Return this.
Write two bytes as a 16-bit number using configured endian. This method may be paired with InStream.readU2 or InStream.readS2. Throw IOErr on error. Return this.
Write four bytes as a 32-bit number using configured endian. This method may be paired with InStream.readU4 or InStream.readS4. Throw IOErr on error. Return this.
Write eight bytes as a 64-bit number using configured endian. This is paired with InStream.readS8. Throw IOErr on error. Return this.
Write a serialized object from the stream according to the Fantom serialization format. Throw IOErr on error. Return this.
The options may be used to specify the format of the output:
equals
method. Default is false.Write the given map of Str name/value pairs to the output stream according to the Fantom props file format (see InStream.readProps for full specification). The props are written using UTF-8 regardless of this stream's current charset. If close argument is true, then automatically close the stream. Return this.
Optional
close: booleanWrite a Str in modified UTF-8 format according to the java.io.DataOutput
specification. This method is paired with InStream.readUtf.
Throw IOErr on error. Return this.
Write a string to this output stream using XML escape
sequences. By default only the < > &
characters are escaped.
You can use the following flags to escape additional
characters:
\n
and \r
charactersAny control character less than 0x20 which is not \t
, \n
or \r
is always escaped with a numeric reference. Return this.
Optional
mode: numberStatic
echoWrite x.toStr
to standard output followed by newline. If x
is null then print "null". If no argument is provided then
print an empty line.
Optional
x: JsObjStatic
xmlXML escape newline characters. See writeXml.
Static
xmlXML escape single and double quotes. See writeXml.
Static
xmlXML escape any character greater then 0x7f. See writeXml.
OutStream is used to write binary and text data to an output stream.