提交 f4c0955b authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Remove SysProperties.FILE_ENCODING

上级 de433a49
...@@ -41,14 +41,6 @@ public class SysProperties { ...@@ -41,14 +41,6 @@ public class SysProperties {
*/ */
public static final String H2_BROWSER = "h2.browser"; public static final String H2_BROWSER = "h2.browser";
/**
* System property <code>file.encoding</code> (default: Cp1252).<br />
* It is usually set by the system and is the default encoding used for the
* RunScript and CSV tool.
*/
public static final String FILE_ENCODING =
Utils.getProperty("file.encoding", "Cp1252");
/** /**
* System property <code>file.separator</code> (default: /).<br /> * System property <code>file.separator</code> (default: /).<br />
* It is usually set by the system, and used to build absolute file names. * It is usually set by the system, and used to build absolute file names.
......
...@@ -44,7 +44,7 @@ public class Csv implements SimpleRowSource { ...@@ -44,7 +44,7 @@ public class Csv implements SimpleRowSource {
private String[] columnNames; private String[] columnNames;
private String characterSet = SysProperties.FILE_ENCODING; private String characterSet;
private char escapeCharacter = '\"'; private char escapeCharacter = '\"';
private char fieldDelimiter = '\"'; private char fieldDelimiter = '\"';
private char fieldSeparatorRead = ','; private char fieldSeparatorRead = ',';
...@@ -136,7 +136,6 @@ public class Csv implements SimpleRowSource { ...@@ -136,7 +136,6 @@ public class Csv implements SimpleRowSource {
* @param rs the result set - the result set must be positioned before the * @param rs the result set - the result set must be positioned before the
* first row. * first row.
* @param charset the charset or null to use the system default charset * @param charset the charset or null to use the system default charset
* (see system property file.encoding)
* @return the number of rows written * @return the number of rows written
*/ */
public int write(String outputFileName, ResultSet rs, String charset) public int write(String outputFileName, ResultSet rs, String charset)
...@@ -184,7 +183,6 @@ public class Csv implements SimpleRowSource { ...@@ -184,7 +183,6 @@ public class Csv implements SimpleRowSource {
* @param colNames or null if the column names should be read from the CSV * @param colNames or null if the column names should be read from the CSV
* file * file
* @param charset the charset or null to use the system default charset * @param charset the charset or null to use the system default charset
* (see system property file.encoding)
* @return the result set * @return the result set
*/ */
public ResultSet read(String inputFileName, String[] colNames, public ResultSet read(String inputFileName, String[] colNames,
...@@ -246,17 +244,16 @@ public class Csv implements SimpleRowSource { ...@@ -246,17 +244,16 @@ public class Csv implements SimpleRowSource {
private void init(String newFileName, String charset) { private void init(String newFileName, String charset) {
this.fileName = newFileName; this.fileName = newFileName;
if (charset != null) {
this.characterSet = charset; this.characterSet = charset;
} }
}
private void initWrite() throws IOException { private void initWrite() throws IOException {
if (output == null) { if (output == null) {
try { try {
OutputStream out = FileUtils.newOutputStream(fileName, false); OutputStream out = FileUtils.newOutputStream(fileName, false);
out = new BufferedOutputStream(out, Constants.IO_BUFFER_SIZE); out = new BufferedOutputStream(out, Constants.IO_BUFFER_SIZE);
output = new BufferedWriter(new OutputStreamWriter(out, characterSet)); output = new BufferedWriter(characterSet != null ?
new OutputStreamWriter(out, characterSet) : new OutputStreamWriter(out));
} catch (Exception e) { } catch (Exception e) {
close(); close();
throw DbException.convertToIOException(e); throw DbException.convertToIOException(e);
...@@ -314,7 +311,7 @@ public class Csv implements SimpleRowSource { ...@@ -314,7 +311,7 @@ public class Csv implements SimpleRowSource {
try { try {
InputStream in = FileUtils.newInputStream(fileName); InputStream in = FileUtils.newInputStream(fileName);
in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE); in = new BufferedInputStream(in, Constants.IO_BUFFER_SIZE);
input = new InputStreamReader(in, characterSet); input = characterSet != null ? new InputStreamReader(in, characterSet) : new InputStreamReader(in);
} catch (IOException e) { } catch (IOException e) {
close(); close();
throw e; throw e;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论