`
rose-zh
  • 浏览: 2468 次
  • 性别: Icon_minigender_1
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论
文章列表
[size=large][/size]  当要在进程间传递对象或持久化对象的时候,就需要序列化对象成字节流,反之当要将接收到或从磁盘读取的字节流转换为对象,就要进行反序列化。Writable是Hadoop的序列化格式,Hadoop定义了这样一个Writable接口。 [html] view plaincopyprint? 1.public interface Writable {  2.  void write(DataOutput out) throws IOException;  3.  void readFields(DataInput in) throws IOExcep ...
[color=blue] 刚接触Hadoop时,对SequenceFile和Writable还产生了一点联想,以为是什么神奇的东西.后来也明白,不过就是自己IO的一些协议,用于自己的输入输出.这里介绍下如何从sequence file中读出和写入Writable数据. Writable类似传输的数据,相对于Java来说等同于对象,只是引用到Hadoop中需要一套协议去进行传输转换这个对象.于是有了里面的 public void write(DataOutput out) throws IOException 和public void readFields(DataInput in) thr ...

hadoop io

从基础的IO包开始阅读。 IO:表示层,将各种数据编码/解码,方便于在网络上传输。 下图是一个大致的结构图,可以看出,大部分的类都是以Writable结 尾的数据结构和基本数据类型。 一、基本数据类型 Hadoop 中,并没有使用java自带的基本类型类(Integer、Float等)而是使用了自己开发的类IntWritable、FloatWritable、BooleanWritable、LongWritable、ByteWritable、BytesWritable、DoubleWritable,他们都实现了接口WritableComparable,接口定义如下: public int ...
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class MyEclipseGen { private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http:// ...
Global site tag (gtag.js) - Google Analytics