实现一个压缩Remoting传输数据的Sink:CompressionSink (转载)

在前两讲《初探.Net Remoting服务端 Loading Remtoing配置内容的过程 》《初探.Net Remoting客户端 Loading Remtoing配置内容的过程 》中,我已经分析了Remoting 的Sink机制,接下来,就提供一个具体的范例:CompressionSink(原始SourceCode源于Advanced .Net Remoting 1StED)。 CompressionSink通过在客户端和服务端各自插入一个数据压缩-解压缩的Sink。目的是希望减少大数据量传递对网络带宽的占用,提高传输效率。下载SourceCode ,BTW,这个压缩Sink相对比较稳定,大家可以在各自的项目中放心使用。:-)



详细设计:
提供一个Assembly: CompressionSink.dll
它包括:
    客户端:
        CompressionSink.CompressionClientSinkProvider类和CompressionSink.CompressionClientSink类
    服务端:
        CompressionSink.CompressionServerSinkProvider类和CompressionSink.CompressionServerSink类
    压缩类:CompressionHelper
    压缩内核:NZipLib库。

客户端的配置文件 :

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <system.runtime.remoting>

        <application>

            <channels>

                <channel ref="http">

                    <clientProviders>

                        <formatter ref="soap" />

                        <provider type="CompressionSink.CompressionClientSinkProvider, CompressionSink" />

                    </clientProviders>

                </channel>

            </channels>

             <client>

                 <wellknown type="Service.SomeSAO, Service"  url="http://localhost:5555/SomeSAO.soap" />

             </client>

        </application>

    </system.runtime.remoting>

</configuration>

服务端的配置文件 : 

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <system.runtime.remoting>

        <application>

            <channels>

                <channel ref="http" port="5555">

                    <serverProviders>

                        <provider type="CompressionSink.CompressionServerSinkProvider, CompressionSink" />

                        <formatter ref="soap"/>

                    </serverProviders>

                </channel>

            </channels>

            <service>

                <wellknown mode="Singleton"  type="Service.SomeSAO, Service"   objectUri="SomeSAO.soap" />

            </service>

        </application>

    </system.runtime.remoting>

</configuration>

 

None.gifpublic classCompressionClientSinkProvider: IClientChannelSinkProvider
ExpandedBlockStart.gifContractedBlock.gif    dot.gif{
InBlock.gif        private IClientChannelSinkProvider _nextProvider;
InBlock.gif
InBlock.gif        public CompressionClientSinkProvider(IDictionary properties, ICollection providerData) 
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            // not yet needed
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        public IClientChannelSinkProvider Next
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
ExpandedSubBlockStart.gifContractedSubBlock.gif            get dot.gif{
InBlock.gif                return _nextProvider;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockStart.gifContractedSubBlock.gif            set dot.gif{
InBlock.gif                _nextProvider = value;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        public IClientChannelSink CreateSink(IChannelSender channel, string url, object remoteChannelData) 
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            // create other sinks in the chain
InBlock.gif            IClientChannelSink next = _nextProvider.CreateSink(channel,
InBlock.gif                url,
InBlock.gif                remoteChannelData);    
InBlock.gif    
InBlock.gif            // put our sink on top of the chain and return it                
InBlock.gif            return new CompressionClientSink(next);
ExpandedSubBlockEnd.gif        }

ExpandedBlockEnd.gif    }


 


1None.gifpublic classCompressionClientSink: BaseChannelSinkWithProperties, 
2None.gif                                        IClientChannelSink
3ExpandedBlockStart.gifContractedBlock.gif    dot.gif{
 4InBlock.gif        private IClientChannelSink _nextSink;
 5InBlock.gif
 6InBlock.gif        public CompressionClientSink(IClientChannelSink next) 
 7ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 8InBlock.gif            _nextSink = next;
 9ExpandedSubBlockEnd.gif        }

10InBlock.gif
11InBlock.gif        public IClientChannelSink NextChannelSink 
12ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
13ExpandedSubBlockStart.gifContractedSubBlock.gif            get dot.gif{
14InBlock.gif                return _nextSink;
15ExpandedSubBlockEnd.gif            }

16ExpandedSubBlockEnd.gif        }

