Package org.thymeleaf.engine
Class ThrottledTemplateWriterOutputStreamAdapter
- java.lang.Object
-
- java.io.OutputStream
-
- org.thymeleaf.engine.ThrottledTemplateWriterOutputStreamAdapter
-
- All Implemented Interfaces:
java.io.Closeable,java.io.Flushable,java.lang.AutoCloseable,ThrottledTemplateWriter.IThrottledTemplateWriterAdapter
final class ThrottledTemplateWriterOutputStreamAdapter extends java.io.OutputStream implements ThrottledTemplateWriter.IThrottledTemplateWriterAdapter
- Since:
- 3.0.0
-
-
Field Summary
Fields Modifier and Type Field Description private TemplateFlowControllerflowControllerprivate intlimitprivate intmaxOverflowSizeprivate java.io.OutputStreamosprivate byte[]overflowprivate intoverflowGrowCountprivate intoverflowIncrementInBytesprivate intoverflowSizeprivate java.lang.StringtemplateNameprivate booleanunlimitedprivate intwrittenCount
-
Constructor Summary
Constructors Constructor Description ThrottledTemplateWriterOutputStreamAdapter(java.lang.String templateName, TemplateFlowController flowController, int overflowIncrementInBytes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidallow(int limit)voidclose()private voidensureOverflowCapacity(int len)voidflush()intgetMaxOverflowSize()intgetOverflowGrowCount()intgetWrittenCount()booleanisOverflown()booleanisStopped()private voidoverflow(byte[] bytes, int off, int len)private voidoverflow(int c)(package private) voidsetOutputStream(java.io.OutputStream os)voidwrite(byte[] bytes)voidwrite(byte[] bytes, int off, int len)voidwrite(int b)
-
-
-
Field Detail
-
templateName
private final java.lang.String templateName
-
flowController
private final TemplateFlowController flowController
-
overflowIncrementInBytes
private final int overflowIncrementInBytes
-
os
private java.io.OutputStream os
-
overflow
private byte[] overflow
-
overflowSize
private int overflowSize
-
maxOverflowSize
private int maxOverflowSize
-
overflowGrowCount
private int overflowGrowCount
-
unlimited
private boolean unlimited
-
limit
private int limit
-
writtenCount
private int writtenCount
-
-
Constructor Detail
-
ThrottledTemplateWriterOutputStreamAdapter
ThrottledTemplateWriterOutputStreamAdapter(java.lang.String templateName, TemplateFlowController flowController, int overflowIncrementInBytes)
-
-
Method Detail
-
setOutputStream
void setOutputStream(java.io.OutputStream os)
-
isOverflown
public boolean isOverflown()
- Specified by:
isOverflownin interfaceThrottledTemplateWriter.IThrottledTemplateWriterAdapter
-
isStopped
public boolean isStopped()
- Specified by:
isStoppedin interfaceThrottledTemplateWriter.IThrottledTemplateWriterAdapter
-
getWrittenCount
public int getWrittenCount()
- Specified by:
getWrittenCountin interfaceThrottledTemplateWriter.IThrottledTemplateWriterAdapter
-
getMaxOverflowSize
public int getMaxOverflowSize()
- Specified by:
getMaxOverflowSizein interfaceThrottledTemplateWriter.IThrottledTemplateWriterAdapter
-
getOverflowGrowCount
public int getOverflowGrowCount()
- Specified by:
getOverflowGrowCountin interfaceThrottledTemplateWriter.IThrottledTemplateWriterAdapter
-
allow
public void allow(int limit)
- Specified by:
allowin interfaceThrottledTemplateWriter.IThrottledTemplateWriterAdapter
-
write
public void write(int b) throws java.io.IOException- Specified by:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] bytes, int off, int len) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
write
public void write(byte[] bytes) throws java.io.IOException- Overrides:
writein classjava.io.OutputStream- Throws:
java.io.IOException
-
overflow
private void overflow(int c)
-
overflow
private void overflow(byte[] bytes, int off, int len)
-
ensureOverflowCapacity
private void ensureOverflowCapacity(int len)
-
flush
public void flush() throws java.io.IOException- Specified by:
flushin interfacejava.io.Flushable- Overrides:
flushin classjava.io.OutputStream- Throws:
java.io.IOException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classjava.io.OutputStream- Throws:
java.io.IOException
-
-