public abstract class BinaryComparable extends Object implements Comparable<BinaryComparable>
Text 和 BytesWritable 中会使用到.| Constructor and Description |
|---|
BinaryComparable() |
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(BinaryComparable other)
比较两个二进制内容,二进制内容数组和长度由
getBytes() 和 getLength() 获得. |
int |
compareTo(byte[] other,
int off,
int len)
比较两份二进制内容
|
boolean |
equals(Object other)
判断两份二进制内容是否相同.
|
abstract byte[] |
getBytes()
获取二进制内容数组的虚拟方法,有效数据范围:[0,
getLength()),子类必须实现. |
abstract int |
getLength()
获取二进制内容长度的虚拟方法,子类必须实现.
|
int |
hashCode()
计算二进制内容的哈希值.
|
public abstract int getLength()
public abstract byte[] getBytes()
getLength()),子类必须实现.public int compareTo(BinaryComparable other)
getBytes() 和 getLength() 获得.
直接使用
WritableComparator.compareBytes(byte[], int, int, byte[], int, int)
进行比较
compareTo in interface Comparable<BinaryComparable>public int compareTo(byte[] other,
int off,
int len)
直接使用
WritableComparator.compareBytes(byte[], int, int, byte[], int, int)
进行比较
other - 二进制内容数组off - 内容偏移len - 内容长度public boolean equals(Object other)
Copyright © 2021 Alibaba Cloud Computing. All rights reserved.