17InBlock.gif
18InBlock.gif
19InBlock.gif        public void AsyncProcessRequest(IClientChannelSinkStack sinkStack, 
20InBlock.gif                                        IMessage msg, 
21InBlock.gif                                        ITransportHeaders headers, 
22InBlock.gif                                        Stream stream) 
23ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
24InBlock.gif
25InBlock.gif
26InBlock.gif            // generate a compressed stream using NZipLib
27InBlock.gif            stream = CompressionHelper.getCompressedStreamCopy(stream);
28InBlock.gif
29InBlock.gif            // push onto stack and forward the request
30InBlock.gif            sinkStack.Push(this,null);
31InBlock.gif            _nextSink.AsyncProcessRequest(sinkStack,msg,headers,stream);
32ExpandedSubBlockEnd.gif        }

33InBlock.gif
34InBlock.gif
35InBlock.gif        public void AsyncProcessResponse(IClientResponseChannelSinkStack sinkStack, 
36InBlock.gif                                            object state, 
37InBlock.gif                                            ITransportHeaders headers, 
38InBlock.gif                                            Stream stream) 
39ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
40InBlock.gif
41InBlock.gif            // deflate the response
42InBlock.gif            stream = 
43InBlock.gif                CompressionHelper.getUncompressedStreamCopy(stream);
44InBlock.gif
45InBlock.gif            // forward the request
46InBlock.gif            sinkStack.AsyncProcessResponse(headers,stream);
47ExpandedSubBlockEnd.gif        }

48InBlock.gif
49InBlock.gif
50InBlock.gif        public Stream GetRequestStream(IMessage msg, 
51InBlock.gif                                       ITransportHeaders headers) 
52ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
53InBlock.gif            return _nextSink.GetRequestStream(msg, headers);
54ExpandedSubBlockEnd.gif        }

55InBlock.gif
56InBlock.gif
57InBlock.gif        public void ProcessMessage(IMessage msg, 
58InBlock.gif                                   ITransportHeaders requestHeaders, 
59InBlock.gif                                   Stream requestStream, 
60InBlock.gif                                   out ITransportHeaders responseHeaders, 
61InBlock.gif                                   out Stream responseStream) 
62ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
63InBlock.gif            // generate a compressed stream using NZipLib
64InBlock.gif
65InBlock.gif            Stream localrequestStream  = 
66InBlock.gif                CompressionHelper.getCompressedStreamCopy(requestStream);
67InBlock.gif
68InBlock.gif            Stream localresponseStream;
69InBlock.gif            // forward the call to the next sink
70InBlock.gif            _nextSink.ProcessMessage(msg,
71InBlock.gif                                     requestHeaders,
72InBlock.gif                                     localrequestStream, 
73InBlock.gif                                     out responseHeaders, 
74InBlock.gif                                     out localresponseStream);
75InBlock.gif
76InBlock.gif            // deflate the response
77InBlock.gif            responseStream = 
78InBlock.gif                CompressionHelper.getUncompressedStreamCopy(localresponseStream);
79InBlock.gif
80ExpandedSubBlockEnd.gif        }

81ExpandedBlockEnd.gif    }

 

1None.gifpublic classCompressionServerSinkProvider: IServerChannelSinkProvider
2ExpandedBlockStart.gifContractedBlock.gif    dot.gif{
 3InBlock.gif        private IServerChannelSinkProvider _nextProvider;
 4InBlock.gif
 5InBlock.gif        public CompressionServerSinkProvider(IDictionary properties, ICollection providerData) 
 6ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 7InBlock.gif            // not yet needed
 8ExpandedSubBlockEnd.gif        }
 9InBlock.gif
10InBlock.gif        public IServerChannelSinkProvider Next
11ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
12ExpandedSubBlockStart.gifContractedSubBlock.gif            get dot.gif{
13InBlock.gif                return _nextProvider; 
14ExpandedSubBlockEnd.gif            }

