public class TransformUtil extends Object
限定符和类型 | 方法和说明 |
---|---|
static byte[] |
caclStopKey(ByteBuffer startKey)
生成stop key,假设起始key为aaa,则stopkey是aab
|
static byte[] |
caclStopKey(String startKey)
生成stop key,假设起始key为aaa,则stopkey是aab
|
static String |
calcSignature(String content,
String secretKey)
将指定的内容进行加密,默认采用HmacSHA256方式加密,加密后再对内容进行Base64编码
|
static byte[] |
decodeBuffer(ByteBuffer buffer)
将ByteBuffer对象转换为byte[]
|
static String |
decodeKey(String key)
对指定的key进行解码,默认为UTF-8编码
|
static Map<ByteBuffer,ByteBuffer> |
emptyAttributes()
返回一个空的属性包装
|
static Map<ByteBuffer,ByteBuffer> |
encodeAttributes(Map<String,String> attributes)
将Map
|
static String |
encodeKey(byte[] key)
对指定的key进行编码,默认为UTF-8编码
|
static String |
encodeKey(String key)
对指定的key进行编码,默认为UTF-8编码
|
static byte[] |
generateStopKey(ByteBuffer startKey)
根据start key生成stop key
|
static <T> T |
getContent(byte[] type,
byte[] content)
根据qualifier的类型,返回一个具体的值
|
static byte[] |
getType(Object value)
根据值的类型,返回一个相对应的type
|
static byte[] |
toBytes(Object value)
将对应的值转换为byte[]类型
|
static ByteBuffer |
wrap(String value)
将字符串包装成ByteBuffer类型
|
public static String encodeKey(String key) throws UnsupportedEncodingException
key
- 需要编码的keyUnsupportedEncodingException
- 不支持的编码类型异常public static String encodeKey(byte[] key) throws UnsupportedEncodingException
key
- 需要编码的keyUnsupportedEncodingException
- 不支持的编码类型异常public static String decodeKey(String key) throws UnsupportedEncodingException
key
- 需要解码的keyUnsupportedEncodingException
- 不支持的编码类型异常public static <T> T getContent(byte[] type, byte[] content)
type
- 类型content
- 需要转换的值public static byte[] getType(Object value)
value
- 值public static byte[] toBytes(Object value)
value
- 需要转换的值public static ByteBuffer wrap(String value) throws UnsupportedEncodingException
value
- UnsupportedEncodingException
public static Map<ByteBuffer,ByteBuffer> encodeAttributes(Map<String,String> attributes) throws UnsupportedEncodingException
attributes
- UnsupportedEncodingException
public static Map<ByteBuffer,ByteBuffer> emptyAttributes() throws UnsupportedEncodingException
UnsupportedEncodingException
public static byte[] decodeBuffer(ByteBuffer buffer)
buffer
- public static byte[] generateStopKey(ByteBuffer startKey)
startKey
- public static byte[] caclStopKey(String startKey)
startKey
- public static byte[] caclStopKey(ByteBuffer startKey)
startKey
- Copyright © 2016. All rights reserved.