序列化和封送处理有什么区别?

发布于 2024-07-17 08:10:38 字数 285 浏览 7 评论 0原文

我知道就几种分布式技术(例如 RPC)而言,使用了术语“编组”,但不明白它与序列化有何不同。 它们不是都将对象转换为一系列位吗?

相关:

什么是序列化?

什么是对象编组?

I know that in terms of several distributed techniques (such as RPC), the term "Marshaling" is used but don't understand how it differs from Serialization. Aren't they both transforming objects into series of bits?

Related:

What is Serialization?

What is Object Marshalling?

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

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

发布评论

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

评论(13

前事休说 2024-07-24 08:10:38

在远程过程调用的上下文中,编组和序列化松散是同义词,但在语义上是不同的。

特别是,编组是关于从这里到那里获取参数,而序列化是关于将结构化数据复制到原始形式(例如字节流)或从原始形式(例如字节流)复制结构化数据。 从这个意义上说,序列化是执行编组的一种方法,通常实现按值传递语义。

对象也可以通过引用进行编组,在这种情况下,“线路上”的数据只是原始对象的位置信息。 然而,这样的对象可能仍然适合值序列化。

正如@Bill 提到的,可能还有其他元数据,例如代码库位置甚至对象实现代码。

Marshaling and serialization are loosely synonymous in the context of remote procedure call, but semantically different as a matter of intent.

In particular, marshaling is about getting parameters from here to there, while serialization is about copying structured data to or from a primitive form such as a byte stream. In this sense, serialization is one means to perform marshaling, usually implementing pass-by-value semantics.

It is also possible for an object to be marshaled by reference, in which case the data "on the wire" is simply location information for the original object. However, such an object may still be amenable to value serialization.

As @Bill mentions, there may be additional metadata such as code base location or even object implementation code.

亚希 2024-07-24 08:10:38

两者都做一件事——那就是序列化一个对象。 序列化用于传输对象或存储对象。 但是:

  • 序列化:当你序列化一个对象时,只有该对象内的成员数据被写入字节流; 不是代码
    实际上实现了该对象。
  • 编组:当我们谈论将对象传递到远程对象(RMI)时,会使用术语编组。 在编组中,对象被序列化(成员数据被序列化)+ 附加了代码库。

所以序列化是编组的一部分。

CodeBase 是告诉对象接收者在哪里可以找到该对象的实现的信息。 任何认为可能将对象传递给以前可能没有见过它的另一个程序的程序都必须设置代码库,以便接收者可以知道从哪里下载代码(如果本地没有可用的代码)。 接收者将在反序列化对象时从中获取代码库并从该位置加载代码。

Both do one thing in common - that is serializing an Object. Serialization is used to transfer objects or to store them. But:

  • Serialization: When you serialize an object, only the member data within that object is written to the byte stream; not the code that
    actually implements the object.
  • Marshalling: Term Marshalling is used when we talk about passing Object to remote objects(RMI). In Marshalling Object is serialized(member data is serialized) + Codebase is attached.

So Serialization is a part of Marshalling.

CodeBase is information that tells the receiver of Object where the implementation of this object can be found. Any program that thinks it might ever pass an object to another program that may not have seen it before must set the codebase, so that the receiver can know where to download the code from, if it doesn't have the code available locally. The receiver will, upon deserializing the object, fetch the codebase from it and load the code from that location.

×纯※雪 2024-07-24 08:10:38

来自 编组(计算机科学) 维基百科文章:

术语“marshal”在 Python 标准库中被认为是“序列化”的同义词 1,但这些术语在 Java 相关的 RFC 2713 中并不是同义词:

“编组”对象意味着以这样的方式记录其状态和代码库:当“编组”对象被“解组”时,可能会通过自动加载对象的类定义来获取原始对象的副本。物体。 您可以封送任何可序列化或远程的对象。 编组类似于序列化,只不过编组还记录代码库。 编组与序列化不同,因为编组专门处理远程对象。 (RFC 2713)

“序列化”对象意味着将其状态转换为字节流,以便字节流可以转换回对象的副本。

因此,除了对象的状态之外,编组还将对象的代码库保存在字节流中。

From the Marshalling (computer science) Wikipedia article:

The term "marshal" is considered to be synonymous with "serialize" in the Python standard library1, but the terms are not synonymous in the Java-related RFC 2713:

To "marshal" an object means to record its state and codebase(s) in such a way that when the marshalled object is "unmarshalled", a copy of the original object is obtained, possibly by automatically loading the class definitions of the object. You can marshal any object that is serializable or remote. Marshalling is like serialization, except marshalling also records codebases. Marshalling is different from serialization in that marshalling treats remote objects specially. (RFC 2713)

To "serialize" an object means to convert its state into a byte stream in such a way that the byte stream can be converted back into a copy of the object.

So, marshalling also saves the codebase of an object in the byte stream in addition to its state.

非要怀念 2024-07-24 08:10:38

基础知识首先

字节流 - 流是数据序列。 输入流 - 从源读取数据。 输出流 - 将数据写入目标。
Java 字节流用于逐字节执行输入/输出(一次 8 位)。 字节流适合处理二进制文件等原始数据。
Java 字符流用于一次执行 2 个字节的输入/输出,因为 Java 中字符是使用 Unicode 约定存储的,每个字符 2 个字节。 当我们处理(读/写)文本文件时,字符流非常有用。

RMI(远程方法调用) - 一种 A​​PI,提供了在 java 中创建分布式应用程序的机制。 RMI 允许对象调用在另一个 JVM 中运行的对象的方法。


序列化编组都被松散地用作同义词。 这里有一些差异。

序列化 - 对象的数据成员被写入二进制形式或字节流(然后可以写入文件/内存/数据库等)。 一旦对象数据成员写入二进制形式,就无法保留有关数据类型的信息。

输入图像描述这里

编组 - 对象被序列化(以二进制格式的字节流),附加数据类型+代码库,然后传递远程对象(RMI)。 编组会将数据类型转换为预定的命名约定,以便可以根据初始数据类型对其进行重构。

输入图像描述这里

所以序列化是编组的一部分。

CodeBase是告诉Object的接收者在哪里可以找到该对象的实现的信息。 任何认为可能将对象传递给以前可能没有见过它的另一个程序的程序都必须设置代码库,以便接收者可以知道从哪里下载代码(如果本地没有可用的代码)。 接收者将在反序列化对象时从中获取代码库并从该位置加载代码。 (从@Nasir回答复制)

序列化几乎就像对象使用的内存的愚蠢内存转储,而编组存储有关自定义数据类型的信息。

在某种程度上,序列化通过值传递的实现来执行编组,因为没有传递数据类型的信息,只是将原始形式传递给字节流。

如果流从一个操作系统转移到另一个操作系统,并且不同的操作系统具有不同的表示相同数据的方式,则序列化可能会出现一些与大端、小端相关的问题。 另一方面,编组非常适合在操作系统之间迁移,因为结果是更高级别的表示。

Basics First

Byte Stream - Stream is a sequence of data. Input stream - reads data from source. Output stream - writes data to destination.
Java Byte Streams are used to perform input/output byte by byte (8 bits at a time). A byte stream is suitable for processing raw data like binary files.
Java Character Streams are used to perform input/output 2 bytes at a time, because Characters are stored using Unicode conventions in Java with 2 bytes for each character. Character stream is useful when we process (read/write) text files.

RMI (Remote Method Invocation) - an API that provides a mechanism to create distributed application in java. The RMI allows an object to invoke methods on an object running in another JVM.


Both Serialization and Marshalling are loosely used as synonyms. Here are few differences.

Serialization - Data members of an object is written to binary form or Byte Stream (and then can be written in file/memory/database etc). No information about data-types can be retained once object data members are written to binary form.

enter image description here

Marshalling - Object is serialized (to byte stream in binary format) with data-type + Codebase attached and then passed Remote Object (RMI). Marshalling will transform the data-type into a predetermined naming convention so that it can be reconstructed with respect to the initial data-type.

enter image description here

So Serialization is a part of Marshalling.

CodeBase is information that tells the receiver of Object where the implementation of this object can be found. Any program that thinks it might ever pass an object to another program that may not have seen it before must set the codebase, so that the receiver can know where to download the code from, if it doesn't have the code available locally. The receiver will, upon deserializing the object, fetch the codebase from it and load the code from that location. (Copied from @Nasir answer)

Serialization is almost like a stupid memory-dump of the memory used by the object(s), while Marshalling stores information about custom data-types.

In a way, Serialization performs marshalling with implementation of pass-by-value because no information of data-type is passed, just the primitive form is passed to byte stream.

Serialization may have some issues related to big-endian, small-endian if the stream is going from one OS to another if the different OS have different means of representing the same data. On the other hand, marshalling is perfectly fine to migrate between OS because the result is a higher-level representation.

时光暖心i 2024-07-24 08:10:38

编组是指将函数的签名和参数转换为单个字节数组。
专门用于 RPC 的目的。

序列化通常指将整个对象/对象树转换为字节数组
编组将序列化对象参数,以便将它们添加到消息中并通过网络传递。
*序列化也可用于存储到磁盘。*

Marshaling refers to converting the signature and parameters of a function into a single byte array.
Specifically for the purpose of RPC.

Serialization more often refers to converting an entire object / object tree into a byte array
Marshaling will serialize object parameters in order to add them to the message and pass it across the network.
*Serialization can also be used for storage to disk.*

诗化ㄋ丶相逢 2024-07-24 08:10:38

我认为主要区别在于编组据说也涉及代码库。 换句话说,您无法将对象编组和解组到不同类的状态等效实例中。

序列化只是意味着您可以存储对象并重新获得等效状态,即使它是另一个类的实例。

话虽如此,它们通常是同义词。

I think that the main difference is that Marshalling supposedly also involves the codebase. In other words, you would not be able to marshal and unmarshal an object into a state-equivalent instance of a different class.

Serialization just means that you can store the object and reobtain an equivalent state, even if it is an instance of another class.

That being said, they are typically synonyms.

感情旳空白 2024-07-24 08:10:38

编组是告诉编译器数据将如何在另一个环境/系统上表示的规则;
例如;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string cFileName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string cAlternateFileName;

正如您可以看到两个不同的字符串值表示为不同的值类型。

序列化只会转换对象内容,而不是表示形式(将保持不变)并遵守序列化规则(导出或不导出什么)。 例如,私有值不会被序列化,公共值会被序列化,并且对象结构将保持不变。

Marshalling is the rule to tell compiler how the data will be represented on another environment/system;
For example;

[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string cFileName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string cAlternateFileName;

as you can see two different string values represented as different value types.

Serialization will only convert object content, not representation (will stay same) and obey rules of serialization, (what to export or no). For example, private values will not be serialized, public values yes and object structure will stay same.

毁梦 2024-07-24 08:10:38

以下是两者的更具体示例:

序列化示例:

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

typedef struct {
    char value[11];
} SerializedInt32;

SerializedInt32 SerializeInt32(int32_t x) 
{
    SerializedInt32 result;
    
    itoa(x, result.value, 10);

    return result;
}

int32_t DeserializeInt32(SerializedInt32 x) 
{
    int32_t result;
    
    result = atoi(x.value);
    
    return result;
}

int main(int argc, char **argv)
{    
    int x;   
    SerializedInt32 data;
    int32_t result;
    
    x = -268435455;
    
    data = SerializeInt32(x);
    result = DeserializeInt32(data);
    
    printf("x = %s.\n", data.value);
    
    return result;
}

在序列化中,数据以可以存储和稍后恢复的方式展平。

编组演示:(

MarshalDemoLib.cpp)

#include <iostream>
#include <string>

extern "C"
__declspec(dllexport)
void *StdCoutStdString(void *s)
{
    std::string *str = (std::string *)s;
    std::cout << *str;
}

extern "C"
__declspec(dllexport)
void *MarshalCStringToStdString(char *s)
{
    std::string *str(new std::string(s));
    
    std::cout << "string was successfully constructed.\n";
    
    return str;
}

extern "C"
__declspec(dllexport)
void DestroyStdString(void *s)
{
    std::string *str((std::string *)s);
    delete str;
    
    std::cout << "string was successfully destroyed.\n";
}

(MarshalDemo.c)

#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main(int argc, char **argv)
{
    void *myStdString;

    LoadLibrary("MarshalDemoLib");
    
    myStdString = ((void *(*)(char *))GetProcAddress (
        GetModuleHandleA("MarshalDemoLib"),
        "MarshalCStringToStdString"
    ))("Hello, World!\n");
    
    ((void (*)(void *))GetProcAddress (
        GetModuleHandleA("MarshalDemoLib"),
        "StdCoutStdString"
    ))(myStdString);

    ((void (*)(void *))GetProcAddress (
        GetModuleHandleA("MarshalDemoLib"),
        "DestroyStdString"
    ))(myStdString);    
}

在编组中,数据不一定需要展平,但需要转换为另一种替代表示形式。 所有的转换都是编组,但并非所有的编组都是转换。

编组不需要涉及动态分配,它也可以只是结构之间的转换。 例如,您可能有一对,但该函数期望该对的第一个和第二个元素是相反的; 您将一对转换/memcpy 到另一对将无法完成这项工作,因为 fst 和 snd 会被翻转。

#include <stdio.h>

typedef struct {
    int fst;
    int snd;
} pair1;

typedef struct {
    int snd;
    int fst;
} pair2;

void pair2_dump(pair2 p)
{
    printf("%d %d\n", p.fst, p.snd);
}

pair2 marshal_pair1_to_pair2(pair1 p)
{
    pair2 result;
    result.fst = p.fst;
    result.snd = p.snd;
    return result;
}

pair1 given = {3, 7};

int main(int argc, char **argv)
{    
    pair2_dump(marshal_pair1_to_pair2(given));
    
    return 0;
}

当您开始处理多种类型的标记联合时,编组的概念变得尤为重要。 例如,您可能会发现很难让 JavaScript 引擎为您打印“c string”,但您可以要求它为您打印包装的 c 字符串。 或者,如果您想在 Lua 或 Python 运行时中从 JavaScript 运行时打印字符串。 它们都是字符串,但如果不进行编组,通常就无法相处。

我最近遇到的一个烦恼是,JScript 数组将 C# 编组为“__ComObject”,并且没有记录的方法来使用该对象。 我可以找到它所在的地址,但我真的不知道有关它的任何其他信息,因此真正弄清楚它的唯一方法就是以任何可能的方式探索它,并希望找到有关它的有用信息。 因此,创建一个具有更友好界面(如 Scripting.Dictionary)的新对象,将数据从 JScript 数组对象复制到其中,然后将该对象传递给 C#(而不是 JScript 的默认数组)变得更加容易。

(test.js)

var x = new ActiveXObject('Dmitry.YetAnotherTestObject.YetAnotherTestObject');
    
x.send([1, 2, 3, 4]);

(YetAnotherTestObject.cs)

using System;
using System.Runtime.InteropServices;

namespace Dmitry.YetAnotherTestObject
{
    [Guid("C612BD9B-74E0-4176-AAB8-C53EB24C2B29"), ComVisible(true)]
    public class YetAnotherTestObject
    {
        public void send(object x)
        {
            System.Console.WriteLine(x.GetType().Name);
        }
    }
}

上面打印了“__ComObject”,从 C# 的角度来看,它有点像一个黑盒子。

另一个有趣的概念是,您可能了解如何编写代码,并且计算机知道如何执行指令,因此作为程序员,您可以有效地将您希望计算机执行的操作的概念从您的大脑整理到程序中图像。 如果我们有足够好的编组器,我们只需考虑我们想要做什么/改变什么,程序就会以这种方式改变,而无需在键盘上打字。 因此,如果你有办法在你真正想写分号的几秒钟内存储大脑中的所有物理变化,你可以将这些数据编组到一个信号中以打印分号,但这是一个极端。

Here's more specific examples of both:

Serialization Example:

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

typedef struct {
    char value[11];
} SerializedInt32;

SerializedInt32 SerializeInt32(int32_t x) 
{
    SerializedInt32 result;
    
    itoa(x, result.value, 10);

    return result;
}

int32_t DeserializeInt32(SerializedInt32 x) 
{
    int32_t result;
    
    result = atoi(x.value);
    
    return result;
}

int main(int argc, char **argv)
{    
    int x;   
    SerializedInt32 data;
    int32_t result;
    
    x = -268435455;
    
    data = SerializeInt32(x);
    result = DeserializeInt32(data);
    
    printf("x = %s.\n", data.value);
    
    return result;
}

In serialization, data is flattened in a way that can be stored and unflattened later.

Marshalling Demo:

(MarshalDemoLib.cpp)

#include <iostream>
#include <string>

extern "C"
__declspec(dllexport)
void *StdCoutStdString(void *s)
{
    std::string *str = (std::string *)s;
    std::cout << *str;
}

extern "C"
__declspec(dllexport)
void *MarshalCStringToStdString(char *s)
{
    std::string *str(new std::string(s));
    
    std::cout << "string was successfully constructed.\n";
    
    return str;
}

extern "C"
__declspec(dllexport)
void DestroyStdString(void *s)
{
    std::string *str((std::string *)s);
    delete str;
    
    std::cout << "string was successfully destroyed.\n";
}

(MarshalDemo.c)

#include <Windows.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

int main(int argc, char **argv)
{
    void *myStdString;

    LoadLibrary("MarshalDemoLib");
    
    myStdString = ((void *(*)(char *))GetProcAddress (
        GetModuleHandleA("MarshalDemoLib"),
        "MarshalCStringToStdString"
    ))("Hello, World!\n");
    
    ((void (*)(void *))GetProcAddress (
        GetModuleHandleA("MarshalDemoLib"),
        "StdCoutStdString"
    ))(myStdString);

    ((void (*)(void *))GetProcAddress (
        GetModuleHandleA("MarshalDemoLib"),
        "DestroyStdString"
    ))(myStdString);    
}

In marshaling, data does not necessarily need to be flattened, but it needs to be transformed to another alternative representation. all casting is marshaling, but not all marshaling is casting.

Marshaling doesn't require dynamic allocation to be involved, it can also just be transformation between structs. For example, you might have a pair, but the function expects the pair's first and second elements to be other way around; you casting/memcpy one pair to another won't do the job because fst and snd will get flipped.

#include <stdio.h>

typedef struct {
    int fst;
    int snd;
} pair1;

typedef struct {
    int snd;
    int fst;
} pair2;

void pair2_dump(pair2 p)
{
    printf("%d %d\n", p.fst, p.snd);
}

pair2 marshal_pair1_to_pair2(pair1 p)
{
    pair2 result;
    result.fst = p.fst;
    result.snd = p.snd;
    return result;
}

pair1 given = {3, 7};

int main(int argc, char **argv)
{    
    pair2_dump(marshal_pair1_to_pair2(given));
    
    return 0;
}

The concept of marshaling becomes especially important when you start dealing with tagged unions of many types. For example, you might find it difficult to get a JavaScript engine to print a "c string" for you, but you can ask it to print a wrapped c string for you. Or if you want to print a string from JavaScript runtime in a Lua or Python runtime. They are all strings, but often won't get along without marshaling.

An annoyance I had recently was that JScript arrays marshal to C# as "__ComObject", and has no documented way to play with this object. I can find the address of where it is, but I really don't know anything else about it, so the only way to really figure it out is to poke at it in any way possible and hopefully find useful information about it. So it becomes easier to create a new object with a friendlier interface like Scripting.Dictionary, copy the data from the JScript array object into it, and pass that object to C# instead of JScript's default array.

(test.js)

var x = new ActiveXObject('Dmitry.YetAnotherTestObject.YetAnotherTestObject');
    
x.send([1, 2, 3, 4]);

(YetAnotherTestObject.cs)

using System;
using System.Runtime.InteropServices;

namespace Dmitry.YetAnotherTestObject
{
    [Guid("C612BD9B-74E0-4176-AAB8-C53EB24C2B29"), ComVisible(true)]
    public class YetAnotherTestObject
    {
        public void send(object x)
        {
            System.Console.WriteLine(x.GetType().Name);
        }
    }
}

above prints "__ComObject", which is somewhat of a black box from the point of view of C#.

Another interesting concept is that you might have the understanding how to write code, and a computer that knows how to execute instructions, so as a programmer, you are effectively marshaling the concept of what you want the computer to do from your brain to the program image. If we had good enough marshallers, we could just think of what we want to do/change, and the program would change that way without typing on the keyboard. So, if you could have a way to store all the physical changes in your brain for the few seconds where you really want to write a semicolon, you could marshal that data into a signal to print a semicolon, but that's an extreme.

夏の忆 2024-07-24 08:10:38

编组通常发生在关联相对紧密的进程之间; 连载并不一定有这种期望。 因此,例如,当在进程之间编组数据时,您可能希望仅发送一个引用来恢复可能昂贵的数据,而在序列化时,您希望保存所有数据,以便在反序列化时正确地重新创建对象。

Marshalling is usually between relatively closely associated processes; serialization does not necessarily have that expectation. So when marshalling data between processes, for example, you may wish to merely send a REFERENCE to potentially expensive data to recover, whereas with serialization, you would wish to save it all, to properly recreate the object(s) when deserialized.

情魔剑神 2024-07-24 08:10:38

我对编组的理解与其他答案不同。

序列化:

利用约定生成或重新水合对象图的有线格式版本。

编组

通过利用映射文件生成或重新生成对象图的有线格式版本,以便可以自定义结果。 该工具可能首先遵循约定,但重要的区别是定制结果的能力。

合同优先开发:

编组在合同优先开发的背景下非常重要。

  • 可以对内部对象图进行更改,同时保持外部接口随着时间的推移保持稳定。 这样,所有服务订阅者就不必为每一个微小的更改而进行修改。
  • 可以跨不同语言映射结果。 例如,从一种语言的属性名称约定(“property_name”)到另一种语言的属性名称约定(“propertyName”)。

My understanding of marshalling is different to the other answers.

Serialization:

To Produce or rehydrate a wire-format version of an object graph utilizing a convention.

Marshalling:

To Produce or rehydrate a wire-format version of an object graph by utilizing a mapping file, so that the results can be customized. The tool may start by adhering to a convention, but the important difference is the ability to customize results.

Contract First Development:

Marshalling is important within the context of contract first development.

  • Its possible to make changes to an internal object graph, while keeping the external interface stable over time. This way all of the service subscribers won't have to be modified for every trivial change.
  • Its possible to map the results across different languages. For example from the property name convention of one language ('property_name') to another ('propertyName').
二货你真萌 2024-07-24 08:10:38

序列化与编组

问题:对象属于某个进程(VM),并且其生命周期相同

序列化 - 将对象状态转换为流字节(JSON、XML...)用于保存、共享、转换...

编组 - 包含序列化+代码库。 通常由远程过程调用(RPC) -> 使用 Java 远程方法调用(Java RMI),您可以调用托管在远程 Java 进程上的对象的方法。

codebase - 是类定义的位置或 URL,ClassLoader 可以在其中下载它。 CLASSPATH[关于] 作为本地代码库

JVM -> Class Loader -> load class definition
java -Djava.rmi.server.codebase="<some_URL>" -jar <some.jar>

RMI 非常简单的图表

Serialisation - state
Marshalling - state + class definition

官方文档< /a>

Serialisation vs Marshalling

Problem: Object belongs to some process(VM) and it's lifetime is the same

Serialisation - transform object state into stream of bytes(JSON, XML...) for saving, sharing, transforming...

Marshalling - contains Serialisation + codebase. Usually it used by Remote procedure call(RPC) -> Java Remote Method Invocation(Java RMI) where you are able to invoke a object's method which is hosted on remote Java processes.

codebase - is a place or URL to class definition where it can be downloaded by ClassLoader. CLASSPATH[About] is as a local codebase

JVM -> Class Loader -> load class definition
java -Djava.rmi.server.codebase="<some_URL>" -jar <some.jar>

Very simple diagram for RMI

Serialisation - state
Marshalling - state + class definition

Official doc

黑白记忆 2024-07-24 08:10:38

编组实际上使用序列化过程,但主要区别在于,在序列化中,只有数据成员和对象本身被序列化,而不是签名,但在编组对象+代码库(其实现)中,也会被转换为字节。

编组是使用 JAXB 将 java 对象转换为 xml 对象以便可以在 Web 服务中使用的过程。

Marshaling uses Serialization process actually but the major difference is that it in Serialization only data members and object itself get serialized not signatures but in Marshalling Object + code base(its implementation) will also get transformed into bytes.

Marshalling is the process to convert java object to xml objects using JAXB so that it can be used in web services.

南七夏 2024-07-24 08:10:38

将它们视为同义词,两者都有一个生产者将内容发送给消费者......最后,实例的字段被写入字节流,另一端则相反,并使用相同的实例。

注意 - java RMI 还包含对传输接收者缺少的类的支持...

Think of them as synonyms, both have a producer that sends stuff over to a consumer... In the end fields of instances are written into a byte stream and the other end foes the reverse ands up with the same instances.

NB - java RMI also contains support for transporting classes that are missing from the recipient...

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