类 SoftReferenceWriter
java.lang.Object
java.io.Writer
org.beetl.core.io.NoLockStringWriter
org.beetl.core.io.SoftReferenceWriter
- 所有已实现的接口:
Closeable,Flushable,Appendable,AutoCloseable
一个缓存Writer,降低内存每次分配和扩展,能较大程度提高性能。 使用风险是如果toString或者close方法没有被调用,
则渲染内容会被保存,因此需要调用toString或者close
try(SoftReferenceWriter sw = SoftReferenceWriter.local()){
template.renderTo(sw);
return sw.toString();
}
- 另请参阅:
-
字段概要
字段从类继承的字段 org.beetl.core.io.NoLockStringWriter
buf, pos -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明protected voidvoidclose()static SoftReferenceWriterlocal()static SoftReferenceWriterlocal(int size) toString()从类继承的方法 org.beetl.core.io.NoLockStringWriter
flush, write, write
-
字段详细资料
-
INIT_SIZE
public static int INIT_SIZE -
MAX_SIZE
public static int MAX_SIZE
-
-
构造器详细资料
-
SoftReferenceWriter
public SoftReferenceWriter(int size, int max)
-
-
方法详细资料
-
local
-
local
-
toString
- 覆盖:
toString在类中NoLockStringWriter
-
close
public void close()- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 覆盖:
close在类中NoLockStringWriter
-
clearCache
protected void clearCache()
-