I am reading data from a file that has, unfortunately, two types of character encoding.
There is a header and a body. The header is always in ASCII and defines the char
Here is the pseudo code.
InputStream
, but do not wrap a
Reader
around it.ByteArrayOutputStream
.ByteArrayInputStream
from
ByteArrayOutputStream
and decode
header, this time wrap ByteArrayInputStream
into Reader
with ASCII charset.ByteArrayOutputStream
.ByteArrayInputStream
from the second
ByteArrayOutputStream
and wrap it
with Reader
with charset from the
header.