Java Code Examples for org.jboss.netty.util.CharsetUtil#UTF_8
The following examples show how to use
org.jboss.netty.util.CharsetUtil#UTF_8 .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HBaseValueDecoder.java From qmq with Apache License 2.0 | 6 votes |
public static BackupMessageMeta getMessageMeta(byte[] value) { try { if (value != null && value.length > 0) { long sequence = Bytes.getLong(value, 0); long createTime = Bytes.getLong(value, 8); int brokerGroupLength = Bytes.getInt(value, 16); if (brokerGroupLength > 200) { return null; } byte[] brokerGroupBytes = new byte[brokerGroupLength]; System.arraycopy(value, 20, brokerGroupBytes, 0, brokerGroupLength); int messageIdLength = value.length - 20 - brokerGroupLength; byte[] messageIdBytes = new byte[messageIdLength]; System.arraycopy(value, 20 + brokerGroupLength, messageIdBytes, 0, messageIdLength); BackupMessageMeta meta = new BackupMessageMeta(sequence, new String(brokerGroupBytes, CharsetUtil.UTF_8), new String(messageIdBytes, CharsetUtil.UTF_8)); meta.setCreateTime(createTime); return meta; } } catch (Exception ignored) { } return null; }
Example 2
Source File: HBaseStore.java From qmq with Apache License 2.0 | 5 votes |
private static String[] getStringArrays(final byte[][] bs) { if (bs != null) { String[] arr = new String[bs.length]; for (int i = 0; i < arr.length; i++) { arr[i] = new String(bs[i], CharsetUtil.UTF_8); } return arr; } return null; }
Example 3
Source File: KeyValueListImpl.java From qmq with Apache License 2.0 | 4 votes |
@Override public String getStringValue(String qualifier) { byte[] value = getValue(qualifier); return (value == null) ? null : new String(value, CharsetUtil.UTF_8); }