15ExpandedSubBlockStart.gifContractedSubBlock.gif            set dot.gif{
16InBlock.gif                _nextProvider = value;
17ExpandedSubBlockEnd.gif            }

18ExpandedSubBlockEnd.gif        }

19InBlock.gif
20InBlock.gif        public IServerChannelSink CreateSink(IChannelReceiver channel)
21ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
22InBlock.gif            // create other sinks in the chain
23InBlock.gif            IServerChannelSink next = _nextProvider.CreateSink(channel);                
24InBlock.gif    
25InBlock.gif            // put our sink on top of the chain and return it                
26InBlock.gif            return new CompressionServerSink(next);
27ExpandedSubBlockEnd.gif        }

28InBlock.gif
29InBlock.gif        public void GetChannelData(IChannelDataStore channelData)
30ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
31InBlock.gif            // not yet needed
32ExpandedSubBlockEnd.gif        }

33InBlock.gif
34ExpandedBlockEnd.gif    }

 

None.gifusingSystem;
None.gifusingSystem.Runtime.Remoting.Channels;
None.gifusingSystem.Runtime.Remoting.Messaging;
None.gifusingSystem.IO;
None.gif
None.gifnamespaceCompressionSink
ExpandedBlockStart.gifContractedBlock.gifdot.gif{
InBlock.gif
InBlock.gif    public class CompressionServerSink: BaseChannelSinkWithProperties,
InBlock.gif        IServerChannelSink
ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
InBlock.gif
InBlock.gif        private IServerChannelSink _nextSink;
InBlock.gif
InBlock.gif        public CompressionServerSink(IServerChannelSink next) 
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            _nextSink = next;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        public IServerChannelSink NextChannelSink 
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            get 
ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
InBlock.gif                return _nextSink;
ExpandedSubBlockEnd.gif            }

ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        public void AsyncProcessResponse(IServerResponseChannelSinkStack sinkStack, 
InBlock.gif            object state, 
InBlock.gif            IMessage msg, 
InBlock.gif            ITransportHeaders headers, 
InBlock.gif            Stream stream) 
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            // compressing the response
InBlock.gif            stream=CompressionHelper.getCompressedStreamCopy(stream);
InBlock.gif
InBlock.gif            // forwarding to the stack for further processing
InBlock.gif            sinkStack.AsyncProcessResponse(msg,headers,stream);
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        public Stream GetResponseStream(IServerResponseChannelSinkStack sinkStack, 
InBlock.gif            object state, 
InBlock.gif            IMessage msg, 
InBlock.gif            ITransportHeaders headers)
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            return null;
ExpandedSubBlockEnd.gif        }

InBlock.gif
InBlock.gif        public ServerProcessing ProcessMessage(IServerChannelSinkStack sinkStack, 
InBlock.gif            IMessage requestMsg, 
InBlock.gif            ITransportHeaders requestHeaders,
InBlock.gif            Stream requestStream, 
InBlock.gif            out IMessage responseMsg, 
InBlock.gif            out ITransportHeaders responseHeaders, 
InBlock.gif            out Stream responseStream) 
ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
InBlock.gif            // uncompressing the request
InBlock.gif            Stream  localrequestStream = 
InBlock.gif                CompressionHelper.getUncompressedStreamCopy(requestStream);
InBlock.gif
InBlock.gif            // pushing onto stack and forwarding the call
InBlock.gif            sinkStack.Push(this,null);
InBlock.gif
InBlock.gif            Stream localresponseStream;
InBlock.gif            ServerProcessing srvProc = _nextSink.ProcessMessage(sinkStack,
InBlock.gif                requestMsg,
InBlock.gif                requestHeaders,
InBlock.gif                localrequestStream,
InBlock.gif                out responseMsg,
InBlock.gif                out responseHeaders,
InBlock.gif                out localresponseStream);
InBlock.gif
InBlock.gif            // compressing the response
InBlock.gif            responseStream=
InBlock.gif                CompressionHelper.getCompressedStreamCopy(localresponseStream);
InBlock.gif
InBlock.gif            // returning status information
InBlock.gif            return srvProc;
ExpandedSubBlockEnd.gif        }

