public class TemplateReaderWriter extends Object
Clients may instantiate this class, it is not intended to be subclassed.
Constructor and Description |
---|
TemplateReaderWriter()
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
TemplatePersistenceData[] |
read(InputStream stream,
ResourceBundle bundle)
Reads templates from a stream and adds them to the templates.
|
TemplatePersistenceData[] |
read(Reader reader)
Reads templates from a reader and returns them.
|
TemplatePersistenceData[] |
read(Reader reader,
ResourceBundle bundle)
Reads templates from a stream and adds them to the templates.
|
TemplatePersistenceData |
readSingle(Reader reader,
String id)
Reads the template with identifier
id from a reader and
returns it. |
void |
save(TemplatePersistenceData[] templates,
OutputStream stream)
Saves the templates as XML, encoded as UTF-8 onto the given byte stream.
|
void |
save(TemplatePersistenceData[] templates,
Writer writer)
Saves the templates as XML.
|
public TemplatePersistenceData[] read(Reader reader) throws IOException
save
method.reader
- the reader to read templates fromTemplatePersistenceData
IOException
- if reading from the stream failspublic TemplatePersistenceData readSingle(Reader reader, String id) throws IOException
id
from a reader and
returns it. The reader must present a serialized form as produced by the
save
method.reader
- the reader to read templates fromid
- the id of the template to returnTemplatePersistenceData
IOException
- if reading from the stream failspublic TemplatePersistenceData[] read(Reader reader, ResourceBundle bundle) throws IOException
reader
- the reader to read templates frombundle
- a resource bundle to use for translating the read templates, or null
if no translation should occurTemplatePersistenceData
IOException
- if reading from the stream failspublic TemplatePersistenceData[] read(InputStream stream, ResourceBundle bundle) throws IOException
stream
- the byte stream to read templates frombundle
- a resource bundle to use for translating the read templates, or null
if no translation should occurTemplatePersistenceData
IOException
- if reading from the stream failspublic void save(TemplatePersistenceData[] templates, OutputStream stream) throws IOException
templates
- the templates to savestream
- the byte output to write the templates to in XMLIOException
- if writing the templates failspublic void save(TemplatePersistenceData[] templates, Writer writer) throws IOException
templates
- the templates to savewriter
- the writer to write the templates to in XMLIOException
- if writing the templates fails
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.