[jOOQ/jOOQ#9584] Add Source.readString()
This commit is contained in:
parent
cdc48737b2
commit
dfe0464c43
@ -46,7 +46,6 @@ import static org.jooq.util.xml.jaxb.TableConstraintType.PRIMARY_KEY;
|
||||
import static org.jooq.util.xml.jaxb.TableConstraintType.UNIQUE;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.Reader;
|
||||
import java.io.StringReader;
|
||||
@ -162,7 +161,7 @@ public class XMLDatabase extends AbstractDatabase {
|
||||
if (StringUtils.isBlank(xsl)) {
|
||||
|
||||
// [#7414] Default to reading UTF-8
|
||||
content = string(reader = source.reader());
|
||||
content = source.readString();
|
||||
|
||||
// [#7414] Alternatively, read the encoding from the XML file
|
||||
try {
|
||||
@ -221,17 +220,6 @@ public class XMLDatabase extends AbstractDatabase {
|
||||
|
||||
info = MiniJAXB.append(info, MiniJAXB.unmarshal(content, InformationSchema.class));
|
||||
}
|
||||
|
||||
private String string(Reader reader) throws IOException {
|
||||
StringWriter writer = new StringWriter();
|
||||
int read;
|
||||
char[] buffer = new char[16384];
|
||||
|
||||
while ((read = reader.read(buffer, 0, buffer.length)) != -1)
|
||||
writer.write(buffer, 0, read);
|
||||
|
||||
return writer.toString();
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (Exception e) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user