1package im.conversations.android.xml;
2
3import com.google.common.io.ByteSource;
4import eu.siacs.conversations.xml.Element;
5import eu.siacs.conversations.xml.XmlReader;
6import java.io.IOException;
7import java.io.InputStream;
8
9public class XmlElementReader {
10
11 public static Element read(byte[] bytes) throws IOException {
12 return read(ByteSource.wrap(bytes).openStream());
13 }
14
15 public static Element read(final InputStream inputStream) throws IOException {
16 try (final XmlReader xmlReader = new XmlReader()) {
17 xmlReader.setInputStream(inputStream);
18 return xmlReader.readElement(xmlReader.readTag());
19 }
20 }
21}