Drag[en]gine Script Module DragonScript
1.23
|
Public Member Functions | |
Management | |
String | getFilename () |
File name. More... | |
int | getLength () |
File size in bytes. More... | |
int | getPosition () |
Current reading position in bytes from the beginning of the file. More... | |
void | setPosition (int position) |
Set reading file position in bytes relative to beginning of file. More... | |
void | movePosition (int offset) |
Move reading file position by offset in bytes. More... | |
void | setPositionEnd (int position) |
Set reading file position in bytes relative to end of file. More... | |
int | getStreamVersion () |
Stream version used by readFromFile of native classes. More... | |
void | setStreamVersion (int version) |
Set stream version used by readFromFile of native classes. More... | |
bool | eof () |
File reading pointer is at the end of file. More... | |
int | readChar () |
Read one byte (1 byte) and advance the file reading position. More... | |
int | readByte () |
Read one unsigned byte (1 byte) and advance the file reading position. More... | |
int | readShort () |
Read one short (2 bytes) and advance the file reading position. More... | |
int | readUShort () |
Read one unsigned short (2 bytes) and advance the file reading position. More... | |
int | readInt () |
Read one int (4 bytes) and advance the file reading position. More... | |
int | readUInt () |
Read one unsigned int (4 bytes) and advance the file reading position. More... | |
int | readVarUInt () |
Read variable length unsigned integer (1-4 bytes) and advances file pointer. More... | |
float | readFloat () |
Read one float (4 bytes) and advance the file reading position. More... | |
String | readString8 () |
Read string prefixed by a 1-byte length field and advance the file reading position. More... | |
String | readString16 () |
Read string prefixed by a 2-byte length field and advance the file reading position. More... | |
String | readString32 () |
Read string prefixed by a 4-byte length field and advance the file reading position. More... | |
String | readVarString () |
Read string prefixed by a 1-4 byte length field and advance the file reading position. More... | |
String | readString (int size) |
Read string without length field and advance the file reading position. More... | |
void | skipString8 () |
Skips string prefixed by a 1-byte length field and advance the file reading position. More... | |
void | skipString16 () |
Skips string prefixed by a 2-byte length field and advance the file reading position. More... | |
void | skipString32 () |
Skips string prefixed by a 4-byte length field and advance the file reading position. More... | |
void | skipVarString () |
Skips string prefixed by a 1-4 byte length field and advance the file reading position. More... | |
TimeDate | readTimeDate () |
Read TimeDate instance. More... | |
Constructors | |
FileReader | new (String filename) |
Create file reader reading from virtual file system file. More... | |
static FileReader | newZCompressed (String filename) |
Create Z-Decompressing file reader reading from virtual file system file. More... | |
File reader.
This is a native class.
bool Dragengine.FileReader.eof | ( | ) |
File reading pointer is at the end of file.
String Dragengine.FileReader.getFilename | ( | ) |
File name.
int Dragengine.FileReader.getLength | ( | ) |
File size in bytes.
int Dragengine.FileReader.getPosition | ( | ) |
Current reading position in bytes from the beginning of the file.
int Dragengine.FileReader.getStreamVersion | ( | ) |
Stream version used by readFromFile of native classes.
void Dragengine.FileReader.movePosition | ( | int | offset | ) |
Move reading file position by offset in bytes.
FileReader Dragengine.FileReader.new | ( | String | filename | ) |
Create file reader reading from virtual file system file.
|
static |
Create Z-Decompressing file reader reading from virtual file system file.
int Dragengine.FileReader.readByte | ( | ) |
Read one unsigned byte (1 byte) and advance the file reading position.
int Dragengine.FileReader.readChar | ( | ) |
Read one byte (1 byte) and advance the file reading position.
float Dragengine.FileReader.readFloat | ( | ) |
Read one float (4 bytes) and advance the file reading position.
int Dragengine.FileReader.readInt | ( | ) |
Read one int (4 bytes) and advance the file reading position.
int Dragengine.FileReader.readShort | ( | ) |
Read one short (2 bytes) and advance the file reading position.
String Dragengine.FileReader.readString | ( | int | size | ) |
Read string without length field and advance the file reading position.
String Dragengine.FileReader.readString16 | ( | ) |
Read string prefixed by a 2-byte length field and advance the file reading position.
String Dragengine.FileReader.readString32 | ( | ) |
Read string prefixed by a 4-byte length field and advance the file reading position.
String Dragengine.FileReader.readString8 | ( | ) |
Read string prefixed by a 1-byte length field and advance the file reading position.
TimeDate Dragengine.FileReader.readTimeDate | ( | ) |
Read TimeDate instance.
int Dragengine.FileReader.readUInt | ( | ) |
Read one unsigned int (4 bytes) and advance the file reading position.
int Dragengine.FileReader.readUShort | ( | ) |
Read one unsigned short (2 bytes) and advance the file reading position.
String Dragengine.FileReader.readVarString | ( | ) |
Read string prefixed by a 1-4 byte length field and advance the file reading position.
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.
void Dragengine.FileReader.setPosition | ( | int | position | ) |
Set reading file position in bytes relative to beginning of file.
void Dragengine.FileReader.setPositionEnd | ( | int | position | ) |
Set reading file position in bytes relative to end of file.
void Dragengine.FileReader.setStreamVersion | ( | int | version | ) |
Set stream version used by readFromFile of native classes.
void Dragengine.FileReader.skipString16 | ( | ) |
Skips string prefixed by a 2-byte length field and advance the file reading position.
void Dragengine.FileReader.skipString32 | ( | ) |
Skips string prefixed by a 4-byte length field and advance the file reading position.
void Dragengine.FileReader.skipString8 | ( | ) |
Skips string prefixed by a 1-byte length field and advance the file reading position.
void Dragengine.FileReader.skipVarString | ( | ) |
Skips string prefixed by a 1-4 byte length field and advance the file reading position.