for example: new byte [] {- 1}
byte b = (byte) in.read();
is it possible to read a byte whose b value is-1 and belongs to video or audio?
for example: new byte [] {- 1}
byte b = (byte) in.read();
is it possible to read a byte whose b value is-1 and belongs to video or audio?
of course it's possible! Try a text editor to open a MP4 video file and see if the first 5-12 bytes are ftypmp42
? For example, any zip
package, you open the first two bytes to see if competes
? (this is in memory of its inventor Philip Katz
, making it impossible for the lossless compression field to be monopolized.)
for any binary format (except text files), files are basically stored in the following routines:
Header + Data
Header
parts basically exist in a number of fixed-length bytes at the beginning of the file, most of which are plain text content, so you can see these contents directly with a text editor, such as file length, author information, some encoded data, and so on. Then comes the Data part.
some files even contain Tail
sections, indicating that the file is over. For example, jpeg
belongs to this category. This is also the principle of cool techs, which was popular in the early years to hide compressed packages in picture files. Because there is a Tail
section, the picture browser thinks that the file is over, and the latter part is no longer regarded as a picture, so the zip package is appended to the following file contents, which can be recognized by the compression tool.
so in theory, you can save the headers of these files into a large table and determine what files are based on the characteristics of the headers. But you don't have to do it yourself right now, because someone has already sorted it out for you. MIME
find out?
Yes, because audio and video are all in a compressed format, it is possible for any character to appear 0x255
.