How is the character stream of javaIO read?

recently I was looking at the knowledge related to io and encountered some minor problems. Here are some examples to illustrate the problem:
for example:
12345 is a decimal number
found according to ASCII code is
binary 00110001 00110010 00110011 00110100 00110101
decimal 4950515253
hexadecimal 0x310x320x330x340x35
file saved as ansi code

clipboard.png

unicode:

clipboard.png

utf-8:

clipboard.png

:unicode3100 3200 3300 3400 3500ff fe
:
:ansi 31 32 33 34 35

clipboard.png

but I obviously saved it in ansi, where did I get unicode? Do you change it to unicode, when you read it, and then read it again? Can you tell me the details of the process?

Thank you, gods!

Mar.24,2021

question 1:
FFFE-> BOM-> Byte order mark byte order identification
byte order mark (English: byte-order mark,BOM) is the name of the Unicode character located at the code point U+FEFF. When a string of UCS/ Unicode characters is encoded with UTF-16 or UTF-32, this character is used to indicate its byte order. It is often used to indicate that a document is encoded in UTF-8, UTF-16, or UTF-32.

see
byte order tag

question 2:
Yes.
question 3:
set file encoding when reading, for example:

InputStream input = new FileInputStream("data/text.txt");

    try(InputStreamReader inputStreamReader =
        new InputStreamReader(input,"ISO-8859-1")){
    
        int data = inputStreamReader.read();
        while(data != -1) {
            System.out.print((char) data);
            data = inputStreamReader.read();
        }
        
    }    
Menu