serial开头的英文单词

serial开头的英文单词

本文目录

  • serial开头的英文单词
  • c#中序列化是什么,怎么用,什么情况下用,不用有什么后果
  • 如何在C#里序列化集合对象
  • java中常用的英语
  • 请教各位高手,c#序列化用在哪里,我目前还没接触到序列化,想掌握这方面的知识,以免以后用到还不了解
  • C#里serializable是什么意思
  • java中对象序列化Serializable中SerializedPerson是什么意思
  • 怎样对带有不可序列化属性的Java对象进行序列化
  • referer 是什么意思

serial开头的英文单词


单个词?复合词?
单个词,都是和serial相关的,
serialise serialised serialises serialising serialism
serialisms serialist serialists serialization serializations
serialize serialized serializes serializing serially
serials

c#中序列化是什么,怎么用,什么情况下用,不用有什么后果


c#中序列化就是把一个对象保存到一个文件或数据库字段中去。

序列化用途:

1、在进程下次启动时读取上次保存的对象的信息

2、在不同的AppDomain或进程之间传递数据

3、在分布式应用系统中传递数据

常见的序列化的方法

1、BinaryFormatter

2、SoapFormatter

3、XML序列化

用法:

  BinaryFormatter的用法大致如下: 

//BinaryFormatter将对象序列化到文件中
 List《string》 inputList = new List《string》() { “str1“,“str2“,“str3“};
 using (FileStream fsWriter = new FileStream(@“tmp.dat“,FileMode.Create,FileAccess.Write))
 {
       BinaryFormatter bf = new BinaryFormatter();
       //序列化
       bf.Serialize(fsWriter, inputList);
 }
 //BinaryFormatter将文件中的数据反序列化出来
 List《string》 outputList = new List《string》();
 using (FileStream fsReader = new FileStream(@“tmp.dat“,FileMode.Open,FileAccess.Read))
 {
       BinaryFormatter bf = new BinaryFormatter();
       //反序列化
       outputList = (List《string》)bf.Deserialize(fsReader);
 }

XML序列化的用法大致如下:

//xml序列化到tmp.xml文件中
List《string》 inputList = new List《string》() { “str1“,“str2“};
using (FileStream fsWriter = new FileStream(@“tmp.xml“,FileMode.Create,FileAccess.Write))
{
      XmlSerializer xs = new XmlSerializer(typeof(List《string》));
      xs.Serialize(fsWriter, inputList);
}
//从tmp.xml文件中反序列化出来
List《string》 outputList = new List《string》();
using (FileStream fsReader = new FileStream(@“tmp.xml“,FileMode.Open,FileAccess.Read))
{
     XmlSerializer xs = new XmlSerializer(typeof(List《string》));
     outputList = xs.Deserialize(fsReader) as List《string》;
}

总结:

 

两个的用法大致如下:

 

序列化:

  1.得到一个存储对象的类型

  2.创建一个写入文件流

  3.定义要序列化的类型

  4.调用序列化方法

 

反序列化:

  1.定义一个装载对象的类型

  2.创建一个读出文件流

  3.定义要反序列化的类型

  4.调用反序列化方法

 

BinaryFormatter类进行序列化和反序列化,以缩略型二进制格式写到一个文件中去,速度比较快,而且写入后的文件已二进制保存有一定的保密效果。标记为NonSerialized的其他所有成员都能序列化。

 

采用xml序列化的方式只能保存public的字段和可读写的属性,对于private等类型的字段不能进行序列化。

 

二进制序列化的优点: 

  1. 所有的类成员(包括只读的)都可以被序列化;

  2. 性能非常好。

 

XML序列化的优点:

  1. 互操作性好;

  2. 不需要严格的二进制依赖;

  3. 可读性强


如何在C#里序列化集合对象


Collection主要是指像Array, ArrayList, List, Dictionary, HashTable这些数据类型,大家平时用的很多。如果一个类中有一个Collection类型的成员,在对这个类进行XML序列化的时候,应该如何处理?应该说在.net当中这是比较简单的,只要建立一个XmlSerializer类就可以帮你自动搞定,不过有的时候你可能需要对自动的序列化过程施加更多的控制,比如XML的结构是实现固定的,你必须按照要求去生成XML结构。
使用不同的属性可以灵活的控制生成的XML,这里我就不多介绍了,主要讲一下如何序列化比较复杂的Collection结构。下面的方法,对于所有实现了IEnumerable接口的Collection都有效。
我使用MSDN中的例子,不过没有使用数组或者ArrayList,而是使用了比较高级的数据类型List《T》,希望在讲解如何序列化XML的同时给使用List《T》的同学提供点参考
序列化一个List《T》
下面的代码示范了如何序列化一个 List《T》,实际上和序列化其它类一样,把这个类扔给Serialize()函数即可。

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Xml.Serialization;

