back to index

Stream

Inheritance

Object -> Stream

Properties


byteOrder - readwrite, BIG_ENDIAN or LITTLE_ENDIAN
errorCode - 
object    - readwrite 
string    - readwrite 
offset    - readwrite
size      - read
i8        - read/write byte from/to stream
i16       - read/write word from/to stream
i32       - read/write dword from/to stream
f32       - read/write floating point number from/to stream
f64       - convert float<->double

Methods

       deserialize          (Object _o, int _btypeinfo)     - deserialize object from stream (optional typeinfo)
int    eof                  ()                              - test if end of file has been reached
int    getI8                ()                              - read next byte
int    getI16               ()                              - read next short, convert byteorder
int    getI32               ()                              - read next long, convert byteorder
float  getF32               ()                              - read next IEEE float
float  getF64               ()                              - read a 64bit floating point value ("double"), shrink to 32bit
int    getByteOrder         ()                              - return current byteorder (BIG_ENDIAN/LITTLE_ENDIAN)
String getErrorStringByCode (int _errorcode)                - convert error code to string
       getObject            (Object _o)                     - deserialize object (no typeinfo)
int    getSize              ()                              - return current stream size
       setOffset            (int _i)                        - set current read/write offset ("seek")
int    getOffset            ()                              - return current read/write offset
int    readBuffer           (Buffer _o, int _off, int _num , int _bresize) - read _num bytes from stream. 
int    readLine             (String _s, int _max)           - read _max chars from stream resp. until "newline" is reached.
int    readString           (String _s, int _len)           - read _len chars from stream resp. until ASCIIZ is reached.
       seek                 (int _off, int _mode)           - adjust read/write offset. _mode=SEEK_CUR, SEEK_BEG or SEEK_END
       serialize            (Object _o, int _btypeinfo)     - serialize object to stream. (optional typeinfo)
       setByteOrder         (int)                           - set stream byteorder (BIG_ENDIAN/LITTLE_ENDIAN)
       setI8                (int _i)                        - write byte
       setI16               (int _i)                        - write short, convert byteorder
       setI32               (int _i)                        - write long, convert byteorder
       setF32               (float _f)                      - write IEEE float
       setF64               (float _f)                      - write a 32bit floating point value ("double"), expand to 64bit
       setObject            (Object _o)                     - serialize object to stream (no typeinfo)
int    writeBuffer          (Buffer _o, int _off, int _num) - write _num bytes to stream
       writeString          (String _s, int _off, int _num) - write _num chars to stream

Example

testfileio.tks
3ds.tks

back to index