aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/xml/XmlElementReader.java
blob: 108822509b3d102ca0e0d174b54c7bd3c2bf1e5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package de.pixart.messenger.xml;

import com.google.common.io.ByteSource;

import java.io.IOException;
import java.io.InputStream;

public class XmlElementReader {

    public static Element read(byte[] bytes) throws IOException {
        return read(ByteSource.wrap(bytes).openStream());
    }

    public static Element read(InputStream inputStream) throws IOException {
        final XmlReader xmlReader = new XmlReader();
        xmlReader.setInputStream(inputStream);
        return xmlReader.readElement(xmlReader.readTag());
    }
}