int readEscape()

in src/main/java/org/apache/commons/csv/Lexer.java [480:510]


    int readEscape() throws IOException {
        // the escape char has just been read (normally a backslash)
        final int ch = reader.read();
        switch (ch) {
        case 'r':
            return Constants.CR;
        case 'n':
            return Constants.LF;
        case 't':
            return Constants.TAB;
        case 'b':
            return Constants.BACKSPACE;
        case 'f':
            return Constants.FF;
        case Constants.CR:
        case Constants.LF:
        case Constants.FF: // TODO is this correct?
        case Constants.TAB: // TODO is this correct? Do tabs need to be escaped?
        case Constants.BACKSPACE: // TODO is this correct?
            return ch;
        case EOF:
            throw new CSVException("EOF while processing escape sequence");
        default:
            // Now check for meta-characters
            if (isMetaChar(ch)) {
                return ch;
            }
            // indicate unexpected char - available from in.getLastChar()
            return EOF;
        }
    }