Package eu.simuline.octave.io.spi
Class OctaveDataWriter<T extends OctaveObject>
- java.lang.Object
-
- eu.simuline.octave.io.spi.OctaveDataWriter<T>
-
- Type Parameters:
T- the type extendingOctaveObjectthis writer can write.
- Direct Known Subclasses:
AbstractPrimitiveMatrixWriter,CellWriter,FakeWriter,FunctionHandleWriter,OctaveStringWriter,SparseBooleanWriter,StructWriter
public abstract class OctaveDataWriter<T extends OctaveObject> extends Object
Service Provider Interface for the IO handler that can writeOctaveObjects. The according implementations are in packageeu.simuline.octave.io.impland extend this class. These classes are registered in the jar-file underMETA-INF/services/eu.simuline.octave.io.OctaveDataWriter.
-
-
Field Summary
Fields Modifier and Type Field Description private static Map<Class<? extends OctaveObject>,OctaveDataWriter<?>>wRITERSMaps thejavaType()which represents an octave type of anOctaveDataWriterto theOctaveDataWriteritself which is able to write the octave type to a writer.
-
Constructor Summary
Constructors Constructor Description OctaveDataWriter()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static <T extends OctaveObject>
OctaveDataWriter<T>getOctaveDataWriter(T type)private static voidinitWriterIfNecessary()abstract Class<T>javaType()Could be OctaveScalar or OctaveMatrix.abstract voidwrite(Writer writer, T octaveType)
-
-
-
Field Detail
-
wRITERS
private static Map<Class<? extends OctaveObject>,OctaveDataWriter<?>> wRITERS
Maps thejavaType()which represents an octave type of anOctaveDataWriterto theOctaveDataWriteritself which is able to write the octave type to a writer.
-
-
Method Detail
-
getOctaveDataWriter
public static <T extends OctaveObject> OctaveDataWriter<T> getOctaveDataWriter(T type)
- Type Parameters:
T-- Parameters:
type-- Returns:
- The OctaveDataWriter or null if it does not exist
-
initWriterIfNecessary
private static void initWriterIfNecessary()
-
javaType
public abstract Class<T> javaType()
Could be OctaveScalar or OctaveMatrix.- Returns:
- the
Classof theOctaveObjectthat this IO handler loads and saves
-
write
public abstract void write(Writer writer, T octaveType) throws IOException
- Parameters:
writer- the Writer to write tooctaveType- the value to write- Throws:
IOException
-
-