Created
March 23, 2013 14:55
-
-
Save noxi515/5228003 to your computer and use it in GitHub Desktop.
BOM付きUTF-8のXMLをXmlPullParserが処理できるようにするReader
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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