MCPcopy Create free account
hub / github.com/ReadyTalk/avian / setLength

Method setLength

classpath/java/lang/StringBuilder.java:286–314  ·  view source on GitHub ↗
(int v)

Source from the content-addressed store, hash-verified

284 }
285
286 public void setLength(int v) {
287 if (v < 0) {
288 throw new IndexOutOfBoundsException();
289 }
290
291 if (v == 0) {
292 length = 0;
293 chain = null;
294 return;
295 }
296
297 flush();
298
299 int index = length;
300 length = v;
301 for (Cell c = chain; c != null; c = c.next) {
302 int start = index - c.value.length();
303
304 if (v > start) {
305 if (v < index) {
306 c.value = c.value.substring(0, v - start);
307 }
308 break;
309 }
310
311 chain = c.next;
312 index = start;
313 }
314 }
315
316 public void getChars(int srcStart, int srcEnd, char[] dst, int dstStart) {
317 if (srcStart < 0 || srcEnd > length) {

Callers 4

printListMethod · 0.95
hexdumpMethod · 0.95
printListMethod · 0.95

Calls 3

flushMethod · 0.95
lengthMethod · 0.65
substringMethod · 0.45

Tested by 3

printListMethod · 0.76
hexdumpMethod · 0.76
printListMethod · 0.76