Java converts the effective length in byte into string instance code
•
Java
Generally, we use byte to receive the read data. If the data does not reach the size defined by byte, we will directly convert byte to string, which will cause garbled code. In this case, we should convert byte based on the return value of read, otherwise garbled code will occur,
Here is a simple example:
Output results
The above example code of Java converting the effective length in byte into string is all that Xiaobian has shared with you. I hope it can give you a reference and support more programming tips.
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码