equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
87 coder = LATIN1; |
87 coder = LATIN1; |
88 } else { |
88 } else { |
89 value = StringUTF16.newBytesFor(capacity); |
89 value = StringUTF16.newBytesFor(capacity); |
90 coder = UTF16; |
90 coder = UTF16; |
91 } |
91 } |
|
92 } |
|
93 |
|
94 /** |
|
95 * Creates an AbstractStringBuilder with the specified coder and with |
|
96 * the initial capacity equal to the smaller of (capacity + addition) |
|
97 * and Integer.MAX_VALUE. |
|
98 */ |
|
99 AbstractStringBuilder(byte coder, int capacity, int addition) { |
|
100 this.coder = coder; |
|
101 capacity = (capacity < Integer.MAX_VALUE - addition) |
|
102 ? capacity + addition : Integer.MAX_VALUE; |
|
103 value = (coder == LATIN1) |
|
104 ? new byte[capacity] : StringUTF16.newBytesFor(capacity); |
92 } |
105 } |
93 |
106 |
94 /** |
107 /** |
95 * Compares the objects of two AbstractStringBuilder implementations lexicographically. |
108 * Compares the objects of two AbstractStringBuilder implementations lexicographically. |
96 * |
109 * |