@Test public void testBinarySplitKeyParsing01() { final byte[][] splitKeys = TableConfig.parseSplitKeys(1, "\\x01", ""); Assert.assertEquals(1, splitKeys.length); Assert.assertEquals(1, splitKeys[0].length); Assert.assertEquals(0x1, splitKeys[0][0]); }
public static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString) { byte[] splitKeyPrefix = splitKeyPrefixAsString != null ? Bytes.toBytesBinary(splitKeyPrefixAsString) : new byte[0]; byte[][] splitKeys = null; if (splitKeysAsString != null && !splitKeysAsString.isEmpty()) { String[] split = splitKeysAsString.split(","); splitKeys = new byte[split.length][]; for (int i = 0; i < split.length; i++) { splitKeys[i] = Bytes.add(splitKeyPrefix, Bytes.toBytesBinary(split[i])); } } else if (regionCount != null && regionCount <= 1) { } else if (regionCount != null) { byte[] startBytes = splitKeyPrefix.length > 0 ? splitKeyPrefix : new byte[]{(byte)0}; byte[] endBytes = new byte[splitKeyPrefix.length + 16]; System.arraycopy(splitKeyPrefix, 0, endBytes, 0, splitKeyPrefix.length); for (int i = splitKeyPrefix.length; i < endBytes.length; i++) { endBytes[i] = (byte)0xFF; } splitKeys = Bytes.split(startBytes, endBytes, regionCount - 1); splitKeys = Arrays.copyOfRange(splitKeys, 1, splitKeys.length - 1); } return splitKeys; }
TableConfig { public static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString) { byte[] splitKeyPrefix = splitKeyPrefixAsString != null ? Bytes.toBytesBinary(splitKeyPrefixAsString) : new byte[0]; byte[][] splitKeys = null; if (splitKeysAsString != null && !splitKeysAsString.isEmpty()) { String[] split = splitKeysAsString.split(","); splitKeys = new byte[split.length][]; for (int i = 0; i < split.length; i++) { splitKeys[i] = Bytes.add(splitKeyPrefix, Bytes.toBytesBinary(split[i])); } } else if (regionCount != null && regionCount <= 1) { } else if (regionCount != null) { byte[] startBytes = splitKeyPrefix.length > 0 ? splitKeyPrefix : new byte[]{(byte)0}; byte[] endBytes = new byte[splitKeyPrefix.length + 16]; System.arraycopy(splitKeyPrefix, 0, endBytes, 0, splitKeyPrefix.length); for (int i = splitKeyPrefix.length; i < endBytes.length; i++) { endBytes[i] = (byte)0xFF; } splitKeys = Bytes.split(startBytes, endBytes, regionCount - 1); splitKeys = Arrays.copyOfRange(splitKeys, 1, splitKeys.length - 1); } return splitKeys; } }
TableConfig { public static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString) { byte[] splitKeyPrefix = splitKeyPrefixAsString != null ? Bytes.toBytesBinary(splitKeyPrefixAsString) : new byte[0]; byte[][] splitKeys = null; if (splitKeysAsString != null && !splitKeysAsString.isEmpty()) { String[] split = splitKeysAsString.split(","); splitKeys = new byte[split.length][]; for (int i = 0; i < split.length; i++) { splitKeys[i] = Bytes.add(splitKeyPrefix, Bytes.toBytesBinary(split[i])); } } else if (regionCount != null && regionCount <= 1) { } else if (regionCount != null) { byte[] startBytes = splitKeyPrefix.length > 0 ? splitKeyPrefix : new byte[]{(byte)0}; byte[] endBytes = new byte[splitKeyPrefix.length + 16]; System.arraycopy(splitKeyPrefix, 0, endBytes, 0, splitKeyPrefix.length); for (int i = splitKeyPrefix.length; i < endBytes.length; i++) { endBytes[i] = (byte)0xFF; } splitKeys = Bytes.split(startBytes, endBytes, regionCount - 1); splitKeys = Arrays.copyOfRange(splitKeys, 1, splitKeys.length - 1); } return splitKeys; } TableConfig();  TableConfig(byte[][] splitKeys); }
TableConfig { public static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString) { byte[] splitKeyPrefix = splitKeyPrefixAsString != null ? Bytes.toBytesBinary(splitKeyPrefixAsString) : new byte[0]; byte[][] splitKeys = null; if (splitKeysAsString != null && !splitKeysAsString.isEmpty()) { String[] split = splitKeysAsString.split(","); splitKeys = new byte[split.length][]; for (int i = 0; i < split.length; i++) { splitKeys[i] = Bytes.add(splitKeyPrefix, Bytes.toBytesBinary(split[i])); } } else if (regionCount != null && regionCount <= 1) { } else if (regionCount != null) { byte[] startBytes = splitKeyPrefix.length > 0 ? splitKeyPrefix : new byte[]{(byte)0}; byte[] endBytes = new byte[splitKeyPrefix.length + 16]; System.arraycopy(splitKeyPrefix, 0, endBytes, 0, splitKeyPrefix.length); for (int i = splitKeyPrefix.length; i < endBytes.length; i++) { endBytes[i] = (byte)0xFF; } splitKeys = Bytes.split(startBytes, endBytes, regionCount - 1); splitKeys = Arrays.copyOfRange(splitKeys, 1, splitKeys.length - 1); } return splitKeys; } TableConfig();  TableConfig(byte[][] splitKeys); Map<String, ColumnFamilyConfig> getColumnFamilies(); ColumnFamilyConfig getColumnFamilyConfig(String family); Long getMaxFileSize(); void setMaxFileSize(Long maxFileSize); Long getMemStoreFlushSize(); void setMemStoreFlushSize(Long memStoreFlushSize); byte[][] getSplitKeys(); static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString); }
TableConfig { public static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString) { byte[] splitKeyPrefix = splitKeyPrefixAsString != null ? Bytes.toBytesBinary(splitKeyPrefixAsString) : new byte[0]; byte[][] splitKeys = null; if (splitKeysAsString != null && !splitKeysAsString.isEmpty()) { String[] split = splitKeysAsString.split(","); splitKeys = new byte[split.length][]; for (int i = 0; i < split.length; i++) { splitKeys[i] = Bytes.add(splitKeyPrefix, Bytes.toBytesBinary(split[i])); } } else if (regionCount != null && regionCount <= 1) { } else if (regionCount != null) { byte[] startBytes = splitKeyPrefix.length > 0 ? splitKeyPrefix : new byte[]{(byte)0}; byte[] endBytes = new byte[splitKeyPrefix.length + 16]; System.arraycopy(splitKeyPrefix, 0, endBytes, 0, splitKeyPrefix.length); for (int i = splitKeyPrefix.length; i < endBytes.length; i++) { endBytes[i] = (byte)0xFF; } splitKeys = Bytes.split(startBytes, endBytes, regionCount - 1); splitKeys = Arrays.copyOfRange(splitKeys, 1, splitKeys.length - 1); } return splitKeys; } TableConfig();  TableConfig(byte[][] splitKeys); Map<String, ColumnFamilyConfig> getColumnFamilies(); ColumnFamilyConfig getColumnFamilyConfig(String family); Long getMaxFileSize(); void setMaxFileSize(Long maxFileSize); Long getMemStoreFlushSize(); void setMemStoreFlushSize(Long memStoreFlushSize); byte[][] getSplitKeys(); static byte[][] parseSplitKeys(Integer regionCount, String splitKeysAsString, String splitKeyPrefixAsString);  }