up: IO     index Zimbu documentation

CLASS IO.ByteWriter EXTENDS IO.Writer @public

summary

     

A Writer that stores a sequence of bytes. Call toByteString() to get the result.

 
Implements IO.I_ByteWriter
 
$write(text) status @public  Writes text and returns OK.
$write(text) status @public  Writes text and returns OK.
$writeByte(byte) status @public  Appends one byte byte and returns OK.
$Size() int @public  Returns the current byte length.
$toByteString() byteString @public  Returns the current byteString.
$remove() int @public  Takes one byte from the end of the byteString and returns it.
$truncate() @public  Clear the contents of the writer, reset it to empty, keeping the buffer.
 
Inherited from IO.Writer:
$write(number) status @public  Writes number as a decimal number.
$write(number) status @public  Writes number as a decimal number.
$write(number) status @public  Writes number as a decimal number.
$write(flag) status @public  Writes flag as "TRUE" or "FALSE".
$write(ok) status @public  Writes ok as "FAIL" or "OK".
$write(arg) status @public  Writes arg depending on its actual type. Returns FAIL or OK.
$writeChar(char) status @public  Writes char as a UTF-8 byte sequence.
$print(text) status @public  Writes text and appends a newline. Returns FAIL or OK.
$print(number) status @public  Writes number and appends a newline. Returns FAIL or OK.
$print(number) status @public  Writes number and appends a newline. Returns FAIL or OK.
$print(number) status @public  Writes number and appends a newline. Returns FAIL or OK.
$print(flag) status @public  Writes flag as "TRUE" or "FALSE" and appends a newline. Returns FAIL or OK.
$print(ok) status @public  Writes ok as "FAIL" or "OK" and appends a newline. Returns FAIL or OK.
$print(arg) status @public  Writes arg depending on its actual type and appends a newline. Returns FAIL or OK.
$print() status @public  Writes a newline and returns FAIL or OK.
$format(fmt, arguments) status @public  Formats the string and writes it with a newline appended.
 

members (alphabetically)

     

FUNC $Size() int @public

     

Returns the current byte length.

FUNC $remove() int @public

     

Takes one byte from the end of the byteString and returns it.

If the string is empty returns IO.eof.

FUNC $toByteString() byteString @public

     

Returns the current byteString.

Writing may continue after this.

PROC $truncate() @public

     

Clear the contents of the writer, reset it to empty, keeping the buffer.

The buffer will remain being allocated, memory will not be freed.

FUNC $write(string text) status @public

     

Writes text and returns OK.

FUNC $write(byteString text) status @replace @public

     

Writes text and returns OK.

FUNC $writeByte(int byte) status @replace @public

     

Appends one byte byte and returns OK.

Only the lower 8 bits of byte are used, the rest is ignored.

license

      Copyright 2009 Bram Moolenaar All Rights Reserved.

      Licensed under the Apache License, Version 2.0. See the LICENSE file or obtain a copy at: http://www.apache.org/licenses/LICENSE-2.0