Home | History | Annotate | Download | only in adapter
      1 package com.android.exchange.adapter;
      2 
      3 import java.io.IOException;
      4 import java.io.InputStream;
      5 
      6 public class SendMailParser extends Parser {
      7     private final int mStartTag;
      8     private int mStatus;
      9 
     10     public SendMailParser(final InputStream in, final int startTag) throws IOException {
     11         super(in);
     12         mStartTag = startTag;
     13     }
     14 
     15     public int getStatus() {
     16         return mStatus;
     17     }
     18 
     19     /**
     20      * The only useful info in the SendMail response is the status; we capture and save it
     21      */
     22     @Override
     23     public boolean parse() throws IOException {
     24         if (nextTag(START_DOCUMENT) != mStartTag) {
     25             throw new IOException();
     26         }
     27         while (nextTag(START_DOCUMENT) != END_DOCUMENT) {
     28             if (tag == Tags.COMPOSE_STATUS) {
     29                 mStatus = getValueInt();
     30             } else {
     31                 skipTag();
     32             }
     33         }
     34         return true;
     35     }
     36 }
     37