Package org.eclipse.text.templates
Class TemplateReaderWriter
java.lang.Object
org.eclipse.text.templates.TemplateReaderWriter
- Direct Known Subclasses:
- TemplateReaderWriter
Serializes templates as character or byte stream and reads the same format
 back.
 
Clients may instantiate this class, it is not intended to be subclassed.
- Since:
- 3.7
- Restriction:
- This class is not intended to be subclassed by clients.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionread(InputStream stream, ResourceBundle bundle) Reads templates from a stream and adds them to the templates.Reads templates from a reader and returns them.read(Reader reader, ResourceBundle bundle) Reads templates from a stream and adds them to the templates.readSingle(Reader reader, String id) Reads the template with identifieridfrom a reader and returns it.voidsave(TemplatePersistenceData[] templates, OutputStream stream) Saves the templates as XML, encoded as UTF-8 onto the given byte stream.voidsave(TemplatePersistenceData[] templates, Writer writer) Saves the templates as XML.
- 
Constructor Details- 
TemplateReaderWriterpublic TemplateReaderWriter()Create a new instance.
 
- 
- 
Method Details- 
readReads templates from a reader and returns them. The reader must present a serialized form as produced by thesavemethod.- Parameters:
- reader- the reader to read templates from
- Returns:
- the read templates, encapsulated in instances of TemplatePersistenceData
- Throws:
- IOException- if reading from the stream fails
 
- 
readSingleReads the template with identifieridfrom a reader and returns it. The reader must present a serialized form as produced by thesavemethod.- Parameters:
- reader- the reader to read templates from
- id- the id of the template to return
- Returns:
- the read template, encapsulated in an instances of
         TemplatePersistenceData
- Throws:
- IOException- if reading from the stream fails
- Since:
- 3.1
 
- 
readReads templates from a stream and adds them to the templates.- Parameters:
- reader- the reader to read templates from
- bundle- a resource bundle to use for translating the read templates, or- nullif no translation should occur
- Returns:
- the read templates, encapsulated in instances of TemplatePersistenceData
- Throws:
- IOException- if reading from the stream fails
 
- 
readReads templates from a stream and adds them to the templates.- Parameters:
- stream- the byte stream to read templates from
- bundle- a resource bundle to use for translating the read templates, or- nullif no translation should occur
- Returns:
- the read templates, encapsulated in instances of TemplatePersistenceData
- Throws:
- IOException- if reading from the stream fails
 
- 
saveSaves the templates as XML, encoded as UTF-8 onto the given byte stream.- Parameters:
- templates- the templates to save
- stream- the byte output to write the templates to in XML
- Throws:
- IOException- if writing the templates fails
 
- 
saveSaves the templates as XML.- Parameters:
- templates- the templates to save
- writer- the writer to write the templates to in XML
- Throws:
- IOException- if writing the templates fails
 
 
-