Drag[en]gine Script Module DragonScript 1.35
Loading...
Searching...
No Matches
Dragengine.MemoryFile Class Reference

Memory file. More...

Inheritance diagram for Dragengine.MemoryFile:

Public Member Functions

Constructors
MemoryFile new (String filename)
 Create memory file.
MemoryFile new (MemoryFile memoryFile)
 Create copy of memory file.
Management
String getFilename ()
 File name.
int getSize ()
 Data size in bytes.
void setSize (int size)
 Set data size in bytes.
FileReader getReader ()
 Get new FileReader starting reading at the start of the data.
FileWriter getWriter (bool append)
 Get new FileWriter.
FileReader getReaderZCompressed ()
 Get new FileReader starting reading at the start of the data.
FileWriter getWriterZCompressed ()
 Get new FileWriter.

Detailed Description

Memory file.

Stores byte string data in memory allowing FileReader and FileWriter to be used to read and write the data.

This is a native class.

Member Function Documentation

◆ getFilename()

String Dragengine.MemoryFile.getFilename ( )

File name.

References getFilename().

Referenced by getFilename().

◆ getReader()

FileReader Dragengine.MemoryFile.getReader ( )

Get new FileReader starting reading at the start of the data.

Multiple file readers can be active on the same memory file at different read positions. If the data is changed while file readers are using this memory file the next read calls can cause exceptions due to reading past the end of file.

References getReader().

Referenced by getReader().

◆ getReaderZCompressed()

FileReader Dragengine.MemoryFile.getReaderZCompressed ( )

Get new FileReader starting reading at the start of the data.

Version
1.8

Same as getReader() but decompressed data using Z-Compression.

References getWriter().

Referenced by getWriterZCompressed().

◆ getSize()

int Dragengine.MemoryFile.getSize ( )

Data size in bytes.

References getSize().

Referenced by getSize().

◆ getWriter()

FileWriter Dragengine.MemoryFile.getWriter ( bool append)

Get new FileWriter.

Using multiple file writers is allowed but discouraged. Each writer maintain its own write position. If multiple writers attempt to write on the same memory file the data ist overwritten. If you need to use multiple file writers you have to manually move the write pointers to the right location.

If file readers are using this memory file while writers change the content the next read calls can cause exceptions due to reading past the end of file.

Parameters
appendIf true start writing at end of data. If false resizes data to 0 bytes and starts writing.

Referenced by getReaderZCompressed().

◆ getWriterZCompressed()

FileWriter Dragengine.MemoryFile.getWriterZCompressed ( )

Get new FileWriter.

Version
1.8

Same as getWriter(false) but compressed data using Z-Compression.

References getReaderZCompressed(), and getWriterZCompressed().

Referenced by getWriterZCompressed().

◆ new() [1/2]

MemoryFile Dragengine.MemoryFile.new ( MemoryFile memoryFile)

Create copy of memory file.

Parameters
memoryFileMemory file to create copy of.

References new().

◆ new() [2/2]

MemoryFile Dragengine.MemoryFile.new ( String filename)

Create memory file.

Parameters
filenameFilename shown if FileReader.getFilename() or FileWriter.getFilename() is called.

References new().

Referenced by new(), and new().

◆ setSize()

void Dragengine.MemoryFile.setSize ( int size)

Set data size in bytes.

If size changes the data is undefined.

References setSize().

Referenced by setSize().


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