replace more StringBuffers

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1870121 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
PJ Fanning 2019-11-21 22:01:20 +00:00
parent 2d6b1800dc
commit 701b67c315
14 changed files with 19 additions and 31 deletions

View File

@ -108,7 +108,7 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
*/
protected String sectionsToString(final List<Section> sections)
{
final StringBuffer b = new StringBuffer();
final StringBuilder b = new StringBuilder();
int count = 1;
for (Iterator<Section> i = sections.iterator(); i.hasNext();)
{
@ -129,7 +129,7 @@ public class PropertySetDescriptorRenderer extends DocumentDescriptorRenderer
*/
protected String toString(final Section s, final String name)
{
final StringBuffer b = new StringBuffer();
final StringBuilder b = new StringBuilder();
b.append("\n" + name + " Format ID: ");
b.append(HexDump.toHex(s.getFormatID().getBytes()));
b.append("\n" + name + " Offset: " + s.getOffset());

View File

@ -162,7 +162,7 @@ public class EventBasedExcelExtractor extends POIOLE2TextExtractor implements or
private SSTRecord sstRecord;
private final List<String> sheetNames;
final StringBuffer _text = new StringBuffer();
final StringBuilder _text = new StringBuilder();
private int sheetNum = -1;
private int rowNum;

View File

@ -553,7 +553,7 @@ public final class InternalSheet {
{
log.log(POILogger.DEBUG, "Sheet.setDimensions");
log.log(POILogger.DEBUG,
(new StringBuffer("firstrow")).append(firstrow)
(new StringBuilder("firstrow")).append(firstrow)
.append("firstcol").append(firstcol).append("lastrow")
.append(lastrow).append("lastcol").append(lastcol)
.toString());

View File

@ -90,7 +90,7 @@ public final class MergeCellsRecord extends StandardRecord implements Cloneable
@Override
public String toString() {
StringBuffer retval = new StringBuffer();
StringBuilder retval = new StringBuilder();
retval.append("[MERGEDCELLS]").append("\n");
retval.append(" .numregions =").append(getNumAreas()).append("\n");

View File

@ -52,7 +52,7 @@ public final class PageItemRecord extends StandardRecord {
out.writeShort(_idObj);
}
public void appendDebugInfo(StringBuffer sb) {
public void appendDebugInfo(StringBuilder sb) {
sb.append('(');
sb.append( "isxvi=").append(HexDump.shortToHex(_isxvi));
sb.append(" isxvd=").append(HexDump.shortToHex(_isxvd));
@ -97,7 +97,7 @@ public final class PageItemRecord extends StandardRecord {
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
StringBuilder sb = new StringBuilder();
sb.append("[SXPI]\n");
for (int i = 0; i < _fieldInfos.length; i++) {

View File

@ -156,7 +156,7 @@ public class FontDetails
{
if(max != -1 && i == listSize - 1)
{
StringBuffer buf = new StringBuffer((text.length() * (listSize - i)) / listSize);
StringBuilder buf = new StringBuilder((text.length() * (listSize - i)) / listSize);
while(tok.hasMoreTokens())
{
buf.append(tok.nextToken());

View File

@ -40,7 +40,7 @@ final class CellEvaluationFrame {
}
public String toString() {
StringBuffer sb = new StringBuffer(64);
StringBuilder sb = new StringBuilder(64);
sb.append(getClass().getName()).append(" [");
sb.append("]");
return sb.toString();

View File

@ -158,7 +158,7 @@ final class FormulaUsedBlankCellSet {
}
@Override
public String toString() {
StringBuffer sb = new StringBuffer(64);
StringBuilder sb = new StringBuilder(64);
CellReference crA = new CellReference(_firstRowIndex, _firstColumnIndex, false, false);
CellReference crB = new CellReference(_lastRowIndex, _lastColumnIndex, false, false);
sb.append(getClass().getName());

View File

@ -71,7 +71,7 @@ public class ErrorConstant {
}
public String toString() {
StringBuffer sb = new StringBuffer(64);
StringBuilder sb = new StringBuilder(64);
sb.append(getClass().getName()).append(" [");
sb.append(getText());
sb.append("]");

View File

@ -55,7 +55,7 @@ public class HexRead {
*/
public static byte[] readData(InputStream stream, String section ) throws IOException {
try {
StringBuffer sectionText = new StringBuffer();
StringBuilder sectionText = new StringBuilder();
boolean inSection = false;
int c = stream.read();
while ( c != -1 ) {
@ -66,12 +66,12 @@ public class HexRead {
case '\n':
case '\r':
inSection = false;
sectionText = new StringBuffer();
sectionText = new StringBuilder();
break;
case ']':
inSection = false;
if ( sectionText.toString().equals( section ) ) return readData( stream, '[' );
sectionText = new StringBuffer();
sectionText = new StringBuilder();
break;
default:
if ( inSection ) sectionText.append( (char) c );

View File

@ -61,7 +61,7 @@ public final class PublisherTextExtractor extends POIOLE2TextExtractor {
public String getText() {
StringBuffer text = new StringBuffer();
StringBuilder text = new StringBuilder();
// Get the text from the Quill Contents
QCBit[] bits = doc.getQuillContents().getBits();

View File

@ -369,13 +369,11 @@ public final class StyleTextPropAtom extends RecordAtom {
/**
* Dump the record content into <code>StringBuffer</code>
*
* @return the string representation of the record data
*/
@Override
public String toString(){
StringBuffer out = new StringBuffer();
StringBuilder out = new StringBuilder();
out.append("StyleTextPropAtom:\n");
if (!initialised) {

View File

@ -359,16 +359,6 @@ public final class TestBugs extends BaseTestBugzillaIssues {
assertEquals(a.getRichStringCellValue().getString(), b.getRichStringCellValue().getString());
}
/*private static String unicodeString(HSSFCell cell) {
String ss = cell.getRichStringCellValue().getString();
char s[] = ss.toCharArray();
StringBuffer sb = new StringBuffer();
for (int x=0;x<s.length;x++) {
sb.append("\\u").append(Integer.toHexString(s[x]));
}
return sb.toString();
}*/
/**
* Error in opening wb
*/

View File

@ -111,7 +111,7 @@ public final class ExcelFileFormatDocFunctionExtractor {
_isVolatile = isVolatile;
}
private static String convertSpecialChars(String ss) {
StringBuffer sb = new StringBuffer(ss.length() + 4);
StringBuilder sb = new StringBuilder(ss.length() + 4);
for(int i=0; i<ss.length(); i++) {
char c = ss.charAt(i);
if (isSimpleAscii(c)) {
@ -256,7 +256,7 @@ public final class ExcelFileFormatDocFunctionExtractor {
private boolean _isInsideTable;
private final List<String> _rowData;
private final StringBuffer _textNodeBuffer;
private final StringBuilder _textNodeBuffer;
private final List<Boolean> _rowNoteFlags;
private boolean _cellHasNote;
@ -268,7 +268,7 @@ public final class ExcelFileFormatDocFunctionExtractor {
_elemNameStack = new Stack<>();
_isInsideTable = false;
_rowData = new ArrayList<>();
_textNodeBuffer = new StringBuffer();
_textNodeBuffer = new StringBuilder();
_rowNoteFlags = new ArrayList<>();
}