MemoryFileSystem class
MemoryFileSystem class
The MemoryFileSystem will maps the read/write operations to memory.
Inheritance: MemoryFileSystem →
FileSystem
The MemoryFileSystem type exposes the following members:
Constructors
| Constructor | Description |
|---|---|
| init | Constructs a new instance of MemoryFileSystem |
Properties
| Property | Description |
|---|---|
| file_names | File names that in this memory file system. |
Methods
| Method | Description |
|---|---|
| read_file | Create a stream for reading dependencies. |
| write_file | Create a stream for writing dependencies. |
| get_file_content | Returns 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
- module
aspose.threed.utilities - class
FileSystem - class
MemoryFileSystem