Class SecondaryStorageBufferWriter
java.lang.Object
java.io.Writer
com.opensymphony.module.sitemesh.util.CharArrayWriter
com.opensymphony.module.sitemesh.scalability.secondarystorage.SecondaryStorageBufferWriter
- All Implemented Interfaces:
SitemeshWriter,Closeable,Flushable,Appendable,AutoCloseable
This writer allows for secondary storage to be use If the body of the response its really large
It will ensure that everything up to the <body> tage is in memory before spilling over, so that further parsing can use memory access to find important page details. But if the page gets really large then it will spill into the secondary storage area.
This of course falls down if the <head> section was megabytes in size say but we are deliberately not catering for this situation and hence it would be worse than SiteMesh without spill over.
It will ensure that everything up to the <body> tage is in memory before spilling over, so that further parsing can use memory access to find important page details. But if the page gets really large then it will spill into the secondary storage area.
This of course falls down if the <head> section was megabytes in size say but we are deliberately not catering for this situation and hence it would be worse than SiteMesh without spill over.
-
Field Summary
Fields inherited from class com.opensymphony.module.sitemesh.util.CharArrayWriter
buf, count -
Constructor Summary
ConstructorsConstructorDescriptionSecondaryStorageBufferWriter(int initialBufferSize, SecondaryStorage secondaryStorage) SecondaryStorageBufferWriter(SecondaryStorage secondaryStorage) -
Method Summary
Modifier and TypeMethodDescriptionGet the underlying buffer for the writerBecause writer is a class and not an interface we need a way to self reference so we can pass the underlying Writer onto other Writers.voidwrite(char[] chars) Taken fromWritervoidwrite(char[] chars, int off, int len) Writes characters to the buffer.voidwrite(int c) Writes a character to the buffer.voidTaken fromWritervoidWrite a portion of a string to the buffer.booleanwriteSitemeshBufferFragment(SitemeshBufferFragment bufferFragment) Write a sitemesh buffer fragment to the writer.Methods inherited from class com.opensymphony.module.sitemesh.util.CharArrayWriter
close, flush, reset, size, toCharArray, toString, writeToMethods inherited from class java.io.Writer
append, append, append, nullWriterMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.opensymphony.module.sitemesh.SitemeshWriter
close, flush
-
Constructor Details
-
SecondaryStorageBufferWriter
-
SecondaryStorageBufferWriter
-
-
Method Details
-
getUnderlyingWriter
Description copied from interface:SitemeshWriterBecause writer is a class and not an interface we need a way to self reference so we can pass the underlying Writer onto other Writers.- Specified by:
getUnderlyingWriterin interfaceSitemeshWriter- Returns:
- a self reference to this so it can be wrapped say.
-
write
public void write(int c) Description copied from class:CharArrayWriterWrites a character to the buffer.- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classCharArrayWriter- Parameters:
c- the character to write
-
write
public void write(char[] chars, int off, int len) Description copied from class:CharArrayWriterWrites characters to the buffer.- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classCharArrayWriter- Parameters:
chars- the data to be writtenoff- the start offset in the datalen- the number of chars that are written
-
write
Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classWriter- Parameters:
chars- the characters to write- Throws:
IOException
-
write
Description copied from class:CharArrayWriterWrite a portion of a string to the buffer.- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classCharArrayWriter- Parameters:
str- String to be written fromoff- Offset from which to start reading characterslen- Number of characters to be written
-
write
Description copied from interface:SitemeshWriterTaken fromWriter- Specified by:
writein interfaceSitemeshWriter- Overrides:
writein classWriter- Parameters:
str- the characters to write- Throws:
IOException
-
writeSitemeshBufferFragment
public boolean writeSitemeshBufferFragment(SitemeshBufferFragment bufferFragment) throws IOException Description copied from interface:SitemeshWriterWrite a sitemesh buffer fragment to the writer. This may not be written immediately, it may be stored and written later, when this buffer is written out to a writer.- Specified by:
writeSitemeshBufferFragmentin interfaceSitemeshWriter- Parameters:
bufferFragment- The buffer fragment to write- Returns:
- True if the buffer was written immediately, or false if it will be written later
- Throws:
IOException- If an IOException occurred
-
getSitemeshBuffer
Description copied from interface:SitemeshWriterGet the underlying buffer for the writer- Specified by:
getSitemeshBufferin interfaceSitemeshWriter- Returns:
- The underlying buffer
-