InputStreamReader buffering issue

后端 未结 6 890
感情败类
感情败类 2021-02-05 21:18

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

6条回答
  •  孤独总比滥情好
    2021-02-05 21:46

    My first thought is to close the stream and reopen it, using InputStream#skip to skip past the header before giving the stream to the new InputStreamReader.

    If you really, really don't want to reopen the file, you could use file descriptors to get more than one stream to the file, although you may have to use channels to have multiple positions within the file (since you can't assume you can reset the position with reset, it may not be supported).

提交回复
热议问题