com.github.df.restypass.util.StringBuilderFactory Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of resty-pass Show documentation
Show all versions of resty-pass Show documentation
High-Performance Restful Client Library
The newest version!
package com.github.df.restypass.util;
/**
* StringBuilder工厂类
* Created by darrenfu on 17-7-1.
*/
public class StringBuilderFactory {
public static final StringBuilderFactory DEFAULT = new StringBuilderFactory();
private final ThreadLocal pool = ThreadLocal.withInitial(() -> new StringBuilder(512));
/**
* BEWARE: MUSN'T APPEND TO ITSELF!
*
* @return a pooled StringBuilder
*/
public StringBuilder stringBuilder() {
StringBuilder sb = pool.get();
sb.setLength(0);
return sb;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy