1 16 package scriptella.driver.text; 17 18 import scriptella.spi.AbstractConnection; 19 import scriptella.spi.ConnectionParameters; 20 import scriptella.spi.DialectIdentifier; 21 22 import java.net.URL ; 23 24 30 public abstract class AbstractTextConnection extends AbstractConnection { 31 protected final String encoding; 32 protected final boolean trim; 33 protected final URL url; 34 protected final String eol; 35 39 public static final String ENCODING = "encoding"; 40 44 public static final String EOL = "eol"; 45 46 51 public static final String TRIM = "trim"; 52 53 56 protected AbstractTextConnection() { 57 encoding = null; 58 trim = false; 59 url = null; 60 eol = "\n"; 61 } 62 63 69 protected AbstractTextConnection(DialectIdentifier dialectIdentifier, ConnectionParameters parameters) { 70 super(dialectIdentifier, parameters); 71 url = parameters.getResolvedUrl(); 72 encoding = parameters.getCharsetProperty(ENCODING); 73 trim = parameters.getBooleanProperty("trim", true); 74 String eolStr = parameters.getStringProperty(TextConnection.EOL); 75 if (eolStr != null && eolStr.length() > 0) { 76 eol = eolStr; 77 } else { 78 eol = "\n"; } 80 81 } 82 83 public String getEncoding() { 84 return encoding; 85 } 86 87 public boolean isTrim() { 88 return trim; 89 } 90 91 public URL getUrl() { 92 return url; 93 } 94 95 public String getEol() { 96 return eol; 97 } 98 99 } 100 | Popular Tags |