using System.IO;

 

namespace SerializeCollection

{

    class Program

    {

        static void Main(string args)

        {

            Program test = new Program();

            test.SerializeDocument(“e://books.xml“);

        }

 

        public void SerializeDocument(string filename)

        {

            // Creates a new XmlSerializer.

            XmlSerializer s =

            new XmlSerializer(typeof(MyRootClass));

 

            // Writing the file requires a StreamWriter.

            TextWriter myWriter = new StreamWriter(filename);

 

            // Creates an instance of the class to serialize.

            MyRootClass myRootClass = new MyRootClass();

           

            //create items

            Item item1 = new Item();

            // Sets the objects’ properties.

            item1.ItemName = “Widget1“;

            item1.ItemCode = “w1“;

            item1.ItemPrice = 231;

            item1.ItemQuantity = 3;

 

           

            Item item2 = new Item();

            // Sets the objects’ properties.

            item2.ItemName = “Widget2“;

            item2.ItemCode = “w2“;

            item2.ItemPrice = 800;

            item2.ItemQuantity = 2;

 

            // Sets the class’s Items property to the list.

            myRootClass.Items.Add(item1);

            myRootClass.Items.Add(item2);

 

            /* Serializes the class, writes it to disk, and closes

              the TextWriter. */

            s.Serialize(myWriter, myRootClass);

            myWriter.Close();

        }

 

    }

 

    // This is the class that will be serialized.

    [Serializable]

    public class MyRootClass

    {

        public MyRootClass()

        {

            items = new List《Item》();

        }

 

        private List《Item》 items;

 

        public List《Item》 Items

        {

            get { return items; }

            set { items = value; }

        }

    }

 

    public class Item

    {

        [XmlElement(ElementName = “OrderItem“)]

        public string ItemName;

        public string ItemCode;

        public decimal ItemPrice;

        public int ItemQuantity;

    }

}

 

最后序列化成的XML:

《?xml version=“1.0“ encoding=“utf-8“?》

《MyRootClass xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance“ xmlns:xsd=“http://www.w3.org/2001/XMLSchema“》

  《Items》

    《Item》

      《OrderItem》Widget1《/OrderItem》

      《ItemCode》w1《/ItemCode》

      《ItemPrice》231《/ItemPrice》

      《ItemQuantity》3《/ItemQuantity》

    《/Item》

    《Item》

      《OrderItem》Widget2《/OrderItem》

      《ItemCode》w2《/ItemCode》

      《ItemPrice》800《/ItemPrice》

      《ItemQuantity》2《/ItemQuantity》

    《/Item》

