FileSystem
Inheritance: java.lang.Object
All Implemented Interfaces: java.io.Closeable
public abstract class FileSystem implements Closeable
Инкапсуляция файловой системы. Aspose.3D будет использовать её для чтения/записи зависимостей. Пример: Следующий код показывает, как импортировать файл и предоставить зависимые файлы в указанном каталоге
var inputFile = "input.fbx";
var format = FileFormat.detect(inputFile);
//create a load options instance and specify a zip file system
var opt = format.createLoadOptions();
opt.setFileSystem(new LocalFileSystem("textures/"));
//load the file
var scene = Scene.fromFile(inputFile, opt);
Конструкторы
| Конструктор | Описание |
|---|---|
| FileSystem() |
Методы
| Метод | Описание |
|---|---|
| close() | Освободите файловую систему и освободите её ресурсы. |
| createDummyFileSystem() | Создать фиктивную файловую систему, операции чтения/записи являются фиктивными. |
| createLocalFileSystem(String directory) | Инициализировать новую FileSystem, которая получает доступ только к локальному каталогу. |
| createMemoryFileSystem() | Создать файловую систему, основанную на памяти, которая будет сопоставлять операции чтения/записи с памятью. |
| createMemoryFileSystem(HashMap<String,MemoryStream> files) | Создать файловую систему, основанную на памяти, которая будет сопоставлять операции чтения/записи с памятью. |
| createZipFileSystem(Stream stream) | Создать файловую систему, предоставляющую только чтение указанного zip‑файла или zip‑потока. |
| createZipFileSystem(Stream stream, String baseDir) | Создать файловую систему, предоставляющую только чтение указанного zip‑файла или zip‑потока. |
| createZipFileSystem(String fileName) | Файловая система, предоставляющая доступ только для чтения к указанному zip‑файлу или zip‑потоку. |
| equals(Object arg0) | |
| getClass() | |
| hashCode() | |
| notify() | |
| notifyAll() | |
| readFile(String fileName, IOConfig options) | Создайте поток для чтения зависимостей. |
| toString() | |
| wait() | |
| wait(long arg0) | |
| wait(long arg0, int arg1) | |
| writeFile(String fileName, IOConfig options) | Создайте поток для записи зависимостей. |
FileSystem()
public FileSystem()
close()
public void close()
Освободите файловую систему и освободите её ресурсы.
createDummyFileSystem()
public static FileSystem createDummyFileSystem()
Создать фиктивную файловую систему, операции чтения/записи являются фиктивными.
Returns: FileSystem - A dummy file system Example: The following code shows how to export file to memory, and ignore all dependent file generation.
//create a scene with material
Scene scene = new Scene();
scene.getRootNode().createChildNode(new Box()).setMaterial(new LambertMaterial());
//create a save option and specify the file system, so the dependent file will be written to memory
var opt = FileFormat.WAVEFRONTOBJ.createSaveOptions();
var dfs = FileSystem.CreateDummyFileSystem();
opt.setFileSystem(dfs);
//obj's material file name is associated with the obj's file name, so we need a explicit name.
opt.setFileName("test.obj");
try (var ms = new MemoryStream())
{
scene.save(ms, opt);
}
createLocalFileSystem(String directory)
public static FileSystem createLocalFileSystem(String directory)
Инициализировать новую FileSystem, которая получает доступ только к локальному каталогу. Все операции чтения/записи файлов в этом экземпляре FileSystem будут сопоставлены с указанным каталогом.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| каталог | java.lang.String | Каталог в вашей физической файловой системе, используемый в качестве виртуального корневого каталога. |
Returns: FileSystem - A new instance of file system to provide local file access
createMemoryFileSystem()
public static FileSystem createMemoryFileSystem()
Создать файловую систему, основанную на памяти, которая будет сопоставлять операции чтения/записи с памятью.
Returns: FileSystem - A memory-based file system Example: The following code shows how to export file to memory, includes the dependent file by using MemoryFileSystem.
//create a scene with material
Scene scene = new Scene();
scene.getRootNode().createChildNode(new Box()).setMaterial(new LambertMaterial());
//create a save option and specify the file system, so the dependent file will be written to memory
var opt = FileFormat.WAVEFRONTOBJ.createSaveOptions();
var mfs = new HashMap<String, MemoryStream>();
opt.setFileSystem(FileSystem.createMemoryFileSystem(mfs));
//obj's material file name is associated with the obj's file name, so we need a explicit name.
opt.setFileName("test.obj");
try (var ms = new MemoryStream())
{
scene.save(ms, opt);
}
//the test.obj was written to variable ms, and we can also get the test.mtl file content by
var materialFile = mfs.get("test.mtl");
createMemoryFileSystem(HashMap<String,MemoryStream> files)
public static FileSystem createMemoryFileSystem(HashMap<String,MemoryStream> files)
Создать файловую систему, основанную на памяти, которая будет сопоставлять операции чтения/записи с памятью.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| файлы | java.util.HashMap<java.lang.String,com.aspose.threed.MemoryStream> | Это позволяет вам читать/записывать виртуальные файлы. |
Returns: FileSystem - A memory-based file system Example: The following code shows how to export file to memory, includes the dependent file by using MemoryFileSystem.
//create a scene with material
Scene scene = new Scene();
scene.getRootNode().createChildNode(new Box()).setMaterial(new LambertMaterial());
//create a save option and specify the file system, so the dependent file will be written to memory
var opt = FileFormat.WAVEFRONTOBJ.createSaveOptions();
var mfs = new HashMap<String, MemoryStream>();
opt.setFileSystem(FileSystem.createMemoryFileSystem(mfs));
//obj's material file name is associated with the obj's file name, so we need a explicit name.
opt.setFileName("test.obj");
try (var ms = new MemoryStream())
{
scene.save(ms, opt);
}
//the test.obj was written to variable ms, and we can also get the test.mtl file content by
var materialFile = mfs.get("test.mtl");
createZipFileSystem(Stream stream)
public static FileSystem createZipFileSystem(Stream stream)
Создать файловую систему, предоставляющую только чтение указанного zip‑файла или zip‑потока. Файловая система будет освобождена после операции открытия/сохранения.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| stream | Stream | Поток для доступа к zip‑файлу |
Returns: FileSystem - A zip file system
createZipFileSystem(Stream stream, String baseDir)
public static FileSystem createZipFileSystem(Stream stream, String baseDir)
Создать файловую систему, предоставляющую только чтение указанного zip‑файла или zip‑потока. Файловая система будет освобождена после операции открытия/сохранения.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| stream | Stream | Поток для доступа к zip‑файлу |
| baseDir | java.lang.String | Базовый каталог внутри zip‑файла. |
Returns: FileSystem - A zip file system
createZipFileSystem(String fileName)
public static FileSystem createZipFileSystem(String fileName)
Файловая система, предоставляющая только чтение указанного zip‑файла или zip‑потока. Файловая система будет освобождена после операции открытия/сохранения.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| fileName | java.lang.String | Имя файла zip‑архива. |
Returns: FileSystem - A zip file system
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| arg0 | java.lang.Object |
Returns: boolean
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
hashCode()
public native int hashCode()
Returns: int
notify()
public final native void notify()
notifyAll()
public final native void notifyAll()
readFile(String fileName, IOConfig options)
public abstract Stream readFile(String fileName, IOConfig options)
Создайте поток для чтения зависимостей.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| fileName | java.lang.String | Имя файла для открытия на чтение |
| options | IOConfig | Сохранить или загрузить параметры |
Returns: Stream - Stream for reading the file.
toString()
public String toString()
Returns: java.lang.String
wait()
public final void wait()
wait(long arg0)
public final void wait(long arg0)
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| arg0 | long |
wait(long arg0, int arg1)
public final void wait(long arg0, int arg1)
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| arg0 | long | |
| arg1 | int |
writeFile(String fileName, IOConfig options)
public abstract Stream writeFile(String fileName, IOConfig options)
Создайте поток для записи зависимостей.
Parameters:
| Параметр | Тип | Описание |
|---|---|---|
| fileName | java.lang.String | Имя файла для открытия на запись |
| options | IOConfig | Сохранить или загрузить параметры |
Returns: Stream - Stream for writing the file