Drag[en]gine Script Module DragonScript  1.21
Dragengine.MemoryFile Class Reference

Memory file. More...

Inheritance diagram for Dragengine.MemoryFile:

Public Member Functions

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

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.

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

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

◆ getSize()

int Dragengine.MemoryFile.getSize ( )

Data size in bytes.

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

◆ getWriterZCompressed()

FileWriter Dragengine.MemoryFile.getWriterZCompressed ( )

Get new FileWriter.

Version
1.8

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

◆ new() [1/2]

MemoryFile Dragengine.MemoryFile.new ( MemoryFile  memoryFile)

Create copy of memory file.

Parameters
memoryFileMemory file to create copy of.

◆ new() [2/2]

MemoryFile Dragengine.MemoryFile.new ( String  filename)

Create memory file.

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

◆ setSize()

void Dragengine.MemoryFile.setSize ( int  size)

Set data size in bytes.

If size changes the data is undefined.


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