Package org.eclipse.birt.chart.model.impl

# Class SerializerImpl

java.lang.Object
org.eclipse.birt.chart.model.impl.SerializerImpl

All Implemented Interfaces:
  `Serializer`

public class SerializerImpl extends Object implements Serializer
SerializerImpl

## Field Summary

Fields
Modifier and Type
Field
Description
`static final String`
`CHART_END_MARKER`
`static final String`
`CHART_START_MARKER`

## Method Summary

Modifier and Type
Method
Description
`ByteArrayOutputStream`
`asXml(Chart cModel, boolean bStripHeaders)`
Write the chart described by the model to a ByteArrayOutputStream.
`Chart`
`fromXml(ByteArrayInputStream byais, boolean bStripHeaders)`
Reads the chart model from the ByteArrayInputStream.
`static final Serializer`
`instance()`
`ChartPreferences`
`loadPreferences(InputStream is)`
Loads the chart preferences from the InputStream.
`Chart`
`read(InputStream is)`
Reads the chart model from the given InputStream
`Chart`
`read(org.eclipse.emf.common.util.URI uri)`
Reads the chart model from the location defined by the URI provided.
`Chart`
`readEmbedded(org.eclipse.emf.common.util.URI uri)`
Reads the chart model embedded inside other XML content defined by the URI provided.
`void`
`savePreferences(ChartPreferences preferences, OutputStream os)`
Saves the chart preferences to the specified OutputStream.
`void`
`write(Chart cModel, OutputStream os)`
Write the chart described by the model to the OutputStream provided.
`void`
`write(Chart cModel, org.eclipse.emf.common.util.URI uri)`
Write the chart described by the model to the location defined by the URI provided.

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### CHART_START_MARKER

public static final String CHART_START_MARKER

See Also:
  - Constant Field Values

### CHART_END_MARKER

public static final String CHART_END_MARKER

See Also:
  - Constant Field Values

## Method Details

### instance

public static final Serializer instance()

Returns:
  A singleton instance of the chart serializer

### write

public void write(Chart cModel, OutputStream os) throws IOException
Description copied from interface: `Serializer`
Write the chart described by the model to the OutputStream provided.

Specified by:
  `write` in interface `Serializer`
Parameters:
  `cModel` - The model to be serialized os The OutputStream to which the model is to be serialized
Throws:
  `IOException`

### write

public void write(Chart cModel, org.eclipse.emf.common.util.URI uri) throws IOException
Description copied from interface: `Serializer`
Write the chart described by the model to the location defined by the URI provided.

Specified by:
  `write` in interface `Serializer`
Parameters:
  `cModel` - The model to be serialized uri The URI to which the model is to be serialized
Throws:
  `IOException`

### asXml

public ByteArrayOutputStream asXml(Chart cModel, boolean bStripHeaders) throws IOException
Description copied from interface: `Serializer`
Write the chart described by the model to a ByteArrayOutputStream.

Specified by:
  `asXml` in interface `Serializer`
Parameters:
  `cModel` - The model to be serialized bStripHeaders Specifies whether or not the headers are to be removed while serializing the model
Returns:
  the ByteArrayOutputStream containing the serialized model
Throws:
  `IOException`

### savePreferences

public void savePreferences(ChartPreferences preferences, OutputStream os) throws IOException
Description copied from interface: `Serializer`
Saves the chart preferences to the specified OutputStream.

Specified by:
  `savePreferences` in interface `Serializer`
Parameters:
  `preferences` - The ChartPreferences object to be saved
  `os` - The OutputStream to which the preferences are to be written
Throws:
  `IOException`

### read

public Chart read(InputStream is) throws IOException
Description copied from interface: `Serializer`
Reads the chart model from the given InputStream

Specified by:
  `read` in interface `Serializer`
Returns:
  chart model read from the stream
Throws:
  `IOException`

### read

public Chart read(org.eclipse.emf.common.util.URI uri) throws IOException
Description copied from interface: `Serializer`
Reads the chart model from the location defined by the URI provided.

Specified by:
  `read` in interface `Serializer`
Parameters:
  `uri` - URI of the location holding the chart model
Returns:
  chart model read from the source
Throws:
  `IOException`

### readEmbedded

public Chart readEmbedded(org.eclipse.emf.common.util.URI uri) throws IOException
Description copied from interface: `Serializer`
Reads the chart model embedded inside other XML content defined by the URI provided.

Specified by:
  `readEmbedded` in interface `Serializer`
Parameters:
  `uri` - URI of the location holding the embedded chart model
Returns:
  chart model read from the source
Throws:
  `IOException`

### fromXml

public Chart fromXml(ByteArrayInputStream byais, boolean bStripHeaders) throws IOException
Description copied from interface: `Serializer`
Reads the chart model from the ByteArrayInputStream.

Specified by:
  `fromXml` in interface `Serializer`
Parameters:
  `byais` - The ByteArrayInputStream holding the chart model
  `bStripHeaders` - Specifies whether or not the headers were removed when the chart model was saved
Returns:
  chart model read from the stream
Throws:
  `IOException`

### loadPreferences

public ChartPreferences loadPreferences(InputStream is) throws IOException
Description copied from interface: `Serializer`
Loads the chart preferences from the InputStream.

Specified by:
  `loadPreferences` in interface `Serializer`
Parameters:
  `is` - InputStream from which the chart preferences are to be read
Returns:
  ChartPreferences instance read from the stream
Throws:
  `IOException`