Code example for CharArrayBuffer

Methods: indexOf, substringTrimmed, toString

0
 
        super(); 
        if (buffer == null) {
            throw new IllegalArgumentException
                ("Char array buffer may not be null"); 
        } 
        int colon = buffer.indexOf(':');
        if (colon == -1) {
            throw new ParseException
                ("Invalid header: " + buffer.toString());
        } 
        String s = buffer.substringTrimmed(0, colon);
        if (s.length() == 0) {
            throw new ParseException
                ("Invalid header: " + buffer.toString());
        } 
        this.buffer = buffer;
        this.name = s;
        this.valuePos = colon + 1;
    }