aboutsummaryrefslogtreecommitdiffstats
path: root/src/examples
diff options
context:
space:
mode:
Diffstat (limited to 'src/examples')
-rw-r--r--src/examples/src/org/apache/poi/hssf/usermodel/examples/InCellLists.java12
-rw-r--r--src/examples/src/org/apache/poi/hssf/view/SVFractionalFormat.java8
-rw-r--r--src/examples/src/org/apache/poi/ss/examples/ToCSV.java17
3 files changed, 18 insertions, 19 deletions
diff --git a/src/examples/src/org/apache/poi/hssf/usermodel/examples/InCellLists.java b/src/examples/src/org/apache/poi/hssf/usermodel/examples/InCellLists.java
index 315481b2e2..1b25c1bd8d 100644
--- a/src/examples/src/org/apache/poi/hssf/usermodel/examples/InCellLists.java
+++ b/src/examples/src/org/apache/poi/hssf/usermodel/examples/InCellLists.java
@@ -220,7 +220,7 @@ public class InCellLists {
buffer.append(listItem);
buffer.append("\n");
}
- // The StringBuffer's contents are the source for the contents
+ // The StringBuilder's contents are the source for the contents
// of the cell.
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim()));
cell.setCellStyle(wrapStyle);
@@ -260,7 +260,7 @@ public class InCellLists {
buffer.append("\n");
itemNumber += increment;
}
- // The StringBuffer's contents are the source for the contents
+ // The StringBuilder's contents are the source for the contents
// of the cell.
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim()));
cell.setCellStyle(wrapStyle);
@@ -292,7 +292,7 @@ public class InCellLists {
buffer.append(listItem);
buffer.append("\n");
}
- // The StringBuffer's contents are the source for the contents
+ // The StringBuilder's contents are the source for the contents
// of the cell.
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim()));
cell.setCellStyle(wrapStyle);
@@ -338,7 +338,7 @@ public class InCellLists {
}
}
}
- // The StringBuffer's contents are the source for the contents
+ // The StringBuilder's contents are the source for the contents
// of the cell.
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim()));
cell.setCellStyle(wrapStyle);
@@ -409,7 +409,7 @@ public class InCellLists {
}
highLevelItemNumber += highLevelIncrement;
}
- // The StringBuffer's contents are the source for the contents
+ // The StringBuilder's contents are the source for the contents
// of the cell.
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim()));
cell.setCellStyle(wrapStyle);
@@ -459,7 +459,7 @@ public class InCellLists {
}
}
}
- // The StringBuffer's contents are the source for the contents
+ // The StringBuilder's contents are the source for the contents
// of the cell.
cell.setCellValue(new HSSFRichTextString(buffer.toString().trim()));
cell.setCellStyle(wrapStyle);
diff --git a/src/examples/src/org/apache/poi/hssf/view/SVFractionalFormat.java b/src/examples/src/org/apache/poi/hssf/view/SVFractionalFormat.java
index 4884195880..35cedd0ce9 100644
--- a/src/examples/src/org/apache/poi/hssf/view/SVFractionalFormat.java
+++ b/src/examples/src/org/apache/poi/hssf/view/SVFractionalFormat.java
@@ -140,9 +140,9 @@ public class SVFractionalFormat extends Format {
break;
}
Precision = AllowedError / Diff;
- // This calcualtion of Precision does not always provide results within
+ // This calculation of Precision does not always provide results within
// Allowed Error. It compensates for loss of significant digits that occurs.
- // It helps to round the inprecise reciprocal values to i.
+ // It helps to round the imprecise reciprocal values to i.
B = A;
A = Num;
}
@@ -161,7 +161,7 @@ public class SVFractionalFormat extends Format {
Whole = -Whole;
}
}
- return new StringBuffer().append(Whole).append(" ").append(Num).append("/").append(Den).toString();
+ return new StringBuilder().append(Whole).append(" ").append(Num).append("/").append(Den).toString();
}
/** This method formats the double in the units specified.
@@ -173,7 +173,7 @@ public class SVFractionalFormat extends Format {
f -= Whole;
long Num = Math.round(f * units);
- return new StringBuffer().append(Whole).append(" ").append(Num).append("/").append(units).toString();
+ return new StringBuilder().append(Whole).append(" ").append(Num).append("/").append(units).toString();
}
public final String format(double val) {
diff --git a/src/examples/src/org/apache/poi/ss/examples/ToCSV.java b/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
index 8b9ca2822b..af2a1da2fb 100644
--- a/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
+++ b/src/examples/src/org/apache/poi/ss/examples/ToCSV.java
@@ -428,10 +428,9 @@ public class ToCSV {
* @throws java.io.IOException Thrown to indicate and error occurred in the
* underylying file system.
*/
- private void saveCSVFile(File file)
- throws FileNotFoundException, IOException {
+ private void saveCSVFile(File file) throws FileNotFoundException, IOException {
ArrayList<String> line;
- StringBuffer buffer;
+ StringBuilder buffer;
String csvLineElement;
// Open a writer onto the CSV file.
@@ -443,20 +442,20 @@ public class ToCSV {
// all of the data recovered from the Excel workbooks' sheets, rows
// and cells.
for(int i = 0; i < this.csvData.size(); i++) {
- buffer = new StringBuffer();
+ buffer = new StringBuilder();
// Get an element from the ArrayList that contains the data for
// the workbook. This element will itself be an ArrayList
// containing Strings and each String will hold the data recovered
// from a single cell. The for() loop is used to recover elements
// from this 'row' ArrayList one at a time and to write the Strings
- // away to a StringBuffer thus assembling a single line for inclusion
+ // away to a StringBuilder thus assembling a single line for inclusion
// in the CSV file. If a row was empty or if it was short, then
// the ArrayList that contains it's data will also be shorter than
// some of the others. Therefore, it is necessary to check within
// the for loop to ensure that the ArrayList contains data to be
// processed. If it does, then an element will be recovered and
- // appended to the StringBuffer.
+ // appended to the StringBuilder.
line = this.csvData.get(i);
for(int j = 0; j < this.maxRowWidth; j++) {
if(line.size() > j) {
@@ -572,7 +571,7 @@ public class ToCSV {
* speech mark characters correctly escaped.
*/
private String escapeEmbeddedCharacters(String field) {
- StringBuffer buffer;
+ StringBuilder buffer;
// If the fields contents should be formatted to confrom with Excel's
// convention....
@@ -584,7 +583,7 @@ public class ToCSV {
// set of speech marks. Thus, "Yes" he said would become
// """Yes"" he said"
if(field.contains("\"")) {
- buffer = new StringBuffer(field.replaceAll("\"", "\\\"\\\""));
+ buffer = new StringBuilder(field.replaceAll("\"", "\\\"\\\""));
buffer.insert(0, "\"");
buffer.append("\"");
}
@@ -592,7 +591,7 @@ public class ToCSV {
// If the field contains either embedded separator or EOL
// characters, then escape the whole field by surrounding it
// with speech marks.
- buffer = new StringBuffer(field);
+ buffer = new StringBuilder(field);
if((buffer.indexOf(this.separator)) > -1 ||
(buffer.indexOf("\n")) > -1) {
buffer.insert(0, "\"");