|
Drag[en]gine Script Module DragonScript 1.35
|
Public Member Functions | |
Management | |
| String | getFilename () |
| File name. | |
| int | getLength () |
| File size in bytes. | |
| int | getPosition () |
| Current reading position in bytes from the beginning of the file. | |
| void | setPosition (int position) |
| Set reading file position in bytes relative to beginning of file. | |
| void | movePosition (int offset) |
| Move reading file position by offset in bytes. | |
| void | setPositionEnd (int position) |
| Set reading file position in bytes relative to end of file. | |
| int | getStreamVersion () |
| Stream version used by readFromFile of native classes. | |
| void | setStreamVersion (int version) |
| Set stream version used by readFromFile of native classes. | |
| bool | eof () |
| File reading pointer is at the end of file. | |
| int | readChar () |
| Read one byte (1 byte) and advance the file reading position. | |
| int | readByte () |
| Read one unsigned byte (1 byte) and advance the file reading position. | |
| int | readShort () |
| Read one short (2 bytes) and advance the file reading position. | |
| int | readUShort () |
| Read one unsigned short (2 bytes) and advance the file reading position. | |
| int | readInt () |
| Read one int (4 bytes) and advance the file reading position. | |
| int | readUInt () |
| Read one unsigned int (4 bytes) and advance the file reading position. | |
| int | readVarUInt () |
| Read variable length unsigned integer (1-4 bytes) and advances file pointer. | |
| float | readFloat () |
| Read one float (4 bytes) and advance the file reading position. | |
| String | readString8 () |
| Read string prefixed by a 1-byte length field and advance the file reading position. | |
| String | readString16 () |
| Read string prefixed by a 2-byte length field and advance the file reading position. | |
| String | readString32 () |
| Read string prefixed by a 4-byte length field and advance the file reading position. | |
| String | readVarString () |
| Read string prefixed by a 1-4 byte length field and advance the file reading position. | |
| String | readString (int size) |
| Read string without length field and advance the file reading position. | |
| void | skipString8 () |
| Skips string prefixed by a 1-byte length field and advance the file reading position. | |
| void | skipString16 () |
| Skips string prefixed by a 2-byte length field and advance the file reading position. | |
| void | skipString32 () |
| Skips string prefixed by a 4-byte length field and advance the file reading position. | |
| void | skipVarString () |
| Skips string prefixed by a 1-4 byte length field and advance the file reading position. | |
| TimeDate | readTimeDate () |
| Read TimeDate instance. | |
Constructors | |
| FileReader | new (String filename) |
| Create file reader reading from virtual file system file. | |
| static FileReader | newZCompressed (String filename) |
| Create Z-Decompressing file reader reading from virtual file system file. | |
File reader.
This is a native class.
| bool Dragengine.FileReader.eof | ( | ) |
| String Dragengine.FileReader.getFilename | ( | ) |
File name.
Referenced by getLength().
| int Dragengine.FileReader.getLength | ( | ) |
| int Dragengine.FileReader.getPosition | ( | ) |
Current reading position in bytes from the beginning of the file.
References getLength().
Referenced by movePosition().
| int Dragengine.FileReader.getStreamVersion | ( | ) |
Stream version used by readFromFile of native classes.
References movePosition().
Referenced by readChar().
| void Dragengine.FileReader.movePosition | ( | int | offset | ) |
Move reading file position by offset in bytes.
References getPosition().
Referenced by getStreamVersion().
| FileReader Dragengine.FileReader.new | ( | String | filename | ) |
|
static |
Create Z-Decompressing file reader reading from virtual file system file.
References newZCompressed().
Referenced by newZCompressed().
| int Dragengine.FileReader.readByte | ( | ) |
Read one unsigned byte (1 byte) and advance the file reading position.
Referenced by readUInt().
| int Dragengine.FileReader.readChar | ( | ) |
Read one byte (1 byte) and advance the file reading position.
References getStreamVersion().
Referenced by readUInt().
| float Dragengine.FileReader.readFloat | ( | ) |
Read one float (4 bytes) and advance the file reading position.
References readUShort().
Referenced by skipString16().
| int Dragengine.FileReader.readInt | ( | ) |
Read one int (4 bytes) and advance the file reading position.
References eof().
Referenced by readString8().
| int Dragengine.FileReader.readShort | ( | ) |
Read one short (2 bytes) and advance the file reading position.
References setStreamVersion().
Referenced by readUInt().
| String Dragengine.FileReader.readString | ( | int | size | ) |
Read string without length field and advance the file reading position.
Referenced by readTimeDate().
| String Dragengine.FileReader.readString16 | ( | ) |
Read string prefixed by a 2-byte length field and advance the file reading position.
References readUInt().
Referenced by skipVarString().
| String Dragengine.FileReader.readString32 | ( | ) |
Read string prefixed by a 4-byte length field and advance the file reading position.
Referenced by readTimeDate().
| String Dragengine.FileReader.readString8 | ( | ) |
Read string prefixed by a 1-byte length field and advance the file reading position.
References readInt().
Referenced by skipString32().
| TimeDate Dragengine.FileReader.readTimeDate | ( | ) |
Read TimeDate instance.
References readString(), readString32(), readTimeDate(), readVarString(), skipString16(), skipString32(), skipString8(), and skipVarString().
Referenced by readTimeDate().
| int Dragengine.FileReader.readUInt | ( | ) |
Read one unsigned int (4 bytes) and advance the file reading position.
References readByte(), readChar(), and readShort().
Referenced by readString16().
| int Dragengine.FileReader.readUShort | ( | ) |
Read one unsigned short (2 bytes) and advance the file reading position.
Referenced by readFloat().
| String Dragengine.FileReader.readVarString | ( | ) |
Read string prefixed by a 1-4 byte length field and advance the file reading position.
Referenced by readTimeDate().
| int Dragengine.FileReader.readVarUInt | ( | ) |
Read variable length unsigned integer (1-4 bytes) and advances file pointer.
Variable length integers are written using 1 to 4 bytes. The highest 2 bits of the first byte stores the total length (0=1 byte, 1=2 bytes, 2=3 bytes, 3=4 bytes). The lower 6 bits are used as value. With each added byte the previous bits are shifted up. The maximum storable value is thus 1073741823.
Variable length unsigned integers are typically used for values like versions or revisions which start low and potentially grow large over time.
Referenced by skipString8().
| void Dragengine.FileReader.setPosition | ( | int | position | ) |
Set reading file position in bytes relative to beginning of file.
Referenced by setPositionEnd().
| void Dragengine.FileReader.setPositionEnd | ( | int | position | ) |
Set reading file position in bytes relative to end of file.
References setPosition().
Referenced by setStreamVersion().
| void Dragengine.FileReader.setStreamVersion | ( | int | version | ) |
Set stream version used by readFromFile of native classes.
References setPositionEnd().
Referenced by readShort().
| void Dragengine.FileReader.skipString16 | ( | ) |
Skips string prefixed by a 2-byte length field and advance the file reading position.
References readFloat().
Referenced by readTimeDate().
| void Dragengine.FileReader.skipString32 | ( | ) |
Skips string prefixed by a 4-byte length field and advance the file reading position.
References readString8().
Referenced by readTimeDate().
| void Dragengine.FileReader.skipString8 | ( | ) |
Skips string prefixed by a 1-byte length field and advance the file reading position.
References readVarUInt().
Referenced by readTimeDate().
| void Dragengine.FileReader.skipVarString | ( | ) |
Skips string prefixed by a 1-4 byte length field and advance the file reading position.
References readString16().
Referenced by readTimeDate().