FileFormat — Aspose.3D FOSS for Java
Methods
FileFormat 포맷 설명자이자 지원되는 모든 3D 파일 포맷의 레지스트리 역할을 합니다. 각 포맷은 FileFormat 클래스 속성이나 정적 팩토리 메서드를 통해 접근 가능한 인스턴스입니다. 당신은 FileFormat 인스턴스를 Scene.save() 특정 포맷을 강제하기 위해, 혹은 FileFormat.detect() 알 수 없는 파일의 포맷을 식별하기 위해.
Methods: com.aspose.threed
import com.aspose.threed.FileFormat;지원되는 포맷 상수
아래는 FOSS 릴리스에서 적극적으로 지원되는(임포터 및/또는 익스포터가 등록된) 포맷 상수들입니다.
적극적으로 지원됨 (FOSS 릴리스)
| Methods | Methods | Methods |
|---|---|---|
FileFormat.WAVEFRONTOBJ | .obj | Public static final 필드 (ObjFormat 인스턴스) |
FileFormat.GLTF2 | .gltf / .glb | glTF 2.0 및 GLB; public static final 필드 (GltfFormat 인스턴스). 사용 GltfSaveOptions 와 함께 setContentType(FileContentType.BINARY) GLB 출력용. |
FileFormat.FBX7400ASCII | .fbx | FBX 7.4 ASCII; 가져오기 전용 (내보내기 없음) |
FileFormat.STL_BINARY | .stl | STL binary (클래스 로드 시 설정) |
FileFormat.STLASCII | .stl | STL ASCII |
Methods
FBX versions 6100-7700 (binary), Maya ASCII/Binary, Discreet 3DS, Universal 3D, GLTF 1.0, GLTF binary, PDF, Blender, DXF, PLY, X (binary/text), Draco, RVM, ASE, IFC, Siemens JT, AMF, VRML, HTML5, ZIP, USD/USDA/USDZ, XYZ, PCD, PCD binary.
정적 메서드
| Methods | 반환 타입 | Methods |
|---|---|---|
FileFormat.detect(InputStream stream, String fileName) | FileFormat | 파일 스트림에서 형식을 감지합니다; fileName 힌트로 사용됩니다 |
FileFormat.getFormatByExtension(String ext) | FileFormat | 확장자 문자열과 일치하는 형식을 반환합니다 ".obj", ".glb", ".fbx", ".stl" |
인스턴스 속성
| Methods | Methods | Methods | Methods |
|---|---|---|---|
extension | String | getExtension() | 주요 파일 확장자(선행 점 없이) |
extensions | List<String> | getExtensions() | 이 형식이 지원하는 모든 확장자 |
contentType | String | getContentType() | MIME 타입 문자열 |
canExport | boolean | getCanExport() | 이 형식으로 내보내기가 지원되는지 여부 |
canImport | boolean | getCanImport() | 이 형식에서 가져오기가 지원되는지 여부 |
version | String | getVersion() | 형식 버전 문자열 |
인스턴스 메서드
| Methods | 반환 유형 | Methods |
|---|---|---|
createLoadOptions() | LoadOptions | 적절한 형식별을 생성합니다 LoadOptions subclass |
createSaveOptions() | SaveOptions | 적절한 형식별을 생성합니다 SaveOptions 하위 클래스 |
Methods
import com.aspose.threed.Scene;
import com.aspose.threed.FileFormat;
import com.aspose.threed.*;
// Auto-detect and load
Scene scene = Scene.fromFile("model.obj");
// Save with explicit format (force GLB binary)
GltfSaveOptions opts = new GltfSaveOptions();
opts.setContentType(FileContentType.BINARY);
scene.save("output.glb", opts);
// Get format by extension
FileFormat fmt = FileFormat.getFormatByExtension(".fbx");
if (fmt != null) {
System.out.println(fmt.getCanImport()); // true
System.out.println(fmt.getCanExport()); // false (FBX export not available)
}
// Create options from a format instance
FileFormat fmtObj = FileFormat.getFormatByExtension(".obj");
LoadOptions loadOpts = fmtObj.createLoadOptions(); // ObjLoadOptions
SaveOptions saveOpts = fmtObj.createSaveOptions(); // ObjSaveOptions
// Detect format from file stream
try (FileInputStream fis = new FileInputStream("unknown_file.bin")) {
FileFormat detected = FileFormat.detect(fis, "unknown_file.bin");
if (detected != null) {
System.out.println(detected.getClass().getSimpleName());
}
}