Reading Strings and Binary from the same FileInputStream

前端 未结 7 2047
离开以前
离开以前 2021-01-17 22:29

I have a file that contains some amount of plain text at the start followed by binary content at the end. The size of the binary content is determined by some one of the pla

7条回答
  •  孤独总比滥情好
    2021-01-17 22:48

    I recommend using DataInputStream. You have the following options:

    • Read both text and binary content with DataInputStream
    • Open a BufferedReader, read text and close the stream. Then open a DataInputStream, skip bytes equal to the size of the text and read binary data.

提交回复
热议问题