Drag[en]gine Script Module DragonScript
1.23
|
Public Member Functions | |
Management | |
String | getFilename () |
File name. More... | |
int | getStreamVersion () |
Stream version used by writeToFile of native classes. More... | |
void | setStreamVersion (int version) |
Set stream version used by writeToFile of native classes. More... | |
int | getPosition () |
Current writing position in the file. More... | |
void | setPosition (int position) |
Set file position for the next write action. More... | |
void | movePosition (int offset) |
Move file position by the given offset. More... | |
void | setPositionEnd (int position) |
void | writeChar (int value) |
Write one byte (1 byte). More... | |
void | writeByte (int value) |
Write one unsigned byte (1 byte). More... | |
void | writeShort (int value) |
Write one short (2 bytes). More... | |
void | writeUShort (int value) |
Write one unsigned short (2 bytes). More... | |
void | writeInt (int value) |
Write one int (4 bytes). More... | |
void | writeUInt (int value) |
Write one unsigned int (4 bytes). More... | |
void | writeVarUInt (int value) |
Write variable length unsigned integer (1-4 bytes) and advances file pointer. More... | |
void | writeFloat (float value) |
Write one float (4 bytes). More... | |
void | writeString8 (String string) |
Write a string prefixed by a 1-byte length field. More... | |
void | writeString16 (String string) |
Write a string prefixed by a 2-byte length field. More... | |
void | writeString32 (String string) |
Write a string prefixed by a 4-byte length field. More... | |
void | writeVarString (String string) |
Write a string prefixed by a 1-4 byte length field. More... | |
void | writeString (String data) |
Write string without length field. More... | |
void | writeData (FileReader reader) |
Write data from file reader. More... | |
void | writeData (FileReader reader, int size) |
Write data from file reader. More... | |
void | writeTimeDate (TimeDate timeDate) |
Write TimeDate instance. More... | |
Constructors | |
FileWriter | new (String filename) |
Create file writer writing to virtual file system file. More... | |
static FileWriter | newZCompressed (String filename) |
Create Z-Compressing file writer writing to virtual file system file. More... | |
File writer.
This is a native class.
String Dragengine.FileWriter.getFilename | ( | ) |
File name.
int Dragengine.FileWriter.getPosition | ( | ) |
Current writing position in the file.
int Dragengine.FileWriter.getStreamVersion | ( | ) |
Stream version used by writeToFile of native classes.
void Dragengine.FileWriter.movePosition | ( | int | offset | ) |
Move file position by the given offset.
FileWriter Dragengine.FileWriter.new | ( | String | filename | ) |
Create file writer writing to virtual file system file.
|
static |
Create Z-Compressing file writer writing to virtual file system file.
void Dragengine.FileWriter.setPosition | ( | int | position | ) |
Set file position for the next write action.
void Dragengine.FileWriter.setPositionEnd | ( | int | position | ) |
brief Set file position to the given position measured from the end of the file.
void Dragengine.FileWriter.setStreamVersion | ( | int | version | ) |
Set stream version used by writeToFile of native classes.
void Dragengine.FileWriter.writeByte | ( | int | value | ) |
Write one unsigned byte (1 byte).
void Dragengine.FileWriter.writeChar | ( | int | value | ) |
Write one byte (1 byte).
void Dragengine.FileWriter.writeData | ( | FileReader | reader | ) |
Write data from file reader.
void Dragengine.FileWriter.writeData | ( | FileReader | reader, |
int | size | ||
) |
Write data from file reader.
void Dragengine.FileWriter.writeFloat | ( | float | value | ) |
Write one float (4 bytes).
void Dragengine.FileWriter.writeInt | ( | int | value | ) |
Write one int (4 bytes).
void Dragengine.FileWriter.writeShort | ( | int | value | ) |
Write one short (2 bytes).
void Dragengine.FileWriter.writeString | ( | String | data | ) |
Write string without length field.
void Dragengine.FileWriter.writeString16 | ( | String | string | ) |
Write a string prefixed by a 2-byte length field.
void Dragengine.FileWriter.writeString32 | ( | String | string | ) |
Write a string prefixed by a 4-byte length field.
void Dragengine.FileWriter.writeString8 | ( | String | string | ) |
Write a string prefixed by a 1-byte length field.
void Dragengine.FileWriter.writeTimeDate | ( | TimeDate | timeDate | ) |
Write TimeDate instance.
void Dragengine.FileWriter.writeUInt | ( | int | value | ) |
Write one unsigned int (4 bytes).
void Dragengine.FileWriter.writeUShort | ( | int | value | ) |
Write one unsigned short (2 bytes).
void Dragengine.FileWriter.writeVarString | ( | String | string | ) |
Write a string prefixed by a 1-4 byte length field.
void Dragengine.FileWriter.writeVarUInt | ( | int | value | ) |
Write 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.