  《/Items》

《/MyRootClass》

 


java中常用的英语


abstract (关键字) 抽象 [’�0�3bstr�0�3kt]
access vt.访问,存取 [’�0�3kses]’(n.入口,使用权)
algorithm n.算法 [’�0�3lg�0�5ri�0�8m]
Annotation [java] 代码注释 [�0�3n�0�5u’tei�0�6�0�5n]
anonymous adj.匿名的[�0�5’n�0�8nim�0�5s]’(反义:directly adv.直接地,立即[di’rektli, dai’rektli])
apply v.应用,适用 [�0�5’plai]
application n.应用,应用程序 [,�0�3pli’kei�0�6�0�5n]’ (application crash 程序崩溃)
arbitrary a.任意的 [’ɑ:bitr�0�5ri]
argument n.参数;争论,论据 [’ɑ:gjum�0�5nt]’(缩写 args)
assert (关键字) 断言 [�0�5’s�0�5:t] ’ (java 1.4 之后成为关键字)
associate n.关联(同伴,伙伴) [�0�5’s�0�5u�0�6ieit]
attribute n.属性(品质,特征) [�0�5’tribju:t]
boolean (关键字) 逻辑的, 布尔型
call n.v.调用; 呼叫; [k�0�8:l]
circumstance n.事件(环境,状况) [’s�0�5:k�0�5mst�0�5ns]
crash n.崩溃,破碎 [kr�0�3�0�6]
cohesion 内聚,黏聚,结合 [k�0�5u’hi:�0�1�0�5n]
(a class is designed with a single, well-focoused purpose. 应该不止这点)
command n. 命令,指令 [k�0�5’mɑ:nd](指挥, 控制) (command-line 命令行)
Comments [java] 文本注释 [’k�0�8ments]
compile [java] v.编译 [k�0�5m’pail]’ Compilation n.编辑[,k�0�8mpi’lei�0�6�0�5n]
const (保留字)
constant n. 常量, 常数, 恒量 [’k�0�8nst�0�5nt]
continue (关键字)
coupling 耦合,联结 [’k�0�5pli�0�7]
making sure that classes know about other classes only through their APIs.
declare [java] 声明 [di’kl�0�2�0�5]
default (关键字) 默认值; 缺省值 [di’f�0�8:lt]
delimiter 定义符; 定界符
Encapsulation[java] 封装 (hiding implementation details)
Exception [java] 例外; 异常 [ik’sep�0�6�0�5n]
entry n.登录项, 输入项, 条目[’entri]
enum (关键字)
execute vt.执行 [’eksikju:t]
exhibit v.显示, 陈列 [ig’zibit]
exist 存在, 发生 [ig’zist] ’(SQL关键字 exists)
extends (关键字) 继承、扩展 [ik’stend]
false (关键字)
final (关键字) finally (关键字)
fragments 段落; 代码块 [’fr�0�3gm�0�5nt]
FrameWork [java] 结构,框架 [’freimw�0�5:k]
Generic [java] 泛型 [d�0�1i’nerik]
goto (保留字) 跳转
heap n.堆 [hi:p]
implements (关键字) 实现 [’implim�0�5nt]
import (关键字) 引入(进口,输入)
Info n.信息 (information [,inf�0�5’mei�0�6�0�5n] )
Inheritance [java] 继承 [in’herit�0�5ns] (遗传,遗产)
initialize 预置 初始化 [i’ni�0�6�0�5laiz]
instanceof (关键字) 运算符,用于引用变量,以检查这个对象是否是某种类型。返回 boolean 值。
interface (关键字) 接口 [’int�0�5feis]
invoke vt.调用 [in’v�0�5uk]’ ( invocation [,inv�0�5u’kei�0�6�0�5n])
Iterator [java] 迭代器, 迭代程序
legal 合法的 [’li:g�0�5l]
log n.日志,记录 [l�0�8g]
native (关键字) ?? [’neitiv]
nested [java] 嵌套的 [’nestid] ’如:内部类(nested classes)
Object [java] 对象 [’�0�8bd�0�1ekt]
Overload [java] 方法的重载(不同参数列表的同名方法) [,�0�5uv�0�5’l�0�5ud]
Override [java] 方法的覆盖(覆盖父类的方法) [,�0�5uv�0�5’raid]
polymiorphism[java] 多态 (polymorphism 多形性[,p�0�8li’m�0�8:fizm])
allowing a single object to be seen as having many types.
principle n.原则,原理,主义 [’prinsipl]
priority n. 优先级 [prai’�0�8riti]
process n. 程序, 进程 [’pr�0�8ses]
protected (关键字) 受保护的,私有的 [pr�0�5’tektid]
provide v.规定(供应,准备,预防)[pr�0�5’vaid]
refer to v.引用 [ri’f�0�5:][tu:]
reference n. 参考(引用,涉及)[’ref�0�5r�0�5ns]’ --》reference variable 参量, 参考变量,引用变量
Reflection [java] 反射 [ri’flek�0�6�0�5n]
script n.手写体,小型程序 [skript]
serialized vt.序列化,串行化 [’si�0�5ri�0�5laiz]’(serializable adj.)(deserialize反序列化,反串行化)
Socket [java] 网络套接字[’s�0�8kit]
stack n.堆栈 [st�0�3k] (对应 heap 堆)
statement 程序语句; 语句 [’steitm�0�5nt]’ n. 陈述,指令
subclass n.子类 [’s�0�5bklɑ:s]’ (supertype 父类)
switch (关键字) 选择语句。 n.开关,道岔 [swit�0�6]
synchronized (关键字) 同步(锁) [’si�0�7kr�0�5naiz]
Thread [java] 线程 [θred]
throw (关键字) throws (关键字) [θr�0�5u] 抛出(异常)
transient (关键字) 瞬变;临时的[’tr�0�3nzi�0�5nt]’(可序列化)
valid 正确的,有效的 [’v�0�3lid]
variable n.变量 a.可变的[’v�0�2�0�5ri�0�5bl]
volatile (关键字) 不稳定的[’v�0�8l�0�5tail]
while (关键字) 循环语句。 当...的时候 [hwail] 本文来自CSDN: http://blog.csdn.net/gotohbu/archive/2009/09/01/4501597.aspx

请教各位高手,c#序列化用在哪里,我目前还没接触到序列化,想掌握这方面的知识,以免以后用到还不了解


序列化主要用于存储数据到文件, 或者数据在网络上的传输
这是一个存到文件的例子:
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
[Serializable()]//可以序列化的类需要用这个属性标记
public class ToBeSerialized
{
public int a;
public string b;
public ToBeSerialized(int a,string b)
{
this.a=a;
this.b=b;
}
}
public class Test
{
public void Serialize()//序列化
{
ToBeSerialized tbs = new ToBeSerialized(22, “SOM “);
Stream fs = File.Create( “Serialized.txt “);
BinaryFormatter serializer = new BinaryFormatter();
serializer.Serialize(fs, tbs);
fs.Close();
}
public void DeSerialize()//反序列化
{
ToBeSerialized restore;
Stream fs = File.OpenRead( “Serialized.txt “);
BinaryFormatter deserializer = new BinaryFormatter();
restore = (ToBeSerialized)(deserializer.Deserialize(fs));//反序列化得到的对象
fs.Close();
}
}

C#里serializable是什么意思


序列化
序列化是指存储和获取磁盘文件、内存或其他地方中的对象。在序列化时,所有的实例数据都保存到存储介质上,在取消序列化时,对象会被还原,且不能与其原实例区别开来。
只需给类添加Serializable属性,就可以实现序列化实例的成员。
并行化是序列化的逆过程,数据从存储介质中读取出来,并赋给类的实例变量。
[Serializable]
public class Person
{
public Person()
{
}

public int Age;
public int WeightInPounds;
}
下面来看一个小例子,首先要添加命名空间
using System.Runtime.Serialization.Formatters.Binary;
下面的代码将对象Person进行序列化并存储到一个文件中
Person me = new Person();
me.Age = 34;
me.WeightInPounds = 200;
Stream s = File.Open(“Me.dat“,FileMode.Create);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(s,me);
s.Close();
如果需要对部分字段序列化部分不序列化时,我们可以按照如下设置实现
[Serializable]
public class Person
{
public Person()
{ }
public int Age;
[NonSerialized]
public int WeightInPounds;
}

java中对象序列化Serializable中SerializedPerson是什么意思


Serializable:实现Serializable接口,指明该类允许被序列化,如果没有Serializable的话,该类是不能被序列化的。
SerializedPerson:新建文件的一个文件名。

怎样对带有不可序列化属性的Java对象进行序列化


出于很多原因我们想使用自定义的序列化方法取代Java默认的机制。一个最常见的原因是提高性能,而另一个原因是有时候我们无法使用默认的序列化方法。在这篇文章中,我们具体来讨论怎样通过定制的序列化方法,对一个较大的、带有不可序列化属性的对象进行序列化。

下面这段代码定义了一个简单的类。它可以把一个给定的对象序列化到一个指定的文件,或者从相同的文件中把对象反序列化出来。

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485    package dustin.examples.serialization;     import static java.lang.System.out;        import java.io.FileInputStream;  import java.io.FileOutputStream;  import java.io.IOException;  import java.io.ObjectInputStream;  import java.io.ObjectOutputStream;     /**  * Simple serialization/deserialization demonstrator.  *   * @author Dustin  */ public class SerializationDemonstrator  {     /**     * Serialize the provided object to the file of the provided name.     * @param objectToSerialize Object that is to be serialized to file; it is     *     best that this object have an individually overridden toString()     *     implementation as that is used by this method for writing our status.     * @param fileName Name of file to which object is to be serialized.     * @throws IllegalArgumentException Thrown if either provided parameter is null.     */    public static 《T》 void serialize(final T objectToSerialize, final String fileName)     {        if (fileName == null)        {           throw new IllegalArgumentException(              “Name of file to which to serialize object to cannot be null.“);        }        if (objectToSerialize == null)        {           throw new IllegalArgumentException(“Object to be serialized cannot be null.“);        }        try (FileOutputStream fos = new FileOutputStream(fileName);             ObjectOutputStream oos = new ObjectOutputStream(fos))        {           oos.writeObject(objectToSerialize);           out.println(“Serialization of Object “ + objectToSerialize + “ completed.“);        }        catch (IOException ioException)        {           ioException.printStackTrace();        }     }        /**     * Provides an object deserialized from the file indicated by the provided     * file name.     *      * @param 《T》 Type of object to be deserialized.     * @param fileToDeserialize Name of file from which object is to be deserialized.     * @param classBeingDeserialized Class definition of object to be deserialized     *    from the file of the provided name/path; it is recommended that this     *    class define its own toString() implementation as that will be used in     *    this method’s status output.     * @return Object deserialized from provided filename as an instance of the     *    provided class; may be null if something goes wrong with deserialization.     * @throws IllegalArgumentException Thrown if either provided parameter is null.     */    public static 《T》 T deserialize(final String fileToDeserialize, final Class《T》 classBeingDeserialized)     {        if (fileToDeserialize == null)        {           throw new IllegalArgumentException(“Cannot deserialize from a null filename.“);        }        if (classBeingDeserialized == null)        {           throw new IllegalArgumentException(“Type of class to be deserialized cannot be null.“);        }        T objectOut = null;        try (FileInputStream fis = new FileInputStream(fileToDeserialize);             ObjectInputStream ois = new ObjectInputStream(fis))        {           objectOut = (T) ois.readObject();           out.println(“Deserialization of Object “ + objectOut + “ is completed.“);        }        catch (IOException | ClassNotFoundException exception)        {           exception.printStackTrace();        }        return objectOut;     }  }

referer 是什么意思


n. 推荐人,上线;介绍人 (其正确英语拼法是referrer,由于早期HTTP规范的拼写错误,为了保持向后兼容而将错就错)

网络意义:

referrer 网站来路;访问者进入 网站的任何途径。 HTTPReferrer是header的一部分,当浏览器向web服务器发出请求的时候,一般会带上Referer,告诉服务器用户从那个页面连接过来的,服务器藉此可以获得一些信息用于处理。

HTTP 协议中有一个用来表示页面或资源来源的请求头,由 Philip Hallam-Baker 于上世纪 90 年代提出来,他当时把这个请求头叫做 Referer,并最终写进了 RFC1945,也就是 HTTP/1.0 协议:

The Referer request-header field allows the client to specify, for the server’s benefit, the address (URI) of the resource from which the Request-URI was obtained. via

有趣的是,当时这个单词被他拼错了,正确的拼写应该是 Referrer。但是这个错误被发现之前,已经被大量使用,如果要改过来需要所有服务端、客户端的一致配合,还有大量的代码需要排查修改。于是,HTTP 的标准制定者们决定将错就错,不改了。下面这段描述来自于 RFC2616,也就是著名的 HTTP/1.1 协议:

The Referer[sic] request-header field allows the client to specify, for the server’s benefit, the address (URI) of the resource from which the Request-URI was obtained (the “referrer“, although the header field is misspelled.) via

可以看到,相比 HTTP/1.0,HTTP/1.1 除了加上了对这个错误的说明之外,没有其他变化。另外,那个[sic] 是拉丁文里「原文如此」的意思。很多其他标准在表述 HTTP 中的 Referer 请求头时,都会加上[sic],避免引起读者误解。

由此可见,HTTP 标准制定者奉行实用主义,能用就行。由于 HTTP 协议继续拼错,浏览器当然只好按错的来,服务端收到的也是拼错的,所以大部分 Web Server、服务端语言或框架,都跟着拼错。举几个例子:

  • Nginx:ngx_


免责声明:本网信息来自于互联网,目的在于传递更多信息,并不代表本网赞同其观点。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,并请自行核实相关内容。本站不承担此类作品侵权行为的直接责任及连带责任。如若本网有任何内容侵犯您的权益,请及时联系我们,本站将会在24小时内处理完毕。
相关文章
返回顶部