ExpandedSubBlockEnd.gif    }

ExpandedBlockEnd.gif}

None.gif

 

1None.gifpublic classCompressionHelper 
2ExpandedBlockStart.gifContractedBlock.gif    dot.gif{
 3InBlock.gif
 4ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 5InBlock.gif        /// refactor  by zendy
 6InBlock.gif        /// </summary>
 7InBlock.gif        /// <param name="inStream"></param>
 8ExpandedSubBlockEnd.gif        /// <returns></returns>

 9InBlock.gif        public static Stream getCompressedStreamCopy(Stream inStream) 
10ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
11InBlock.gif            MemoryStream outStream = new MemoryStream();
12InBlock.gif            Deflater mDeflater = new Deflater(Deflater.BEST_COMPRESSION);
13InBlock.gif            DeflaterOutputStream compressStream = new DeflaterOutputStream(outStream,mDeflater);
14InBlock.gif
15InBlock.gif            byte[] buf = new Byte[4096];
16InBlock.gif            int cnt = inStream.Read(buf,0,4096);
17ExpandedSubBlockStart.gifContractedSubBlock.gif            while (cnt>0) dot.gif{
18InBlock.gif                compressStream.Write(buf,0,cnt);
19InBlock.gif                cnt = inStream.Read(buf,0,4096);
20ExpandedSubBlockEnd.gif            }

21InBlock.gif            compressStream.Finish();
22InBlock.gif            //modify by zendy //这个设置非常重要,否则会导致后续Sink在处理该stream时失败,在原来的源码中就是因为没有这个处理导致程序运行失败
23InBlock.gif            outStream.Seek(0,SeekOrigin.Begin);
24InBlock.gif            return outStream;
25ExpandedSubBlockEnd.gif        }

26InBlock.gif
27ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
28InBlock.gif        /// refactor  by zendy
29InBlock.gif        /// </summary>
30InBlock.gif        /// <param name="inStream"></param>
31ExpandedSubBlockEnd.gif        /// <returns></returns>

32InBlock.gif        public static Stream getUncompressedStreamCopy(Stream inStream) 
33ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
34InBlock.gif            InflaterInputStream unCompressStream = new InflaterInputStream(inStream); 
35InBlock.gif            MemoryStream outStream = new MemoryStream();
36InBlock.gif            int mSize;
37InBlock.gif            Byte[] mWriteData = new Byte[4096];
38InBlock.gif            while(true)
39ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
40InBlock.gif                mSize = unCompressStream.Read(mWriteData, 0, mWriteData.Length);
41InBlock.gif                if (mSize > 0)
42ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
43InBlock.gif                    outStream.Write(mWriteData, 0, mSize);
44ExpandedSubBlockEnd.gif                }

45InBlock.gif                else
46ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
47InBlock.gif                    break;
48ExpandedSubBlockEnd.gif                }

49ExpandedSubBlockEnd.gif            }

50InBlock.gif            unCompressStream.Close();
51InBlock.gif            //modify by zendy//这个设置非常重要,否则会导致后续Sink在处理该stream时失败,,在原来的源码中就是因为没有这个处理导致程序运行失败
52InBlock.gif            outStream.Seek(0,SeekOrigin.Begin);
53InBlock.gif            return outStream;
54ExpandedSubBlockEnd.gif        }

55ExpandedBlockEnd.gif    }


BTW,这个Sink还可以扩展,比如判断需要压缩Stream的大小,如果很大,就压缩,否则不压缩(可以在responseHeaders和requestHeaders添加是否 已经压缩的标记)

转载于:https://www.cnblogs.com/daitengfei/archive/2006/04/04/366366.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/497319.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

江西省2019计算机二级报名日期,2020年3月江西计算机等级报名时间、报名入口【2019年12月18日-27日】...

【导语】《2020年3月江西全国计算机等级考试工作通知》现已发布。2020年3月江西计算机等级报名时间&#xff1a;2019年12月18日-27日&#xff0c;考试时间&#xff1a;2020年3月28日-30日&#xff0c;小编现将报考信息发布如下&#xff1a;一、报名时间2020年3月江西计算机等级…

