MemoryFileSystem class

MemoryFileSystem class

The MemoryFileSystem will maps the read/write operations to memory.

Inheritance: MemoryFileSystemFileSystem

The MemoryFileSystem type exposes the following members:

Constructors

ConstructorDescription
initConstructs a new instance of MemoryFileSystem

Properties

PropertyDescription
file_namesFile names that in this memory file system.

Methods

MethodDescription
read_fileCreate a stream for reading dependencies.
write_fileCreate a stream for writing dependencies.
get_file_contentReturns the raw content of the specified file.

Throw FileNotFoundException if the specified file is not existing.

Example

The following code shows how to export file to memory, includes the dependent file by using MemoryFileSystem.

from aspose.threed import FileFormat, Scene
from aspose.threed.entities import Box
from aspose.threed.shading import LambertMaterial
from aspose.threed.utilities import MemoryFileSystem
from io import BytesIO

# malzeme ile bir sahne oluştur
scene = Scene()
scene.root_node.create_child_node(Box()).material = LambertMaterial()
# kaydetme seçeneği oluştur ve dosya sistemini belirt, böylece bağımlı dosya belleğe yazılacak
opt = FileFormat.WAVEFRONT_OBJ.create_save_options()
mfs = MemoryFileSystem()
opt.file_system = mfs
# obj'nin malzeme dosya adı obj'nin dosya adıyla ilişkilidir, bu yüzden açık bir ada ihtiyacımız var.
opt.file_name = "test.obj"
with BytesIO() as ms:
    scene.save(ms, opt)
# test.obj değişkeni ms'ye yazıldı ve test.mtl dosya içeriğini de şu şekilde alabiliriz
materialFile = mfs.get_file_content("test.mtl")

See Also