1 36 package org.columba.ristretto.pop3.parser; 37 38 import java.util.regex.Matcher ; 39 import java.util.regex.Pattern ; 40 41 import org.columba.ristretto.parser.ParserException; 42 import org.columba.ristretto.pop3.ScanListEntry; 43 44 50 public class ScanListParser { 51 52 private static final Pattern scanlistPattern = Pattern.compile("(\\d+) (\\d+)"); 53 54 61 public static ScanListEntry parse(CharSequence input ) throws ParserException { 62 Matcher matcher = scanlistPattern.matcher(input); 63 64 if( matcher.find()) { 65 return new ScanListEntry( Integer.parseInt(matcher.group(1)), Integer.parseInt(matcher.group(2))); 66 } 67 68 throw new ParserException( "Invalid Scanlist : "+input); 69 } 70 71 } 72 | Popular Tags |