@InterfaceAudience.Public @InterfaceStability.Evolving public final class Utils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> int |
lowerBound(List<? extends Comparable<? super T>> list,
T key)
Lower bound binary search.
|
static <T> int |
lowerBound(List<? extends T> list,
T key,
Comparator<? super T> cmp)
Lower bound binary search.
|
static String |
readString(DataInput in)
Read a String as a VInt n, followed by n Bytes in Text format.
|
static int |
readVInt(DataInput in)
Decoding the variable-length integer.
|
static long |
readVLong(DataInput in)
Decoding the variable-length integer.
|
static <T> int |
upperBound(List<? extends Comparable<? super T>> list,
T key)
Upper bound binary search.
|
static <T> int |
upperBound(List<? extends T> list,
T key,
Comparator<? super T> cmp)
Upper bound binary search.
|
static void |
writeString(DataOutput out,
String s)
Write a String as a VInt n, followed by n Bytes as in Text format.
|
static void |
writeVInt(DataOutput out,
int n)
Encoding an integer into a variable-length encoding format.
|
static void |
writeVLong(DataOutput out,
long n)
Encoding a Long integer into a variable-length encoding format.
|
public static void writeVInt(DataOutput out, int n) throws IOException
Utils#writeVLong(out, n)
.out
- output streamn
- The integer to be encodedIOException
writeVLong(DataOutput, long)
public static void writeVLong(DataOutput out, long n) throws IOException
out
- output streamn
- the integer numberIOException
public static int readVInt(DataInput in) throws IOException
(int)Utils#readVLong(in)
.in
- input streamIOException
readVLong(DataInput)
public static long readVLong(DataInput in) throws IOException
in
- input streamIOException
public static void writeString(DataOutput out, String s) throws IOException
out
- s
- IOException
public static String readString(DataInput in) throws IOException
in
- The input stream.IOException
public static <T> int lowerBound(List<? extends T> list, T key, Comparator<? super T> cmp)
T
- Type of the input key.list
- The listkey
- The input key.cmp
- Comparator for the key.public static <T> int upperBound(List<? extends T> list, T key, Comparator<? super T> cmp)
T
- Type of the input key.list
- The listkey
- The input key.cmp
- Comparator for the key.public static <T> int lowerBound(List<? extends Comparable<? super T>> list, T key)
T
- Type of the input key.list
- The listkey
- The input key.public static <T> int upperBound(List<? extends Comparable<? super T>> list, T key)
T
- Type of the input key.list
- The listkey
- The input key.Copyright © 2018 Apache Software Foundation. All rights reserved.