|
Sweet Home 3D 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.Writer
java.io.FilterWriter
com.eteks.sweethome3d.j3d.OBJWriter
public class OBJWriter
An output stream that writes Java 3D nodes at OBJ + MTL format.
Once you wrote nodes, call close
method to create the MTL file
and the texture images in the same folder as OBJ file. This feature applies
only to constructor that takes a file as parameter.
Note: this class is compatible with Java 3D 1.3.
Field Summary |
---|
Fields inherited from class java.io.FilterWriter |
---|
out |
Fields inherited from class java.io.Writer |
---|
lock |
Constructor Summary | |
---|---|
OBJWriter(File objFile)
Create an OBJ writer for the given file, with no header and default precision. |
|
OBJWriter(File objFile,
String header,
int maximumFractionDigits)
Create an OBJ writer for the given file. |
|
OBJWriter(OutputStream out)
Create an OBJ writer that will writes in out stream,
with no header and default precision. |
|
OBJWriter(OutputStream out,
String header,
int maximumFractionDigits)
Create an OBJ writer that will writes in out stream. |
|
OBJWriter(String objFileName)
Create an OBJ writer for the given file name, with no header and default precision. |
|
OBJWriter(String objFileName,
String header,
int maximumFractionDigits)
Create an OBJ writer for the given file name. |
|
OBJWriter(Writer out)
Create an OBJ writer that will writes in out stream,
with no header and default precision. |
|
OBJWriter(Writer out,
String header,
int maximumFractionDigits)
Create an OBJ writer that will writes in out stream. |
Method Summary | |
---|---|
void |
close()
Closes this writer and writes MTL file and its texture images, if this writer was created from a file. |
void |
write(char[] cbuf,
int off,
int len)
Write a portion of an array of characters in a comment at OBJ format. |
void |
write(int c)
Write a single character in a comment at OBJ format. |
void |
write(String str)
Write a string in a comment at OBJ format. |
void |
write(String str,
int off,
int len)
Write a portion of a string in a comment at OBJ format. |
void |
writeNode(Node node)
Writes all the 3D shapes children of node at OBJ format. |
void |
writeNode(Node node,
String nodeName)
Writes all the 3D shapes children of node at OBJ format. |
static void |
writeNodeInZIPFile(Node node,
File zipFile,
int compressionLevel,
String entryName,
String header)
Writes node in an entry at OBJ format of the given zip file
along with its MTL file and texture images. |
Methods inherited from class java.io.FilterWriter |
---|
flush |
Methods inherited from class java.io.Writer |
---|
append, append, append, write |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public OBJWriter(File objFile) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public OBJWriter(File objFile, String header, int maximumFractionDigits) throws FileNotFoundException, IOException
objFile
- the file into which 3D nodes will be written at OBJ formatheader
- a header written as a comment at start of the OBJ file and its MTL counterpartmaximumFractionDigits
- the maximum digits count used in fraction part of numbers,
or -1 for default value. Using -1 may cause writing nodes to be twice faster.
FileNotFoundException
IOException
public OBJWriter(String objFileName) throws FileNotFoundException, IOException
FileNotFoundException
IOException
public OBJWriter(String objFileName, String header, int maximumFractionDigits) throws FileNotFoundException, IOException
objFileName
- the name of the file into which 3D nodes will be written at OBJ formatheader
- a header written as a comment at start of the OBJ file and its MTL counterpartmaximumFractionDigits
- the maximum digits count used in fraction part of numbers,
or -1 for default value. Using -1 may cause writing nodes to be twice faster.
FileNotFoundException
IOException
public OBJWriter(OutputStream out) throws IOException
out
stream,
with no header and default precision.
IOException
public OBJWriter(OutputStream out, String header, int maximumFractionDigits) throws IOException
out
stream.
out
- the stream into which 3D nodes will be written at OBJ formatheader
- a header written as a comment at start of the streammaximumFractionDigits
- the maximum digits count used in fraction part of numbers,
or -1 for default value. Using -1 may cause writing nodes to be twice faster.
IOException
public OBJWriter(Writer out) throws IOException
out
stream,
with no header and default precision.
IOException
public OBJWriter(Writer out, String header, int maximumFractionDigits) throws IOException
out
stream.
out
- the stream into which 3D nodes will be written at OBJ formatheader
- a header written as a comment at start of the streammaximumFractionDigits
- the maximum digits count used in fraction part of numbers,
or -1 for default value. Using -1 may cause writing nodes to be twice faster.
IOException
Method Detail |
---|
public void write(int c) throws IOException
write
in class FilterWriter
IOException
public void write(char[] cbuf, int off, int len) throws IOException
write
in class FilterWriter
IOException
public void write(String str, int off, int len) throws IOException
write
in class FilterWriter
IOException
public void write(String str) throws IOException
write
in class Writer
IOException
public void writeNode(Node node) throws IOException, InterruptedIOException
node
at OBJ format.
If there are transformation groups on the path from node
to its shapes,
they'll be applied to the coordinates written on output.
The node
shouldn't be alive or if it's alive it should have the
capabilities to read its children, the geometries and the appearance of its shapes.
Only geometries which are instances of GeometryArray
will be written.
node
- a Java 3D node
IOException
- if the operation failed
InterruptedIOException
- if the current thread was interrupted during this operation.
The interrupted status of the current thread is cleared when this exception is thrown.public void writeNode(Node node, String nodeName) throws IOException, InterruptedIOException
node
at OBJ format.
If there are transformation groups on the path from node
to its shapes,
they'll be applied to the coordinates written on output.
The node
shouldn't be alive or if it's alive, it should have the
capabilities to read its children, the geometries and the appearance of its shapes.
Only geometries which are instances of GeometryArray
will be written.
node
- a Java 3D nodenodeName
- the name of the node. This is useful to distinguish the objects
names in output. If this name is null
or isn't built
with A-Z, a-z, 0-9 and underscores, it will be ignored.
IOException
- if the operation failed
InterruptedIOException
- if the current thread was interrupted during this operation
The interrupted status of the current thread is cleared when this exception is thrown.public void close() throws IOException, InterruptedIOException
close
in interface Closeable
close
in class FilterWriter
IOException
- if this writer couldn't be closed
or couldn't write MTL and texture files couldn't be written
InterruptedIOException
- if the current thread was interrupted during this operation
The interrupted status of the current thread is cleared when this exception is thrown.public static void writeNodeInZIPFile(Node node, File zipFile, int compressionLevel, String entryName, String header) throws IOException
node
in an entry at OBJ format of the given zip file
along with its MTL file and texture images.
IOException
|
Sweet Home 3D 4.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
![]() |
© Copyrights 2006-2013 eTeks - All rights reserved
Distributed under GNU General Public License |