For faster navigation, this Iframe is preloading the Wikiwand page for 字节流.

字节流

字节流(英语:byte stream)在电脑科学中是一种位元流,不过里面的位元被打包成一个个我们叫做字节(Bytes)的单位。

电脑网络内,位元字符串流(octet stream)有时会拿来代表同样的东西;这种措辞强调了我们的字节是8位元的字节,或者说八位元(octets)。最早字节这个词被引进的时候,本身并没有一个大小的标准;不过大多数现在的电脑字节都等同于八位元。

正式的说,一个字节流是一种特定的抽象化,一个让实体(entity)可以传输一系列的字节给处在另一端实体的一种通信频道。一般来说这种频道会是双向,不过有时有单向的。在几乎所有的状况,这里的频道都具有所谓可靠的特质;也就是,在另一端会按照正确的顺序出现应该出现的字节(现实生活中有些频道,有时会顺序错误,有时会多出或者失去一些字节)。

比较不正式的说,我们可以把它想做是两个实体之间的流水线(conduit);其中一个实体会将字节输入流水线,另一个实体则接收这些字节。这个流水线可以是短暂或者永久的。

示例

在多数的操作系统,包含类Unix系统Windows,一个行程(process)想要去获取任何文件都是一种字节流的示例。特别是每个行程都有的三个标准流(stdin, stdout, stderr),这三个字节流可视为是单向字节流的示例。UNIX里面pipe的机制常被使用于连接不同的行程,并且用来创造行程之间的字节流。

另外一个在网络传输协议里面比较有名,且会提供字节流给客户端的示例是TCP/IP通讯协议里面的传输控制协议(TCP),这种协议提供了双向的字节流。

对于任意字节流的互联网媒体型式application/octet-stream。其他媒体型式则会以公开的格式来定义他们自己的字节流。

相关条目

{{bottomLinkPreText}} {{bottomLinkText}}
字节流
Listen to this article

This browser is not supported by Wikiwand :(
Wikiwand requires a browser with modern capabilities in order to provide you with the best reading experience.
Please download and use one of the following browsers:

This article was just edited, click to reload
This article has been deleted on Wikipedia (Why?)

Back to homepage

Please click Add in the dialog above
Please click Allow in the top-left corner,
then click Install Now in the dialog
Please click Open in the download dialog,
then click Install
Please click the "Downloads" icon in the Safari toolbar, open the first download in the list,
then click Install
{{::$root.activation.text}}

Install Wikiwand

Install on Chrome Install on Firefox
Don't forget to rate us

Tell your friends about Wikiwand!

Gmail Facebook Twitter Link

Enjoying Wikiwand?

Tell your friends and spread the love:
Share on Gmail Share on Facebook Share on Twitter Share on Buffer

Our magic isn't perfect

You can help our automatic cover photo selection by reporting an unsuitable photo.

This photo is visually disturbing This photo is not a good choice

Thank you for helping!


Your input will affect cover photo selection, along with input from other users.

X

Get ready for Wikiwand 2.0 🎉! the new version arrives on September 1st! Don't want to wait?