| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.content.pm; |
| 18 |
|
| 19 |
import android.compat.annotation.UnsupportedAppUsage; |
| 20 |
import android.util.TypedXmlPullParser; |
| 21 |
import android.util.TypedXmlSerializer; |
| 22 |
|
| 23 |
import com.android.internal.util.XmlUtils; |
| 24 |
|
| 25 |
import org.xmlpull.v1.XmlPullParser; |
| 26 |
import org.xmlpull.v1.XmlPullParserException; |
| 27 |
import org.xmlpull.v1.XmlSerializer; |
| 28 |
|
| 29 |
import java.io.IOException; |
| 30 |
|
| 31 |
|
| 32 |
public interface XmlSerializerAndParser<T> { |
| 33 |
void writeAsXml(T item, TypedXmlSerializer out) throws IOException; |
| 34 |
T createFromXml(TypedXmlPullParser parser) throws IOException, XmlPullParserException; |
| 35 |
|
| 36 |
@UnsupportedAppUsage |
| 37 |
default void writeAsXml(T item, XmlSerializer out) throws IOException { |
| 38 |
writeAsXml(item, XmlUtils.makeTyped(out)); |
| 39 |
} |
| 40 |
|
| 41 |
@UnsupportedAppUsage |
| 42 |
default T createFromXml(XmlPullParser parser) throws IOException, XmlPullParserException { |
| 43 |
return createFromXml(XmlUtils.makeTyped(parser)); |
| 44 |
} |
| 45 |
} |