Code example for Matcher

Methods: groupmatches

0
        if (text.isEmpty()) {
            throw new IllegalArgumentException("empty text");
        } 
 
        Matcher m = VERSION_PATTERN.matcher(text);
        if (!m.matches()) {
            throw new IllegalArgumentException("invalid version format: " + text);
        } 
 
        protocolName = m.group(1);
        majorVersion = Integer.parseInt(m.group(2));
        minorVersion = Integer.parseInt(m.group(3));
        this.text = protocolName + '/' + majorVersion + '.' + minorVersion;
        this.keepAliveDefault = keepAliveDefault;
        bytes = null;
    } 
 
    /** 
     * Creates a new HTTP version with the specified protocol name and version 
     * numbers.  You will not need to create a new instance unless you are