1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.util;
20
21 import org.apache.hadoop.hbase.classification.InterfaceAudience;
22 import org.apache.hadoop.hbase.classification.InterfaceStability;
23
24
25
26
27
28
29
30
31 @InterfaceAudience.Public
32 @InterfaceStability.Evolving
33 @edu.umd.cs.findbugs.annotations.SuppressWarnings("EQ_DOESNT_OVERRIDE_EQUALS")
34 public class SimplePositionedByteRange extends AbstractPositionedByteRange {
35
36
37
38
39
40 public SimplePositionedByteRange() {
41 super();
42 }
43
44
45
46
47
48
49
50 public SimplePositionedByteRange(int capacity) {
51 this(new byte[capacity]);
52 }
53
54
55
56
57
58 public SimplePositionedByteRange(byte[] bytes) {
59 set(bytes);
60 }
61
62
63
64
65
66
67
68
69 public SimplePositionedByteRange(byte[] bytes, int offset, int length) {
70 set(bytes, offset, length);
71 }
72
73 @Override
74 public PositionedByteRange set(int capacity) {
75 if (super.bytes != null) {
76 throw new ReadOnlyByteRangeException();
77 }
78 return super.set(capacity);
79 }
80
81 @Override
82 public PositionedByteRange set(byte[] bytes) {
83 if (super.bytes != null) {
84 throw new ReadOnlyByteRangeException();
85 }
86 return super.set(bytes);
87 }
88
89 @Override
90 public PositionedByteRange set(byte[] bytes, int offset, int length) {
91 if (super.bytes != null) {
92 throw new ReadOnlyByteRangeException();
93 }
94 return super.set(bytes, offset, length);
95 }
96
97 @Override
98 public PositionedByteRange put(byte val) {
99 throw new ReadOnlyByteRangeException();
100 }
101
102 @Override
103 public PositionedByteRange putShort(short val) {
104 throw new ReadOnlyByteRangeException();
105 }
106
107 @Override
108 public PositionedByteRange putInt(int val) {
109 throw new ReadOnlyByteRangeException();
110 }
111
112 @Override
113 public PositionedByteRange putLong(long val) {
114 throw new ReadOnlyByteRangeException();
115 }
116
117 @Override
118 public int putVLong(long val) {
119 throw new ReadOnlyByteRangeException();
120 }
121
122 @Override
123 public PositionedByteRange put(byte[] val) {
124 throw new ReadOnlyByteRangeException();
125 }
126
127 @Override
128 public PositionedByteRange put(byte[] val, int offset, int length) {
129 throw new ReadOnlyByteRangeException();
130 }
131
132
133 @Override
134 public PositionedByteRange get(int index, byte[] dst) { super.get(index, dst); return this; }
135
136 @Override
137 public PositionedByteRange get(int index, byte[] dst, int offset, int length) {
138 super.get(index, dst, offset, length);
139 return this;
140 }
141
142 @Override
143 public PositionedByteRange put(int index, byte val) {
144 throw new ReadOnlyByteRangeException();
145 }
146
147 @Override
148 public PositionedByteRange putShort(int index, short val) {
149 throw new ReadOnlyByteRangeException();
150 }
151
152 @Override
153 public PositionedByteRange putInt(int index, int val) {
154 throw new ReadOnlyByteRangeException();
155 }
156
157 @Override
158 public int putVLong(int index, long val) {
159 throw new ReadOnlyByteRangeException();
160 }
161
162 @Override
163 public PositionedByteRange putLong(int index, long val) {
164 throw new ReadOnlyByteRangeException();
165 }
166
167 @Override
168 public PositionedByteRange put(int index, byte[] val) {
169 throw new ReadOnlyByteRangeException();
170 }
171
172 @Override
173 public PositionedByteRange put(int index, byte[] val, int offset, int length) {
174 throw new ReadOnlyByteRangeException();
175 }
176
177 @Override
178 public PositionedByteRange deepCopy() {
179 SimplePositionedByteRange clone = new SimplePositionedByteRange(deepCopyToNewArray());
180 clone.position = this.position;
181 return clone;
182 }
183
184 @Override
185 public PositionedByteRange shallowCopy() {
186 SimplePositionedByteRange clone = new SimplePositionedByteRange(bytes, offset, length);
187 clone.position = this.position;
188 return clone;
189 }
190
191 @Override
192 public PositionedByteRange shallowCopySubRange(int innerOffset, int copyLength) {
193 SimplePositionedByteRange clone =
194 new SimplePositionedByteRange(bytes, offset + innerOffset, copyLength);
195 clone.position = this.position;
196 return clone;
197 }
198
199 @Override
200 public PositionedByteRange setLimit(int limit) {
201 throw new ReadOnlyByteRangeException();
202 }
203
204 @Override
205 public PositionedByteRange unset() {
206 throw new ReadOnlyByteRangeException();
207 }
208
209 }