MemoryFileSystem
内容
[
隐藏
]Inheritance: java.lang.Object, com.aspose.threed.FileSystem
public class MemoryFileSystem extends FileSystem
该 MemoryFileSystem 将把读/写操作映射到内存。 Example: 以下代码展示了如何将文件导出到内存,并通过使用 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 MemoryFileSystem();
opt.setFileSystem(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.getFileContent("test.mtl");
构造函数
| 构造函数 | 描述 |
|---|---|
| MemoryFileSystem() |
方法
| 方法 | 描述 |
|---|---|
| close() | 释放文件系统并释放其资源。 |
| equals(Object arg0) | |
| getClass() | |
| getFileContent(String fileName) | 返回指定文件的原始内容。 |
| getFileNames() | 此内存文件系统中的文件名。 |
| hashCode() | |
| notify() | |
| notifyAll() | |
| readFile(String fileName, IOConfig options) | 创建用于读取依赖项的流。 |
| toString() | |
| wait() | |
| wait(long arg0) | |
| wait(long arg0, int arg1) | |
| writeFile(String fileName, IOConfig options) | 创建用于写入依赖项的流。 |
MemoryFileSystem()
public MemoryFileSystem()
close()
public void close()
释放文件系统并释放其资源。
equals(Object arg0)
public boolean equals(Object arg0)
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| arg0 | java.lang.Object |
Returns: 布尔
getClass()
public final native Class<?> getClass()
Returns: java.lang.Class
getFileContent(String fileName)
public byte[] getFileContent(String fileName)
返回指定文件的原始内容。如果指定文件不存在,则抛出 java.io.FileNotFoundException。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 文件名 | java.lang.String |
Returns: byte[]
getFileNames()
public List<String> getFileNames()
此内存文件系统中的文件名。
Returns: java.util.List<java.lang.String>
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 Stream readFile(String fileName, IOConfig options)
创建用于读取依赖项的流。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 文件名 | java.lang.String | |
| options | IOConfig |
Returns: com.aspose.csporter.helpers.Stream
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 Stream writeFile(String fileName, IOConfig options)
创建用于写入依赖项的流。
Parameters:
| 参数 | 类型 | 描述 |
|---|---|---|
| 文件名 | java.lang.String | |
| options | IOConfig |
Returns: com.aspose.csporter.helpers.Stream