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.UidListEntry; 43 44 50 public class UIDListParser 51 { 52 private static final Pattern uidPattern = Pattern.compile("(\\d+) ([^\r\n]+)\r?\n?"); 53 54 55 62 public static UidListEntry parse( CharSequence in ) throws ParserException { 63 Matcher matcher = uidPattern.matcher(in); 64 if( matcher.find() ) { 65 return new UidListEntry(Integer.parseInt(matcher.group(1)), matcher.group(2)); 66 } 67 68 throw new ParserException( "Could not parse UIDL: "+ in); 69 } 70 71 72 73 74 75 } 76 77 78 79 | Popular Tags |