public final static int readUntil ( final StringBuilder out , final String in , final int start , final char end ) { int pos = start ; while ( pos < in . length ( ) ) { final char ch = in . charAt ( pos ) ; if ( ch == ' ' && pos + 1 < in . length ( ) ) { pos = escape ( out , in . charAt ( pos + 1 ) , pos ) ; } else { if ( ch == end ) { break ; } out . append ( ch ) ; } pos ++ ; } return ( pos == in . length ( ) ) ? - 1 : pos ; }
Reads characters until the end character is encountered .