Class ModelWriter
- java.lang.Object
-
- java.io.Writer
-
- org.springframework.extensions.surf.extensibility.impl.ModelWriter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.Appendable,java.lang.AutoCloseable
public class ModelWriter extends java.io.WriterAn extension of the
Writerclass that is used with theExtensibilityModel. Rather than writing directly to an output stream this writes toExtensibilityContentinstances in theExtensibilityModel. This allows rendered content to be removed, replaced or added to as extensions to the model are processed.- Author:
- David Draper
-
-
Constructor Summary
Constructors Constructor Description ModelWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Closes the currentExtensibilityContentinstance.voidflush()Flushes the currentExtensibilityContentinstance.ExtensibilityContentgetCurrentBufferElement()Returns the currentExtensibilityContentbeing written to.voidsetCurrentBufferElement(ExtensibilityContent bufferElement)Sets the currentExtensibilityContentto be written to.voidwrite(char[] cbuf, int off, int len)Writes to the currentExtensibilityContentinstance.voidwrite(int c)Writes to the currentExtensibilityContentinstance.voidwrite(java.lang.String str, int off, int len)Writes to the currentExtensibilityContentinstance.
-
-
-
Method Detail
-
setCurrentBufferElement
public void setCurrentBufferElement(ExtensibilityContent bufferElement)
Sets the current
ExtensibilityContentto be written to. This typically occurs when the processing of a newExtensibilityDirectivebegins.- Parameters:
bufferElement- The element to start writing to.
-
getCurrentBufferElement
public ExtensibilityContent getCurrentBufferElement()
Returns the current
ExtensibilityContentbeing written to.- Returns:
- ExtensibilityContent
-
write
public void write(char[] cbuf, int off, int len) throws java.io.IOExceptionWrites to the current
ExtensibilityContentinstance.- Specified by:
writein classjava.io.Writer- Throws:
java.io.IOException
-
flush
public void flush() throws java.io.IOExceptionFlushes the current
ExtensibilityContentinstance.- Specified by:
flushin interfacejava.io.Flushable- Specified by:
flushin classjava.io.Writer- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOExceptionCloses the current
ExtensibilityContentinstance.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(int c) throws java.io.IOExceptionWrites to the current
ExtensibilityContentinstance.- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
write
public void write(java.lang.String str, int off, int len) throws java.io.IOExceptionWrites to the current
ExtensibilityContentinstance.- Overrides:
writein classjava.io.Writer- Throws:
java.io.IOException
-
-