1 36 package org.columba.ristretto.imap.parser; 37 38 import java.util.regex.Matcher ; 39 import java.util.regex.Pattern ; 40 41 import org.columba.ristretto.imap.CopyInfo; 42 import org.columba.ristretto.imap.IMAPResponse; 43 import org.columba.ristretto.parser.ParserException; 44 45 51 public class CopyInfoParser 52 { 53 private static final Pattern copyInfoPattern = Pattern.compile("^COPYUID ([0-9]*) ([^ ]*) ([^ ]*)"); 54 55 62 public static CopyInfo parse(IMAPResponse response) throws ParserException 63 { 64 String in = response.getResponseTextCode().getStringValue(); 65 Matcher matcher = copyInfoPattern.matcher(in); 66 if (matcher.find()) { 67 try { 68 return new CopyInfo(Long.parseLong(matcher.group(1)), SequenceSetParser.parse(matcher.group(2)), SequenceSetParser.parse(matcher.group(3))); 69 } 70 catch(Exception e) { 71 throw new ParserException(e); 72 } 73 } 74 else { 75 throw new ParserException("No COPYUID response : " + in); 76 } 77 } 78 79 } | Popular Tags |