1 // Copyright 2009 The Android Open Source Project 2 3 package com.google.wireless.gdata2.parser.xml; 4 5 import com.google.wireless.gdata2.data.MediaEntry; 6 import com.google.wireless.gdata2.data.Entry; 7 import com.google.wireless.gdata2.data.Feed; 8 import com.google.wireless.gdata2.parser.ParseException; 9 10 import org.xmlpull.v1.XmlPullParser; 11 12 import java.io.InputStream; 13 14 /** 15 * GDataParser for a MediaEntry. This must only be used to parse an entry, not a feed, since 16 * there is no such thing as a feed of media entries. 17 */ 18 public class XmlMediaEntryGDataParser extends XmlGDataParser { 19 /** 20 * Creates a new XmlMediaEntryGDataParser. 21 * @param is The InputStream that should be parsed. 22 * @param parser the XmlPullParser to use for the xml parsing 23 * @throws com.google.wireless.gdata2.parser.ParseException Thrown if a parser cannot be created. 24 */ XmlMediaEntryGDataParser(InputStream is, XmlPullParser parser)25 public XmlMediaEntryGDataParser(InputStream is, XmlPullParser parser) throws ParseException { 26 super(is, parser); 27 } 28 29 /* 30 * (non-Javadoc) 31 * @see com.google.wireless.gdata2.parser.xml.XmlGDataParser#createFeed() 32 */ createFeed()33 protected Feed createFeed() { 34 throw new IllegalStateException("there is no such thing as a feed of media entries"); 35 } 36 37 /* 38 * (non-Javadoc) 39 * @see com.google.wireless.gdata2.parser.xml.XmlGDataParser#createEntry() 40 */ createEntry()41 protected Entry createEntry() { 42 return new MediaEntry(); 43 } 44 } 45