| 20 | import avian.Utf8; |
| 21 | |
| 22 | public final class String |
| 23 | implements Comparable<String>, CharSequence, Serializable |
| 24 | { |
| 25 | private static final String UTF_8_ENCODING = "UTF-8"; |
| 26 | private static final String ISO_8859_1_ENCODING = "ISO-8859-1"; |
| 27 | private static final String LATIN_1_ENCODING = "LATIN-1"; |
| 28 | private static final String DEFAULT_ENCODING = UTF_8_ENCODING; |
| 29 | |
| 30 | public static Comparator<String> CASE_INSENSITIVE_ORDER |
| 31 | = new Comparator<String>() { |
| 32 | @Override |
| 33 | public int compare(String a, String b) { |
| 34 | return a.compareToIgnoreCase(b); |
| 35 | } |
| 36 | }; |
| 37 | |
| 38 | private final Object data; |
| 39 | private final int offset; |
| 40 | private final int length; |
| 41 | private int hashCode; |
| 42 | |
| 43 | public String() { |
| 44 | this(new char[0], 0, 0); |
| 45 | } |
| 46 | |
| 47 | public String(char[] data, int offset, int length, boolean copy) { |
| 48 | this((Object) data, offset, length, copy); |
| 49 | } |
| 50 | |
| 51 | public String(char[] data, int offset, int length) { |
| 52 | this(data, offset, length, true); |
| 53 | } |
| 54 | |
| 55 | public String(char[] data) { |
| 56 | this(data, 0, data.length); |
| 57 | } |
| 58 | |
| 59 | public String(byte bytes[], int offset, int length, String charsetName) |
| 60 | throws UnsupportedEncodingException |
| 61 | { |
| 62 | this(bytes, offset, length); |
| 63 | if (! (charsetName.equalsIgnoreCase(UTF_8_ENCODING) |
| 64 | || charsetName.equalsIgnoreCase(ISO_8859_1_ENCODING))) |
| 65 | { |
| 66 | throw new UnsupportedEncodingException(charsetName); |
| 67 | } |
| 68 | } |
| 69 | |
| 70 | public String(byte[] data, int offset, int length, boolean copy) { |
| 71 | this((Object) data, offset, length, copy); |
| 72 | } |
| 73 | |
| 74 | public String(byte[] data, int offset, int length) { |
| 75 | this(data, offset, length, true); |
| 76 | } |
| 77 | |
| 78 | public String(byte[] data) { |
| 79 | this(data, 0, data.length); |
nothing calls this directly
no outgoing calls
no test coverage detected