Script: Class dw.io.Writer

Class Writer

The class supports writing characters to a stream.

Note: when this class is used with sensitive data, be careful in persisting sensitive information to disk.

All Known Subclasses

FileWriter, PrintWriter, StringWriter

Constructor Summary

Writer(stream : OutputStream)

Create a writer from a stream using UTF-8 character encoding.

Writer(stream : OutputStream, encoding : String)

Create a writer from a stream using the specified character encoding.

Method Summary

close() : void

Closes the writer.

flush() : void

Flushes the buffer.

write(str : String) : void

Write the given string to the stream.

write(str : String, off : Number, len : Number) : void

Write the given string to the stream.

Methods inherited from class Object

assign, create, create, defineProperties, defineProperty, entries, freeze, fromEntries, getOwnPropertyDescriptor, getOwnPropertyNames, getOwnPropertySymbols, getPrototypeOf, hasOwnProperty, is, isExtensible, isFrozen, isPrototypeOf, isSealed, keys, preventExtensions, propertyIsEnumerable, seal, setPrototypeOf, toLocaleString, toString, valueOf, values

Constructor Detail

Writer

publicWriter(stream : OutputStream)

Create a writer from a stream using UTF-8 character encoding.

Parameters:

stream - the output stream to use when creating the writer.


Writer

publicWriter(stream : OutputStream, encoding : String)

Create a writer from a stream using the specified character encoding.

Parameters:

stream - the output stream to use when creating the writer.

encoding - the encoding to use when creating the writer.


Method Detail

close

close() : void

Closes the writer.

flush

flush() : void

Flushes the buffer.


write

write(str : String) : void

Write the given string to the stream.

Parameters:

str - the string to write to the stream.


write

write(str : String, off : Number, len : Number) : void

Write the given string to the stream.

Parameters:

str - the string to write to the stream.

off - the offset from which to start writing characters to the stream.

len - the number of characters to write from the stream.