hadoop示例代码
来源:互联网 发布:网络销售靠谱吗 编辑:程序博客网 时间:2024/04/26 06:56
hadoop示例代码
- 序列化和反序列化
IntWritable writable = new IntWritable(10); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); DataOutputStream dataOutputStream = new DataOutputStream(byteArrayOutputStream); writable.write(dataOutputStream); dataOutputStream.close(); byte[] bytes = byteArrayOutputStream.toByteArray(); System.out.println(StringUtils.byteToHexString(bytes)); //解序列化 ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes); DataInputStream input = new DataInputStream(byteArrayInputStream); IntWritable intWritable = new IntWritable(); intWritable.readFields(input); input.close(); System.out.println(intWritable);
- writable对象的比较
IntWritable int1 = new IntWritable(1); IntWritable int2 = new IntWritable(3); RawComparator<IntWritable> comparator = WritableComparator.get(IntWritable.class); System.out.println(comparator.compare(int1,int2)); //也可以直接比较字节流,不需要反序列化,问题是怎么定位这个字节流呢 System.out.println(comparator.compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2));
0 0
- Hadoop MapReduce示例代码
- Hadoop MapReduce示例代码
- hadoop示例代码
- hadoop mapreduce join代码示例及讲解
- hadoop mapreduce读取orcfile的java代码示例
- Hadoop RCFile存储格式详解(源码分析、代码示例)
- Hadoop RCFile存储格式详解(源码分析、代码示例)
- Hadoop 集群运行测试代码(Hadoop 权威指南天气数据示例)
- HADOOP的学习笔记 (第五期) hadoop示例代码分析
- Hadoop 集群运行测试代码(Hadoop 权威指南天气数据示例)
- HADOOP的学习笔记 (第五期) hadoop示例代码分析 .
- 代码示例
- 代码示例
- 示例代码
- 示例代码
- hadoop MapReduce示例
- hadoop FileSystem使用示例
- hadoop上传本地文件示例
- 51NOD 1066 Bash游戏
- bzoj1026 [SCOI2009]windy数
- Runloop和线程的关系
- loadrunner通过web的post请求方法测接口 1
- LeetCode 88. Merge Sorted Array
- hadoop示例代码
- 20170114经济学人封面文章Lifelong Learning
- loadrunner通过web的post请求方法测接口 2
- Android自定义控件的实现
- Goal: English
- Android API Guide for Media Apps —— 媒体应用
- 1004.Counting Leaves (30)
- 3.9 对称三位素数
- 教女朋友学Python(4)——算