FileSystem

Inheritance: java.lang.Object

All Implemented Interfaces: java.io.Closeable

public abstract class FileSystem implements Closeable

ファイルシステムのカプセル化。Aspose.3D はこれを使用して依存関係の読み書きを行います。Example: 以下のコードはファイルのインポート方法と、指定ディレクトリ内の依存ファイルを提供する方法を示しています

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:

パラメーター説明
streamStreamzip ファイルにアクセスするためのストリーム

Returns: FileSystem - A zip file system

createZipFileSystem(Stream stream, String baseDir)

public static FileSystem createZipFileSystem(Stream stream, String baseDir)

指定された zip ファイルまたは zip ストリームへの読み取り専用アクセスを提供するファイルシステムを作成します。ファイルシステムはオープン/セーブ操作の後に破棄されます。

Parameters:

パラメーター説明
streamStreamzip ファイルにアクセスするためのストリーム
baseDirjava.lang.Stringzip ファイル内のベースディレクトリ。

Returns: FileSystem - A zip file system

createZipFileSystem(String fileName)

public static FileSystem createZipFileSystem(String fileName)

指定された zip ファイルまたは zip ストリームへの読み取り専用アクセスを提供するファイルシステムです。ファイルシステムはオープン/セーブ操作の後に破棄されます。

Parameters:

パラメーター説明
fileNamejava.lang.Stringzip ファイルのファイル名。

Returns: FileSystem - A zip file system

equals(Object arg0)

public boolean equals(Object arg0)

Parameters:

パラメーター説明
arg0java.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:

パラメーター説明
fileNamejava.lang.String読み取り用に開くファイルの名前
optionsIOConfig保存またはロードオプション

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:

パラメーター説明
arg0long

wait(long arg0, int arg1)

public final void wait(long arg0, int arg1)

Parameters:

パラメーター説明
arg0long
arg1int

writeFile(String fileName, IOConfig options)

public abstract Stream writeFile(String fileName, IOConfig options)

依存関係を書き込むためのストリームを作成します。

Parameters:

パラメーター説明
fileNamejava.lang.String書き込み用に開くファイルの名前
optionsIOConfig保存またはロードオプション

Returns: Stream - Stream for writing the file