文本文件、图片、声音文件和视频文件都是以字节流的形式存储/传输的吗?

发布于 2024-10-09 11:03:29 字数 20 浏览 3 评论 0原文

还有什么可以表示为字节流?

What else are represented as stream of bytes?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

毅然前行 2024-10-16 11:03:29

在一定的抽象级别上,几乎所有内容都以字节序列或字节流的形式存储、表示或传输。

好的,什么可以作为 .NET 中的 System.IO.Stream 对象或 Java 中的对应对象来存储/传输?

任何可以由计算机表示的信息(理论上)都可以转换为字节序列并通过面向字节的 I/O 流存储/传输。您可能需要编写一些软件来将信息的计算机表示形式转换为适合通过字节流传输的字节序列。然而,任何有限表示都可以转换为字节。

唯一不能以字节流表示和传输的东西是那些只有无限表示的东西(例如 Pi 的完整值,或所有素数的集合),以及那些没有数字表示的东西(例如 Beauty 或 Barack)奥巴马)。


好的,什么可以作为 .NET 中的 System.IO.Stream 对象或 Java 中的对应对象来存储/传输?

我不知道 .NET 的情况,但 Java 的 ObjectOutputStream 仅适用于实现 SerializedExternalized 接口的类。 (在前一种情况下,原始对象的非瞬态闭包中的所有其他类也必须实现 Serialized。)

某些系统类不是 Serializable;例如,Thread、Process、各种IO类和大多数AWT/Swing相关类。共同的主题是,这些类都涉及某种由操作系统管理的资源。

At a certain level of abstraction, just about everything is stored, represented or transferred as a sequence or stream of bytes.

Ok, what can be stored/transferred as a System.IO.Stream object in .NET or counterpart in Java?

Any information that can be represented by a computer can (in theory) be turned into a sequence of bytes and stored / transferred via a byte-oriented I/O stream. You may need to write some software to transform the computer representation of the information into a sequence of bytes that is suitable for transfer via a byte stream. However, any finite representation can be transformed into bytes.

The only things that you cannot represent and transmit as a byte stream are those that only have an infinite representation (e.g. the complete value of Pi, or the set of all prime numbers), and those that have no digital representation (e.g. beauty or Barack Obama).


Ok, what can be stored/transferred as a System.IO.Stream object in .NET or counterpart in Java?

I don't know about the .NET case, but Java's ObjectOutputStream only works for classes that implement the Serializable or Externalizable interfaces. (And in the former case, all other classes in the non-transient closure of the original object must also implement Serializable.)

Some system classes are not Serializable; for example, Thread, Process, various IO classes and most AWT / Swing related classes. The common theme is that that these classes all involve some kind of resource that is managed by the operating system.

他夏了夏天 2024-10-16 11:03:29

这可能更像是一个哲学问题,但是您可以客观地想到的任何东西都可以存储为数字序列。字节只是一个示例,但您可以将它们存储为一系列数字、文本字符(因为 它们也是可翻译的数字),桌子上的花生,任何东西。

例如,您可以将同一事物表示为字节或十六进制数字本身表示为十进制数字,并且字符 A、B、C、D、E 和 F 对吧?比如

#nav{color:#123ABC;}

你还可以Base-64任何东西,Base64意味着有64种可能性。如果你愿意的话,你可以编写 Base65,它也能工作。

那么可以代表什么呢?你能想到什么?你能理性地定义什么?所有能想到的都可以表示为一串数字——我们硬盘中的每个文件都是一个巨大的流,“文件夹”、“文件”等概念只是偏移量的抽象。我们将其解释为字节、整数、字符等的巨大的 1 和 0 链。

This may be more of a philosophical matter, but anything that you can think of objectively can be stored as a sequence of numbers. Bytes are just one example, but you can store them as a sequence of numbers, text characters (because they are also translatable to numbers), peanuts on a table, anything.

For example, you can represent the same thing as either bytes or hex digits themselves represented as decimal numbers and the characters A, B, C, D, E and F right? such as

#nav{color:#123ABC;}

You can also Base-64 anything, and Base64 means there are 64 possibilities. You could make up Base65 if you wanted to, and it would work too.

Then what can be represented? What can you think of? What can you define rationally? All that can be thought can be represented as a stream of numbers - every file in our hard drives is one after the other in a huge stream, the concept of "folders", "files", etc. is just an abstraction of offsets in that huge chain of ones and zeroes that we interpret as bytes, ints, chars, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文