mirror of https://github.com/apache/poi.git
use StandardCharsets
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1818629 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
819eac1f82
commit
537badf156
|
@ -22,6 +22,7 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
@ -64,14 +65,7 @@ final class FunctionMetadataReader {
|
|||
}
|
||||
|
||||
try {
|
||||
BufferedReader br;
|
||||
try {
|
||||
br = new BufferedReader(new InputStreamReader(is,"UTF-8"));
|
||||
} catch(UnsupportedEncodingException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
try {
|
||||
try(BufferedReader br = new BufferedReader(new InputStreamReader(is, StandardCharsets.UTF_8))) {
|
||||
FunctionDataBuilder fdb = new FunctionDataBuilder(400);
|
||||
|
||||
while (true) {
|
||||
|
@ -90,8 +84,6 @@ final class FunctionMetadataReader {
|
|||
}
|
||||
|
||||
return fdb.build();
|
||||
} finally {
|
||||
br.close();
|
||||
}
|
||||
} finally {
|
||||
is.close();
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStream;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
@ -394,8 +395,8 @@ public class SXSSFWorkbook implements Workbook {
|
|||
}
|
||||
|
||||
private static void copyStreamAndInjectWorksheet(InputStream in, OutputStream out, InputStream worksheetData) throws IOException {
|
||||
InputStreamReader inReader=new InputStreamReader(in,"UTF-8");
|
||||
OutputStreamWriter outWriter=new OutputStreamWriter(out,"UTF-8");
|
||||
InputStreamReader inReader = new InputStreamReader(in, StandardCharsets.UTF_8);
|
||||
OutputStreamWriter outWriter = new OutputStreamWriter(out, StandardCharsets.UTF_8);
|
||||
boolean needsStartTag = true;
|
||||
int c;
|
||||
int pos=0;
|
||||
|
|
|
@ -345,7 +345,7 @@ public final class TestOldExcelExtractor {
|
|||
} finally {
|
||||
out.close();
|
||||
}
|
||||
String string = new String(out.toByteArray(), "UTF-8");
|
||||
String string = out.toString("UTF-8");
|
||||
assertTrue("Had: " + string,
|
||||
string.contains("Table C-13--Lemons"));
|
||||
} finally {
|
||||
|
|
Loading…
Reference in New Issue