0字节⽂件
Zero Byte File
综合以下两篇⽂章的总结:
1、概念:0 字节⽂件是指在电脑上⼀个⽂件 包含真正 0 个字节的⽂件。⼀般⽂件都不⼤可能是 0 字节,因为,⼀个⽂件都会拥有⼀些属性来描述这个⽂件:如⽂件名、⽂件访问的模式和⼀些扩展属性。所有的这些属性都是需要空间来存储,所以会占⼀定的字节。⼀个⽂件可能包含的内容为 0字节,但是真正本⾝的⼤⼩⼀般不可能是 0 字节。
2、产⽣的原因:可能是⼀个应⽤程序创建了⼀个⽂件,但是当往⽂件中写内容时,程序被永久地中断或者退出了。因为,这些要写的内容先是缓存在内存中的,然后通过 flush 命令刷新缓存区,将写的内容刷到⽂件中,如果程序没将写的内容 flush 到⽂件中,那么就会出现 0字节 ⽂件。
3、⽬的:有时候可以通过 0 字节 ⽂件来传递信息。我们可以使⽤⽂件名⽽不是往⽂件中写信息来传递简单的信息。例⼦在的段中有体现。
A zero byte file or zero length file is a computer file containing no data; that is, it has a length or size of zero bytes.
Zero byte files cannot be loaded or used by most applications. Even a file describing an empty word processor
document, an image file with zero by zero dimensions, or an audio file of length zero seconds usually still contains metadata identifying the file format and describing some basic attributes of the file. Some very simple file formats do not use metadata, such as ASCII text files; these may validly be zero bytes.
Zero byte files may arise in cases where a program creates a file but aborts or is interrupted prematurely while writing to it. Because writes are cached in memory and only flushed to disk at a later time (page cache), a program that does not flush its writes to disk or terminate normally may result in a zero byte file.
In some cases zero byte files may be used to convey information using file metadata (for example, its filename may contain an instruction to a user viewing a directory listing); or to ensure that a directory is nonempty, since some tools such as backup and revision control software treat empty directories differently from nonempty ones.
For example: 下⾯两个⽂件就是⽤来传递信息的(这两个⽂件均为 0 字节⽂件)
<
<
产⽣的原因:A zero byte file is a data file on a computer system, hard drive or other storage device that has an actual length of zero bytes. In many cases, a zero byte file is created because of an error — such as an interrupted network transfer, software crash or improperly written file handling routine — during the creation of a file. Other times, a zero byte file is created intentionally to send a message to a user viewing a file directory, to reserve a directory or filename to control automatic processes, or to indicate some immediate state or information to a program. There is a technical difference between a zero byte file whose file size is actually zero bytes and a file that contains no generated data, such as a document file with no textual content that still could contain metadata or other information from the program that created it. Occasionally, especially when a zero length file is created through an error, deleting a zero byte file can be very difficult because the corrupted file prevents the operating system from directly manipulating the file.
crash是什么意思⽂件的组成:Within a file system for a computer or other device, files have certain attributes — such as their name, extension and access properties — that are maintained by the operating system. The
information the file contains beyond that is stored as bytes and can be counted to determine the size of a file. Most files contain some information, because creating a file is not always a trivial task. It is possible, however, for a file to be created within an operating system so it has a name and attributes but contains no data, making it a zero byte file.
如何创建⼀个⽂件:Creating and writing information to a file on a storage device is a process that takes multiple steps to complete. In some cases, this process can be interrupted or not completed, leaving a file that does not contain any data.
One common cause of this involves caching, a procedure operating systems use to collect a large amount of data in random access memory (RAM) before activating the physical storage device to perform the more time-consuming task of physically encoding and storing the information. The cache for data is not always automatically written to a file — a function called flushing — so a file can be created and then the cache not flushed, so the data is never physically written and an empty file is left. The same concept as flushing a cache during file creation can occur when data is being transmitted over a network, such as while downloading a file from the Internet. If the data transfer is not completed, then the information might never be written to the storage drive, leaving a zero byte file behind. Other causes for a zero length file include physical errors on a disk that prevent data fro
m being written and corrupted file allocation table information that leaves zero length artifacts that are not really files.
创建 0 字节的⽬的:A zero byte file sometimes can be created intentionally. This can be done to leave a message for a user by using the name of the file as opposed to storing information inside. They also are used as placeholders to indicate that a particular process, such as installation or registration, has been performed. A zero length file also sometimes can be made by a program that intends to write information but then receives nothing to write, leaving an empty file.
转载于:my.oschina/mopidick/blog/264126

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。