Replace Array with Object(以对象取代数组)

有一个数组&#xff0c;其中的元素各自代表不同的东西 String[] row new String[3]; row[0] "Liverpool"; row[1] "15"; 重构&#xff1a;以对象替换数组。对于数组中的每个元素&#xff0c;以一个字段来表示 Performance row new Performance(); r…

PNAS最新研究揭示大脑如何学习语言

来源&#xff1a;生物360概要&#xff1a;美国一项新研究表明&#xff0c;人类用于学习语言的大脑回路还能“兼职”其他用途&#xff0c;而非此前认为的是专门用于学习语言的模块。美国一项新研究表明&#xff0c;人类用于学习语言的大脑回路还能“兼职”其他用途&#xff0c;而…

ASP.NET2.0 ObjectDataSource的使用详解

介绍ObjectDataSource的使用&#xff0c;按照dudu的建议为了节省篇幅&#xff0c;做成连接&#xff0c;这里仅提供前三篇&#xff0c;后面还有几篇以后再补充吧ASP.NET2.0 ObjectDataSource的使用详解&#xff08;1&#xff09; ASP.NET2.0 ObjectDataSource的使用详解&#xf…

2018年12月计算机一级试题答案,2018年12月计算机一级MSOffice冲刺题及答案(7)

[1] 下列不是微机总线的是( )。[参考答案C][A] 数据总线[B] 地址总线[C] 信息总线[D] 控制总线[2] 下列各进制数中最大的数是( )。[参考答案D][A] 227O[B] 1FFH[C] 1010001B[D] 789D[3] ( )不是微型计算机必须的工作环境。 [参考答案A][A] 恒温[B] 良好的接地线路[C] 远离强磁场…

Duplicate Observed Data(复制“被监视数据”)

一些领域数据置身于GUI控件中&#xff0c;而领域函数需要访问这些数据 重构&#xff1a;将该数据复制到一个领域对象中。建立一个Observer 模式&#xff0c;可以同步领域对象和GUI 对象内的重复数据。 动机 一个分层良好的系统&#xff0c;应该将处理用户界面和处理业务逻辑的代…

Landing.AI创始人及CEO 吴恩达:人工智能与先进制造

来源&#xff1a;亿欧概要&#xff1a;工业互联网是工业革命和新一代科技革命的交汇&#xff0c;这个变革内涵非常广&#xff0c;包含很多新的业务模式、新的业态、新的产业机遇&#xff0c;同时也会带来很多新技术的创新。工业互联网是工业革命和新一代科技革命的交汇&#xf…

[导入]Ajax初试

Ajax已经听说了很长时间了&#xff0c;一致没有使用&#xff0c;感觉应该是不错的。今天作了一个简单的测试&#xff0c;嘿嘿&#xff0c;还不错&#xff01;文章来源:http://blog.csdn.net/AloneSword/archive/2006/04/30/699138.aspx转载于:https://www.cnblogs.com/wanna51/…

计算机考研落榜了怎么办,考研落榜了怎么办

路漫漫其修远兮&#xff0c;吾将上下而求索什么东西或许对别人有用&#xff0c;但是对我们自己一点用都没有呢&#xff1f;那就是安慰人的话。什么“尽吾志也&#xff0c;而不能至者&#xff0c;可以无悔矣”&#xff0c;什么“是非成败转头空&#xff0c;青山依旧在&#xff0…

详解LSTM:神经网络的记忆机制是这样炼成的

来源&#xff1a;人工智能头条编译 | AI100第一次接触长短期记忆神经网络&#xff08;LSTM&#xff09;时&#xff0c;我惊呆了。原来&#xff0c;LSTM是神经网络的扩展&#xff0c;非常简单。深度学习在过去的几年里取得了许多惊人的成果&#xff0c;均与LSTM息息相关。因此&a…

个别学生计算机辅导计划,网络学院计算机基础统考辅导计划.doc

