Return-Path: X-Original-To: apmail-hbase-commits-archive@www.apache.org Delivered-To: apmail-hbase-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D52D0E8B5 for ; Fri, 15 Mar 2013 18:23:42 +0000 (UTC) Received: (qmail 13460 invoked by uid 500); 15 Mar 2013 18:23:42 -0000 Delivered-To: apmail-hbase-commits-archive@hbase.apache.org Received: (qmail 13412 invoked by uid 500); 15 Mar 2013 18:23:42 -0000 Mailing-List: contact commits-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hbase.apache.org Delivered-To: mailing list commits@hbase.apache.org Received: (qmail 13405 invoked by uid 99); 15 Mar 2013 18:23:42 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 18:23:42 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 15 Mar 2013 18:23:41 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 54E16238890D; Fri, 15 Mar 2013 18:21:36 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1457045 - /hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java Date: Fri, 15 Mar 2013 18:21:36 -0000 To: commits@hbase.apache.org From: tedyu@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20130315182136.54E16238890D@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tedyu Date: Fri Mar 15 18:21:35 2013 New Revision: 1457045 URL: http://svn.apache.org/r1457045 Log: HBASE-8117 Remove redundant byte conversion methods from HConstants (Nick Dimiduk) Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java Modified: hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java?rev=1457045&r1=1457044&r2=1457045&view=diff ============================================================================== --- hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java (original) +++ hbase/trunk/hbase-common/src/main/java/org/apache/hadoop/hbase/HConstants.java Fri Mar 15 18:21:35 2013 @@ -17,6 +17,8 @@ */ package org.apache.hadoop.hbase; +import static org.apache.hadoop.hbase.io.hfile.BlockType.MAGIC_LENGTH; + import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Arrays; @@ -30,8 +32,6 @@ import org.apache.hadoop.classification. import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.hbase.util.Bytes; -import static org.apache.hadoop.hbase.io.hfile.BlockType.MAGIC_LENGTH; - /** * HConstants holds a bunch of HBase-related constants */ @@ -74,14 +74,6 @@ public final class HConstants { //End HFileBlockConstants. - private static byte[] toBytes(String target) { - return target.getBytes(UTF8_CHARSET); - } - - private static String toString(byte[] target) { - return new String(target, UTF8_CHARSET); - } - /** * Status codes used for return values of bulk operations. */ @@ -351,10 +343,10 @@ public final class HConstants { // should go down. /** The root table's name.*/ - public static final byte [] ROOT_TABLE_NAME = toBytes("-ROOT-"); + public static final byte [] ROOT_TABLE_NAME = Bytes.toBytes("-ROOT-"); /** The META table's name. */ - public static final byte [] META_TABLE_NAME = toBytes(".META."); + public static final byte [] META_TABLE_NAME = Bytes.toBytes(".META."); /** delimiter used between portions of a region name */ public static final int META_ROW_DELIMITER = ','; @@ -363,36 +355,35 @@ public final class HConstants { public static final String CATALOG_FAMILY_STR = "info"; /** The catalog family */ - public static final byte [] CATALOG_FAMILY = toBytes(CATALOG_FAMILY_STR); + public static final byte [] CATALOG_FAMILY = Bytes.toBytes(CATALOG_FAMILY_STR); /** The RegionInfo qualifier as a string */ public static final String REGIONINFO_QUALIFIER_STR = "regioninfo"; /** The regioninfo column qualifier */ - public static final byte [] REGIONINFO_QUALIFIER = - toBytes(REGIONINFO_QUALIFIER_STR); + public static final byte [] REGIONINFO_QUALIFIER = Bytes.toBytes(REGIONINFO_QUALIFIER_STR); /** The server column qualifier */ - public static final byte [] SERVER_QUALIFIER = toBytes("server"); + public static final byte [] SERVER_QUALIFIER = Bytes.toBytes("server"); /** The startcode column qualifier */ - public static final byte [] STARTCODE_QUALIFIER = toBytes("serverstartcode"); + public static final byte [] STARTCODE_QUALIFIER = Bytes.toBytes("serverstartcode"); /** The open seqnum column qualifier */ - public static final byte [] SEQNUM_QUALIFIER = toBytes("seqnumDuringOpen"); + public static final byte [] SEQNUM_QUALIFIER = Bytes.toBytes("seqnumDuringOpen"); /** The lower-half split region column qualifier */ - public static final byte [] SPLITA_QUALIFIER = toBytes("splitA"); + public static final byte [] SPLITA_QUALIFIER = Bytes.toBytes("splitA"); /** The upper-half split region column qualifier */ - public static final byte [] SPLITB_QUALIFIER = toBytes("splitB"); + public static final byte [] SPLITB_QUALIFIER = Bytes.toBytes("splitB"); /** * The meta table version column qualifier. * We keep current version of the meta table in this column in -ROOT- * table: i.e. in the 'info:v' column. */ - public static final byte [] META_VERSION_QUALIFIER = toBytes("v"); + public static final byte [] META_VERSION_QUALIFIER = Bytes.toBytes("v"); /** * The current version of the meta table. @@ -761,7 +752,7 @@ public final class HConstants { * The byte array represents for NO_NEXT_INDEXED_KEY; * The actual value is irrelevant because this is always compared by reference. */ - public static final byte [] NO_NEXT_INDEXED_KEY = toBytes("NO_NEXT_INDEXED_KEY"); + public static final byte [] NO_NEXT_INDEXED_KEY = Bytes.toBytes("NO_NEXT_INDEXED_KEY"); /** delimiter used between portions of a region name */ public static final int DELIMITER = ','; public static final String HBASE_CONFIG_READ_ZOOKEEPER_CONFIG = @@ -801,7 +792,7 @@ public final class HConstants { /** Directories that are not HBase user table directories */ public static final List HBASE_NON_USER_TABLE_DIRS = Collections.unmodifiableList(Arrays.asList((String[])ArrayUtils.addAll( - new String[] { toString(META_TABLE_NAME), toString(ROOT_TABLE_NAME) }, + new String[] { Bytes.toString(META_TABLE_NAME), Bytes.toString(ROOT_TABLE_NAME) }, HBASE_NON_TABLE_DIRS.toArray()))); /** Health script related settings. */