DataInputStream Readutf and Readfully

xiaoxiao2021-03-06  14

Today, when you read the data from the file from the file, you will try to use the Readutf and ReadFully functions. the reason:

ReadUTF () requires the first two bytes of the stream to provide the UTF byte size, and the file used by NOTEPAD conversation, its format is the top three is Magic Code: EF BB BF, the next is the UTF byte code, resulting in reading Request failed: (ReadFully (byte [] b) requires the same length of byte length as byte [], because this method is not feasible because it is not presented with the length of the file (maybe it?) Call read (Byte [] B) and save the read bytes to new byte [] until it is read again and UTF8 conversion.

转载请注明原文地址:https://www.9cbs.com/read-50043.html

New Post(0)