1 30 31 32 package org.hsqldb.rowio; 33 34 import org.hsqldb.lib.StringConverter; 35 36 44 public class RowOutputTextQuoted extends RowOutputText { 45 46 public RowOutputTextQuoted(String fieldSep, String varSep, 47 String longvarSep, boolean allQuoted, 48 String encoding) { 49 super(fieldSep, varSep, longvarSep, allQuoted, encoding); 50 } 51 52 protected String checkConvertString(String s, String sep) { 53 54 if (allQuoted || s.length() == 0 || s.indexOf('\"') != -1 55 || (sep.length() > 0 && s.indexOf(sep) != -1) 56 || hasUnprintable(s)) { 57 s = StringConverter.toQuotedString(s, '\"', true); 58 } 59 60 return s; 61 } 62 63 private boolean hasUnprintable(String s) { 64 65 for (int i = 0, len = s.length(); i < len; i++) { 66 if (Character.isISOControl(s.charAt(i))) { 67 return true; 68 } 69 } 70 71 return false; 72 } 73 } 74 | Popular Tags |