Search in sources :

Example 6 with TextColumn

use of org.teiid.query.sql.lang.TextTable.TextColumn in project teiid by teiid.

the class TextTableNode method parseFixedWidth.

private List<String> parseFixedWidth(StringBuilder line) {
    ArrayList<String> result = new ArrayList<String>();
    int beginIndex = 0;
    for (TextColumn col : table.getColumns()) {
        if (beginIndex >= line.length()) {
            result.add(null);
        } else {
            String val = new String(line.substring(beginIndex, Math.min(line.length(), beginIndex + col.getWidth())));
            addValue(result, col.isNoTrim(), val);
            beginIndex += col.getWidth();
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) TextColumn(org.teiid.query.sql.lang.TextTable.TextColumn)

Aggregations

TextColumn (org.teiid.query.sql.lang.TextTable.TextColumn)6 ArrayList (java.util.ArrayList)4 TeiidProcessingException (org.teiid.core.TeiidProcessingException)2 List (java.util.List)1 Test (org.junit.Test)1 TeiidRuntimeException (org.teiid.core.TeiidRuntimeException)1 TransformationException (org.teiid.core.types.TransformationException)1 LanguageObject (org.teiid.query.sql.LanguageObject)1 Expression (org.teiid.query.sql.symbol.Expression)1