Skip to content

Instantly share code, notes, and snippets.

@noxi515
Created March 23, 2013 14:55
Show Gist options
  • Save noxi515/5228003 to your computer and use it in GitHub Desktop.
Save noxi515/5228003 to your computer and use it in GitHub Desktop.
BOM付きUTF-8のXMLをXmlPullParserが処理できるようにするReader
class XmlReader extends BufferedReader {
public XmlReader(Reader in) throws IOException {
this(in, 8192);
}
public XmlReader(Reader in, int size) throws IOException {
super(in, size);
mark(size);
// Check BOM
char c = (char) read();
if (c == '\ufeff') {
mark(size);
} else {
reset();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment