当前位置: 首页 > news >正文

什么平台可以免费推广产品电商seo搜索优化

什么平台可以免费推广产品,电商seo搜索优化,网络规划设计师第二版,购物网站设计模版1、 Writable接口 由于Hadoop的MapReduce和HDFS都有通信的需求,需要对通信的对象进行序列化。Hadoop并没有采用Java的序列化,而是引入了它自己的系统。 org.apache.hadoop.io中定义了大量的可序列化对象,他们都实现了Writable接口。 1.1 W…

1、 Writable接口

由于Hadoop的MapReduce和HDFS都有通信的需求,需要对通信的对象进行序列化。Hadoop并没有采用Java的序列化,而是引入了它自己的系统。
org.apache.hadoop.io中定义了大量的可序列化对象,他们都实现了Writable接口。

1.1 Writable接口源码

package org.apache.hadoop.io;import java.io.DataOutput;
import java.io.DataInput;
import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;@InterfaceAudience.Public
@InterfaceStability.Stable
public interface Writable {/** * Serialize the fields of this object to <code>out</code>.* */void write(DataOutput out) throws IOException;/** * Deserialize the fields of this object from <code>in</code>.  * */void readFields(DataInput in) throws IOException;
}

1.2 自定义Writable实现类

实现了Writable接口的一个典型例子如下,该代码实际上是在Writable接口源码的注释中。

public class MyWritable implements Writable {// Some data     private int counter;private long timestamp;public void write(DataOutput out) throws IOException {out.writeInt(counter);out.writeLong(timestamp);}public void readFields(DataInput in) throws IOException {counter = in.readInt();timestamp = in.readLong();}public static MyWritable read(DataInput in) throws IOException {MyWritable w = new MyWritable();w.readFields(in);return w;}}

2 WritableComparable接口

WritableComparable是Writable接口和java.lang.Comparable的一个子接口。

2.1 WritableComparable接口源码

package org.apache.hadoop.io;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;@InterfaceAudience.Public
@InterfaceStability.Stable
public interface WritableComparable<T> extends Writable, Comparable<T> {
}

2.2 WritableComparable一个典型实现类

 public class MyWritableComparable implements WritableComparable<MyWritableComparable> {// Some dataprivate int counter;private long timestamp;public void write(DataOutput out) throws IOException {out.writeInt(counter);out.writeLong(timestamp);}public void readFields(DataInput in) throws IOException {counter = in.readInt();timestamp = in.readLong();}public int compareTo(MyWritableComparable o) {int thisValue = this.value;int thatValue = o.value;return (thisValue &lt; thatValue ? -1 : (thisValue==thatValue ? 0 : 1));}public int hashCode() {final int prime = 31;int result = 1;result = prime * result + counter;result = prime * result + (int) (timestamp ^ (timestamp &gt;&gt;&gt; 32));return result}}

2.3 IntWritable

IntWritable实现了WritableComparable。

package org.apache.hadoop.io;
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.classification.InterfaceStability;@InterfaceAudience.Public
@InterfaceStability.Stable
public class IntWritable implements WritableComparable<IntWritable> {private int value;public IntWritable() {}public IntWritable(int value) { set(value); }/** Set the value of this IntWritable. */public void set(int value) { this.value = value; }/** Return the value of this IntWritable. */public int get() { return value; }@Overridepublic void readFields(DataInput in) throws IOException {value = in.readInt();}@Overridepublic void write(DataOutput out) throws IOException {out.writeInt(value);}/** Returns true iff <code>o</code> is a IntWritable with the same value. */@Overridepublic boolean equals(Object o) {if (!(o instanceof IntWritable))return false;IntWritable other = (IntWritable)o;return this.value == other.value;}@Overridepublic int hashCode() {return value;}/** Compares two IntWritables. */@Overridepublic int compareTo(IntWritable o) {int thisValue = this.value;int thatValue = o.value;return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));}@Overridepublic String toString() {return Integer.toString(value);}/** A Comparator optimized for IntWritable. */ public static class Comparator extends WritableComparator {public Comparator() {super(IntWritable.class);}@Overridepublic int compare(byte[] b1, int s1, int l1,byte[] b2, int s2, int l2) {int thisValue = readInt(b1, s1);int thatValue = readInt(b2, s2);return (thisValue<thatValue ? -1 : (thisValue==thatValue ? 0 : 1));}}static {                                        // register this comparatorWritableComparator.define(IntWritable.class, new Comparator());}
}
http://www.wooajung.com/news/33888.html

相关文章:

  • 昆明的房产网站建设重庆网站seo技术
  • 武汉专业做网站公司教育培训机构营销方案
  • 跟犀牛云一样做网站的无锡网站服务公司
  • 晋江网站建设报价电商营销的策略与方法
  • 做投资网站企业宣传ppt
  • 网站建设的商业目的网页设计首页
  • 企业网站建设实验感想图片外链
  • o2o网站建设报价百度输入法
  • 人力资源管理师杭州seo网站优化
  • 运城做网站费用高吗seo优化关键词是什么意思
  • 如何手机网站建立2023年最新时政热点
  • 个体户做网站是怎么备案推广营销软件app
  • 哪里有免费的网站域名推广app用什么平台比较好
  • 用jsp做新闻网站自己如何做网站
  • 珠海品牌机械网站建设常见的网络营销方法
  • 手机怎么修改网页内容怎么关闭seo综合查询
  • 手机号码定位网站开发搜索引擎推广和优化方案
  • wordpress 菜单 颜色如何优化网络连接
  • 购物网站建设存在的问题武汉武汉最新
  • 网站建立服务seo关键词使用
  • 网站策划书主题哈尔滨seo网站管理
  • 资讯型电商网站优缺点kol推广
  • 旅游网站建设的方向qq空间刷赞网站推广
  • 网站建设公司的业务规划建设一个网站的具体步骤
  • 青岛建站开发网络品牌推广
  • 网站的百度推广怎么做百度广告代理商
  • 短视频素材下载网站 免费电脑优化软件推荐
  • wordpress wp roket青岛关键词优化平台
  • 二次开发和一次开发哪个好深圳seo优化排名推广
  • 想做个网站不知道做什么网络推广优化品牌公司