in src/main/java/org/ini4j/spi/UnicodeInputStreamReader.java [122:154]
protected void init() throws IOException
{
if (_reader != null)
{
return;
}
Charset encoding;
byte[] data = new byte[BOM_SIZE];
int n;
int unread;
n = _stream.read(data, 0, data.length);
Bom bom = Bom.find(data);
if (bom == null)
{
encoding = _defaultEncoding;
unread = n;
}
else
{
encoding = bom._charset;
unread = data.length - bom._bytes.length;
}
if (unread > 0)
{
_stream.unread(data, (n - unread), unread);
}
_reader = new InputStreamReader(_stream, encoding);
}