return writer;
}
public static StringList readSeparatedRow( String row, char separator, char quote )
{
StringList result = new StringList();
while( row != null && row.length() > 0 )
{
if( row.startsWith( String.valueOf( quote ) ) )
{
StringBuffer buf = new StringBuffer();
char last = row.charAt( 0 );
int ix = 1;
while( ix < row.length() )
{
char ch = row.charAt( ix );
if( ch == quote && last != '\\' )
{
result.add( buf.toString() );
row = row.length() > ix + 1 ? row.substring( ix + 1 ) : null;
if( row != null && row.length() > 1 && row.charAt( 0 ) == separator )
{
row = row.substring( 1 );
ix = -1;
}
break;
}
else if( ch != '\\' || last == '\\' )
{
buf.append( ch );
}
last = ch;
ix++ ;
}
if( row != null && ix == row.length() )
{
result.add( row );
row = null;
}
}
else
{
int ix = row.indexOf( separator );
if( ix == -1 )
{
result.add( row );
row = null;
}
else
{
result.add( row.substring( 0, ix ) );
row = row.substring( ix + 1 );
}
}
}