1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18 package org.apache.hadoop.hbase.types;
19
20 import org.apache.hadoop.classification.InterfaceAudience;
21 import org.apache.hadoop.classification.InterfaceStability;
22 import org.apache.hadoop.hbase.util.Bytes;
23 import org.apache.hadoop.hbase.util.Order;
24
25 /**
26 * An {@code DataType} that encodes variable-length values encoded using
27 * {@link Bytes#toBytes(String)}. Includes a termination marker following the
28 * raw {@code byte[]} value. Intended to make it easier to transition
29 * away from direct use of {@link Bytes}.
30 * @see Bytes#toBytes(String)
31 * @see Bytes#toString(byte[], int, int)
32 * @see RawString
33 * @see OrderedString
34 */
35 @InterfaceAudience.Public
36 @InterfaceStability.Evolving
37 public class RawStringTerminated extends TerminatedWrapper<String> {
38
39 /**
40 * Create a {@code RawStringTerminated} using the specified terminator and
41 * {@code order}.
42 * @throws IllegalArgumentException if {@code term} is {@code null} or empty.
43 */
44 public RawStringTerminated(Order order, byte[] term) {
45 super(new RawString(order), term);
46 }
47
48 /**
49 * Create a {@code RawStringTerminated} using the specified terminator and
50 * {@code order}.
51 * @throws IllegalArgumentException if {@code term} is {@code null} or empty.
52 */
53 public RawStringTerminated(Order order, String term) {
54 super(new RawString(order), term);
55 }
56
57 /**
58 * Create a {@code RawStringTerminated} using the specified terminator.
59 * @throws IllegalArgumentException if {@code term} is {@code null} or empty.
60 */
61 public RawStringTerminated(byte[] term) {
62 super(new RawString(), term);
63 }
64
65 /**
66 * Create a {@code RawStringTerminated} using the specified terminator.
67 * @throws IllegalArgumentException if {@code term} is {@code null} or empty.
68 */
69 public RawStringTerminated(String term) {
70 super(new RawString(), term);
71 }
72 }