How do we set the encoding and decoding format of byte input stream, byte output stream?
In the byte input stream (inputstream), byte output stream (OutputStream), there is no method for setting the encoding and decoding format. the API documentation for InputStream is as follows:
Since the byte input and output stream does not provide the appropriate method, let us set the encoding and decoding format.
Then we will use the conversion stream to set the encoding of the byte stream.
What is a conversion stream? through the API, it is known that the
transition stream is a bridge of bytes flowing to the character stream. It reads the bytes using the specified charset and decodes them to characters. The character set it uses can be specified or explicitly given by name, or it can accept the default character set of the platform. For example: InputStreamReader API:This is good to do, we just put the input stream "into" the conversion stream, and then assign it a character set, it will encode itself . such as: New InputStreamReader (New InputStream (), "UTF-8");New OutputStreamWriter (New OutputStream (), "UTF-8");
from for Notes (Wiz)List of attachments
- 360 Feedback 165801057571126.png
- 48de37d2-294d-46d0-a3cc-211c0e0737c2.png
Use of conversion streams (Inputstreamreader,outputstreamwriter)