Package com.io7m.smfj.frontend
Class SMFFCopier
- java.lang.Object
-
- com.io7m.smfj.frontend.SMFFCopier
-
- All Implemented Interfaces:
SMFFCopierType
,SMFParserEventsBodyType
,SMFParserEventsDataAttributesNonInterleavedType
,SMFParserEventsDataAttributeValuesType
,SMFParserEventsDataMetaOptionalSupplierType
,SMFParserEventsDataMetaType
,SMFParserEventsDataTrianglesType
,SMFParserEventsErrorType
,SMFParserEventsHeaderType
,SMFParserEventsType
public final class SMFFCopier extends java.lang.Object implements SMFFCopierType, SMFParserEventsBodyType, SMFParserEventsHeaderType, SMFParserEventsDataAttributesNonInterleavedType, SMFParserEventsDataTrianglesType, SMFParserEventsDataMetaType, SMFParserEventsDataAttributeValuesType
The default implementation of theSMFFCopierType
.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SMFFCopierType
create(SMFSerializerType in_serializer)
Create a new copier.java.util.List<SMFErrorType>
errors()
java.util.Optional<SMFParserEventsDataAttributesNonInterleavedType>
onAttributesNonInterleaved()
void
onDataAttributesNonInterleavedFinish()
Called when parsing of all non-interleaved attribute data has finished.java.util.Optional<SMFParserEventsDataAttributeValuesType>
onDataAttributeStart(SMFAttribute attribute)
Parsing of data for the attribute has started.void
onDataAttributeValueFinish()
Parsing of data for the attribute has finished.void
onDataAttributeValueFloat1(double x)
A data value has been received.void
onDataAttributeValueFloat2(double x, double y)
A data value has been received.void
onDataAttributeValueFloat3(double x, double y, double z)
A data value has been received.void
onDataAttributeValueFloat4(double x, double y, double z, double w)
A data value has been received.void
onDataAttributeValueIntegerSigned1(long x)
A data value has been received.void
onDataAttributeValueIntegerSigned2(long x, long y)
A data value has been received.void
onDataAttributeValueIntegerSigned3(long x, long y, long z)
A data value has been received.void
onDataAttributeValueIntegerSigned4(long x, long y, long z, long w)
A data value has been received.void
onDataAttributeValueIntegerUnsigned1(long x)
A data value has been received.void
onDataAttributeValueIntegerUnsigned2(long x, long y)
A data value has been received.void
onDataAttributeValueIntegerUnsigned3(long x, long y, long z)
A data value has been received.void
onDataAttributeValueIntegerUnsigned4(long x, long y, long z, long w)
A data value has been received.void
onDataTriangle(long v0, long v1, long v2)
A triangle has been parsed.void
onDataTrianglesFinish()
Parsing of triangles has completed.void
onError(SMFErrorType e)
An error has occurred.void
onFinish()
Parsing has finished.java.util.Optional<SMFParserEventsBodyType>
onHeaderParsed(SMFHeader header)
Parsing of the header was successful.java.util.Optional<SMFParserEventsDataMetaType>
onMeta(SMFSchemaIdentifier schema)
void
onMetaData(SMFSchemaIdentifier schema, byte[] data)
Metadata is ready for delivery.void
onStart()
Parsing has started.java.util.Optional<SMFParserEventsDataTrianglesType>
onTriangles()
java.util.Optional<SMFParserEventsHeaderType>
onVersionReceived(SMFFormatVersion in_version)
The file format version has been successfully parsed.void
onWarning(SMFWarningType w)
An error has occurred of a severity low enough that it should just be considered a warning.java.util.List<SMFWarningType>
warnings()
-
-
-
Method Detail
-
create
public static SMFFCopierType create(SMFSerializerType in_serializer)
Create a new copier.- Parameters:
in_serializer
- The serializer- Returns:
- A new copier
-
onStart
public void onStart()
Description copied from interface:SMFParserEventsType
Parsing has started.- Specified by:
onStart
in interfaceSMFParserEventsType
-
onVersionReceived
public java.util.Optional<SMFParserEventsHeaderType> onVersionReceived(SMFFormatVersion in_version)
Description copied from interface:SMFParserEventsType
The file format version has been successfully parsed. The functions should return a receiver for the header information if parsing should continue, orOptional.empty()
if parsing should stop.- Specified by:
onVersionReceived
in interfaceSMFParserEventsType
- Parameters:
in_version
- The file format version- Returns:
- A receiver for the header, if any
-
onFinish
public void onFinish()
Description copied from interface:SMFParserEventsType
Parsing has finished. This method will be called unconditionally when the parser is closed, regardless of any errors encountered.- Specified by:
onFinish
in interfaceSMFParserEventsType
-
onError
public void onError(SMFErrorType e)
Description copied from interface:SMFParserEventsErrorType
An error has occurred. Parsing will continue but the file as a whole must be considered invalid.- Specified by:
onError
in interfaceSMFParserEventsErrorType
- Parameters:
e
- The error
-
onWarning
public void onWarning(SMFWarningType w)
Description copied from interface:SMFParserEventsErrorType
An error has occurred of a severity low enough that it should just be considered a warning.- Specified by:
onWarning
in interfaceSMFParserEventsErrorType
- Parameters:
w
- The warning
-
onDataAttributeStart
public java.util.Optional<SMFParserEventsDataAttributeValuesType> onDataAttributeStart(SMFAttribute attribute)
Description copied from interface:SMFParserEventsDataAttributesNonInterleavedType
Parsing of data for the attribute has started.
This method must return a receiver for the given attribute if it wants to receive values, or
Optional.empty()
if it does not.- Specified by:
onDataAttributeStart
in interfaceSMFParserEventsDataAttributesNonInterleavedType
- Parameters:
attribute
- The attribute- Returns:
- A value receiver
-
onDataAttributesNonInterleavedFinish
public void onDataAttributesNonInterleavedFinish()
Description copied from interface:SMFParserEventsDataAttributesNonInterleavedType
Called when parsing of all non-interleaved attribute data has finished.- Specified by:
onDataAttributesNonInterleavedFinish
in interfaceSMFParserEventsDataAttributesNonInterleavedType
-
onDataAttributeValueIntegerSigned1
public void onDataAttributeValueIntegerSigned1(long x)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerSigned1
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x value
-
onDataAttributeValueIntegerSigned2
public void onDataAttributeValueIntegerSigned2(long x, long y)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerSigned2
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y value
-
onDataAttributeValueIntegerSigned3
public void onDataAttributeValueIntegerSigned3(long x, long y, long z)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerSigned3
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y valuez
- The z value
-
onDataAttributeValueIntegerSigned4
public void onDataAttributeValueIntegerSigned4(long x, long y, long z, long w)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerSigned4
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y valuez
- The z valuew
- The w value
-
onDataAttributeValueIntegerUnsigned1
public void onDataAttributeValueIntegerUnsigned1(long x)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerUnsigned1
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x value
-
onDataAttributeValueIntegerUnsigned2
public void onDataAttributeValueIntegerUnsigned2(long x, long y)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerUnsigned2
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y value
-
onDataAttributeValueIntegerUnsigned3
public void onDataAttributeValueIntegerUnsigned3(long x, long y, long z)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerUnsigned3
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y valuez
- The z value
-
onDataAttributeValueIntegerUnsigned4
public void onDataAttributeValueIntegerUnsigned4(long x, long y, long z, long w)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueIntegerUnsigned4
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y valuez
- The z valuew
- The w value
-
onDataAttributeValueFloat1
public void onDataAttributeValueFloat1(double x)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueFloat1
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x value
-
onDataAttributeValueFloat2
public void onDataAttributeValueFloat2(double x, double y)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueFloat2
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y value
-
onDataAttributeValueFloat3
public void onDataAttributeValueFloat3(double x, double y, double z)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueFloat3
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y valuez
- The z value
-
onDataAttributeValueFloat4
public void onDataAttributeValueFloat4(double x, double y, double z, double w)
Description copied from interface:SMFParserEventsDataAttributeValuesType
A data value has been received.- Specified by:
onDataAttributeValueFloat4
in interfaceSMFParserEventsDataAttributeValuesType
- Parameters:
x
- The x valuey
- The y valuez
- The z valuew
- The w value
-
onDataAttributeValueFinish
public void onDataAttributeValueFinish()
Description copied from interface:SMFParserEventsDataAttributeValuesType
Parsing of data for the attribute has finished.- Specified by:
onDataAttributeValueFinish
in interfaceSMFParserEventsDataAttributeValuesType
-
onDataTriangle
public void onDataTriangle(long v0, long v1, long v2)
Description copied from interface:SMFParserEventsDataTrianglesType
A triangle has been parsed.- Specified by:
onDataTriangle
in interfaceSMFParserEventsDataTrianglesType
- Parameters:
v0
- The index of the first vertexv1
- The index of the second vertexv2
- The index of the third vertex
-
onDataTrianglesFinish
public void onDataTrianglesFinish()
Description copied from interface:SMFParserEventsDataTrianglesType
Parsing of triangles has completed.- Specified by:
onDataTrianglesFinish
in interfaceSMFParserEventsDataTrianglesType
-
errors
public java.util.List<SMFErrorType> errors()
- Specified by:
errors
in interfaceSMFFCopierType
- Returns:
- The list of errors encountered, if any
-
warnings
public java.util.List<SMFWarningType> warnings()
- Specified by:
warnings
in interfaceSMFFCopierType
- Returns:
- The list of warnings encountered, if any
-
onHeaderParsed
public java.util.Optional<SMFParserEventsBodyType> onHeaderParsed(SMFHeader header)
Description copied from interface:SMFParserEventsHeaderType
Parsing of the header was successful. The function must return an event receiver if it wishes parsing to continue.- Specified by:
onHeaderParsed
in interfaceSMFParserEventsHeaderType
- Parameters:
header
- The parsed header- Returns:
- An event receiver
-
onAttributesNonInterleaved
public java.util.Optional<SMFParserEventsDataAttributesNonInterleavedType> onAttributesNonInterleaved()
- Specified by:
onAttributesNonInterleaved
in interfaceSMFParserEventsBodyType
- Returns:
- A listener that will receive non-interleaved mesh data
-
onTriangles
public java.util.Optional<SMFParserEventsDataTrianglesType> onTriangles()
- Specified by:
onTriangles
in interfaceSMFParserEventsBodyType
- Returns:
- A listener that will receive triangle data
-
onMetaData
public void onMetaData(SMFSchemaIdentifier schema, byte[] data)
Description copied from interface:SMFParserEventsDataMetaType
Metadata is ready for delivery.- Specified by:
onMetaData
in interfaceSMFParserEventsDataMetaType
- Parameters:
schema
- The metadata schemadata
- The data
-
onMeta
public java.util.Optional<SMFParserEventsDataMetaType> onMeta(SMFSchemaIdentifier schema)
- Specified by:
onMeta
in interfaceSMFParserEventsDataMetaOptionalSupplierType
- Parameters:
schema
- The schema ID- Returns:
- A listener that will receive metadata
-
-