PAGEPAGE 37网络学院计算机基础统考辅导共分四次课的时间&#xff0c;2008年3月15日  08:3011:302008年3月22日  08:3011:302008年3月22日  14:0017:002008年4月05日  08:3011:30统考情况简要分析考试方式&#xff1a;机考考试时间&#xff1a;90分钟满分&#xff1a;10…

Change Unidirectional Association to Bidirectional(将单向关联改为双向关联)

两个类都需要使用对方特性&#xff0c;但其间只有一个单向连接 重构&#xff1a;添加一个反向指针&#xff0c;并使修改函数能够同时更新两条连接 由哪个类负责控制关联关系。建议单个类来操控&#xff0c;因为这样就可以将所有处理关联关系的逻辑安置于一地。 1、如果两者都是…

我的作品-图书馆信息管理系统

这曾经是我的数据库课程设计中开发的程序&#xff0c;而且“有幸”当上了我以前高中同学的毕业设计。下面公布几张图片待我的那位同学毕设通过后我就公开源代码&#xff01;哈哈 转载于:https://www.cnblogs.com/wpwen/archive/2006/05/14/399914.html

计算机不能显示可移动磁盘咋办,U盘插上电脑不显示“可移动磁盘”该怎么办...

U盘插上电脑不显示“可移动磁盘”该怎么办重新分配盘符1、右击我的电脑&#xff0c;在弹出的快捷菜单中选择治理命令&#xff0c;进入到计算机治理窗口。2、依次展开存储/可移动存储&#xff0c;单击磁盘治理一项&#xff0c;在窗口右侧&#xff0c;看到U盘运行状态为良好&…

漂亮图片演示ajax制作教程-lightbox

漂亮图片演示ajax制作教程&#xff0d;lightbox 这种效果就像你关闭计算机时所得到的那种效果。在不刷新页面的情况下实现大图片浏览。过渡完美。大家可以看看效果&#xff1a;http://www.evaxp.com/pic/这个演示我是用golive做得。手动添加。错乱排列。主要就是添加这么一段代…

Encapsulate Collection(封装集合)

函数直接返回了一个集合 public class Person {private Set<Course> courses;public Set<Course> getCourses() {return courses;}public void setCourses(final Set<Course> courses) {this.courses courses;} } 重构&#xff1a;让这个函数返回该集合的…

CNNIC报告:我国网民达7.72亿 人工智能取得重要进展

来源&#xff1a;网络大数据概要&#xff1a;报告显示&#xff0c;截至2017年12月&#xff0c;我国网民规模达7.72亿&#xff0c;全年共计新增网民4074万人。互联网普及率为55.8%&#xff0c;较2016年底提升2.6个百分点。中国互联网络信息中心(CNNIC)今日发布第41次《中国互联网…

sakura计算机谱子,【14.08.13自拟】SAKURA急求生物股长的简谱

该楼层疑似违规已被系统折叠 隐藏此楼查看此楼生物股长 - Sakura夏游云 记谱1bA356 [3][2] [3][2] [1]7[1] 7[1] 753356 [3][2] [3][2] [1]7[1][2] 5 [5][2][3]356 [3][2] [3][2] [1]7[1] 7[1] 75367[1] 675356 67[1] 67 [5][3]间奏56[3][2][1] 7 5 3 2 1 【[5] [3]】56[3][2][…

Javascript里使用Dom操作Xml

一&#xff0e;本笔记使用的Xml文件 二&#xff0e;IXMLDOMDocument/DOMDocument简介 2&#xff0e;1 属性 2&#xff0e;1&#xff0e;1 parseError 2&#xff0e;1&#xff0e;2 async. 2&#xff0e;1&#xff0e;3 xml 2&#xff0e;1&#xff0e;4 text 3 2&am…

Replace Type Code with Class(以类取代类型码)

类之中有一个数值类型码&#xff0c;但它不影响类的行为 public class Person {public static final int O 0;public static final int A 1;public static final int B 2;public static final int AB 3;private int bloodGroup;public void setBloodGroup(int arg) {this.…