Here you can find the source of getRowId(final byte[] rowId, final Charset charset, final boolean base64encodeValues)
Parameter | Description |
---|---|
rowId | the row id to get the string from |
charset | the charset that was used to encode the cell's row |
base64encodeValues | whether or not to base64 encode the returned string |
public static String getRowId(final byte[] rowId, final Charset charset, final boolean base64encodeValues)
//package com.java2s; /**/*from www . j av a 2 s .c o m*/ * Copyright (C) 2016 Hurence (support@hurence.com) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; import java.util.Base64; public class Main { /** * @param rowId the row id to get the string from * @param charset the charset that was used to encode the cell's row * @param base64encodeValues whether or not to base64 encode the returned string * * @return the String representation of the cell's row */ public static String getRowId(final byte[] rowId, final Charset charset, final boolean base64encodeValues) { if (base64encodeValues) { ByteBuffer cellRowBuffer = ByteBuffer.wrap(rowId); ByteBuffer base64Buffer = Base64.getEncoder().encode(cellRowBuffer); return new String(base64Buffer.array(), StandardCharsets.UTF_8); } else { return new String(rowId, charset); } } }