Drag[en]gine Script Module DragonScript  1.23
Dragengine.FileWriter Class Reference

File writer. More...

Inheritance diagram for Dragengine.FileWriter:

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...
 

Detailed Description

File writer.

This is a native class.

Member Function Documentation

◆ getFilename()

String Dragengine.FileWriter.getFilename ( )

File name.

◆ getPosition()

int Dragengine.FileWriter.getPosition ( )

Current writing position in the file.

Version
1.23

◆ getStreamVersion()

int Dragengine.FileWriter.getStreamVersion ( )

Stream version used by writeToFile of native classes.

◆ movePosition()

void Dragengine.FileWriter.movePosition ( int  offset)

Move file position by the given offset.

Version
1.23

◆ new()

FileWriter Dragengine.FileWriter.new ( String  filename)

Create file writer writing to virtual file system file.

◆ newZCompressed()

static FileWriter Dragengine.FileWriter.newZCompressed ( String  filename)
static

Create Z-Compressing file writer writing to virtual file system file.

Version
1.8

◆ setPosition()

void Dragengine.FileWriter.setPosition ( int  position)

Set file position for the next write action.

Version
1.23

◆ setPositionEnd()

void Dragengine.FileWriter.setPositionEnd ( int  position)

brief Set file position to the given position measured from the end of the file.

Version
1.23

◆ setStreamVersion()

void Dragengine.FileWriter.setStreamVersion ( int  version)

Set stream version used by writeToFile of native classes.

◆ writeByte()

void Dragengine.FileWriter.writeByte ( int  value)

Write one unsigned byte (1 byte).

◆ writeChar()

void Dragengine.FileWriter.writeChar ( int  value)

Write one byte (1 byte).

◆ writeData() [1/2]

void Dragengine.FileWriter.writeData ( FileReader  reader)

Write data from file reader.

◆ writeData() [2/2]

void Dragengine.FileWriter.writeData ( FileReader  reader,
int  size 
)

Write data from file reader.

◆ writeFloat()

void Dragengine.FileWriter.writeFloat ( float  value)

Write one float (4 bytes).

◆ writeInt()

void Dragengine.FileWriter.writeInt ( int  value)

Write one int (4 bytes).

◆ writeShort()

void Dragengine.FileWriter.writeShort ( int  value)

Write one short (2 bytes).

◆ writeString()

void Dragengine.FileWriter.writeString ( String  data)

Write string without length field.

◆ writeString16()

void Dragengine.FileWriter.writeString16 ( String  string)

Write a string prefixed by a 2-byte length field.

◆ writeString32()

void Dragengine.FileWriter.writeString32 ( String  string)

Write a string prefixed by a 4-byte length field.

Version
1.22

◆ writeString8()

void Dragengine.FileWriter.writeString8 ( String  string)

Write a string prefixed by a 1-byte length field.

◆ writeTimeDate()

void Dragengine.FileWriter.writeTimeDate ( TimeDate  timeDate)

Write TimeDate instance.

◆ writeUInt()

void Dragengine.FileWriter.writeUInt ( int  value)

Write one unsigned int (4 bytes).

◆ writeUShort()

void Dragengine.FileWriter.writeUShort ( int  value)

Write one unsigned short (2 bytes).

◆ writeVarString()

void Dragengine.FileWriter.writeVarString ( String  string)

Write a string prefixed by a 1-4 byte length field.

Version
1.22

◆ writeVarUInt()

void Dragengine.FileWriter.writeVarUInt ( int  value)

Write variable length unsigned integer (1-4 bytes) and advances file pointer.

Version
1.22

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.


The documentation for this class was generated from the following file: