Home
last modified time | relevance | path

Searched refs:Charset (Results 1 – 25 of 67) sorted by relevance

123

/libcore/luni/src/main/java/java/nio/charset/
DStandardCharsets.java30 public static final Charset ISO_8859_1 = Charset.forName("ISO-8859-1");
35 public static final Charset US_ASCII = Charset.forName("US-ASCII");
40 public static final Charset UTF_8 = Charset.forName("UTF-8");
45 public static final Charset UTF_16 = Charset.forName("UTF-16");
50 public static final Charset UTF_16BE = Charset.forName("UTF-16BE");
55 public static final Charset UTF_16LE = Charset.forName("UTF-16LE");
DCharset.java155 public abstract class Charset implements Comparable<Charset> { class
156 private static final HashMap<String, Charset> CACHED_CHARSETS = new HashMap<String, Charset>();
158 private static final Charset DEFAULT_CHARSET = getDefaultCharset();
177 protected Charset(String canonicalName, String[] aliases) { in Charset() method in Charset
221 public static SortedMap<String, Charset> availableCharsets() { in availableCharsets()
223 … TreeMap<String, Charset> charsets = new TreeMap<String, Charset>(String.CASE_INSENSITIVE_ORDER); in availableCharsets()
225 Charset charset = NativeConverter.charsetForName(charsetName); in availableCharsets()
231 Iterator<Charset> it = charsetProvider.charsets(); in availableCharsets()
233 Charset cs = it.next(); in availableCharsets()
244 private static Charset cacheCharset(String charsetName, Charset cs) { in cacheCharset()
[all …]
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/
DCharsetTest.java21 import java.nio.charset.Charset;
47 for (String charsetName : Charset.availableCharsets().keySet()) { in test_allAvailableCharsets()
54 Charset cs = Charset.forName(charsetName); in test_allAvailableCharsets()
65 assertEquals("UTF-8", Charset.defaultCharset().name()); in test_defaultCharset()
77 Set<String> names = Charset.availableCharsets().keySet(); in test_isRegistered()
89 Charset cs = Charset.forName(name); in test_isRegistered()
97 Charset cs = Charset.forName(name); in test_isRegistered()
104 assertNotNull(Charset.forName("ISO-8859-1")); in test_guaranteedCharsetsAvailable()
105 assertNotNull(Charset.forName("US-ASCII")); in test_guaranteedCharsetsAvailable()
106 assertNotNull(Charset.forName("UTF-16")); in test_guaranteedCharsetsAvailable()
[all …]
DCharsetEncoder2Test.java23 import java.nio.charset.Charset;
40 Charset cs = Charset.forName("UTF-8"); //$NON-NLS-1$ in test_ConstructorLjava_nio_charset_CharsetFF()
48 Charset cs = Charset.forName("ISO8859-1"); //$NON-NLS-1$ in test_ConstructorLjava_nio_charset_CharsetFF()
73 protected MockCharsetEncoderForHarmony141(Charset cs, in MockCharsetEncoderForHarmony141()
78 public MockCharsetEncoderForHarmony141(Charset cs, in MockCharsetEncoderForHarmony141()
91 public MockCharsetEncoderForHarmony491(Charset arg0, float arg1, in MockCharsetEncoderForHarmony491()
121 static final class MockMalfunctionCharset extends Charset {
127 public boolean contains(Charset cs) { in contains()
132 return Charset.forName("UTF-8").newDecoder(); in newDecoder()
145 public MockMalfunctionEncoder(Charset cs) { in MockMalfunctionEncoder()
[all …]
DCharsetDecoder2Test.java24 import java.nio.charset.Charset;
44 Charset cs = Charset.forName("UTF-8"); //$NON-NLS-1$ in test_ConstructorLjava_nio_charset_CharsetFF()
56 protected MockCharsetDecoderForHarmony142(Charset cs, in MockCharsetDecoderForHarmony142()
91 CharsetDecoder decoder2 = Charset.forName("UTF-16").newDecoder(); in test_decode()
131 static final class MockMalfunctionCharset extends Charset {
137 public boolean contains(Charset cs) { in contains()
155 public MockMalfunctionDecoder(Charset cs) { in MockMalfunctionDecoder()
169 public MockMalfunctionEncoder(Charset cs) { in MockMalfunctionEncoder()
184 Charset cs = Charset.forName("UTF-8"); in testDecodeLjava_nio_ByteBuffer_ReplaceOverflow()
211 public MockMalformedDecoder(Charset cs) { in MockMalformedDecoder()
[all …]
DAbstractCharsetTestCase.java22 import java.nio.charset.Charset;
44 protected Charset testingCharset;
53 this.testingCharset = Charset.forName(this.canonicalName); in setUp()
105 Charset c = Charset.forName(this.aliases[i]); in testAliases()
DGBCharsetEncoderTest.java21 import java.nio.charset.Charset;
29 private static final Charset CS = Charset.forName("gb18030");
DUTFCharsetEncoderTest.java21 import java.nio.charset.Charset;
29 private static final Charset CS = Charset.forName("utf-8");
DUTF16BECharsetEncoderTest.java21 import java.nio.charset.Charset;
29 private static final Charset CS = Charset.forName("utf-16be");
DUTF16LECharsetEncoderTest.java21 import java.nio.charset.Charset;
29 private static final Charset CS = Charset.forName("utf-16le");
DISOCharsetEncoderTest.java21 import java.nio.charset.Charset;
33 private static final Charset CS = Charset.forName("iso-8859-1");
DISOCharsetDecoderTest.java21 import java.nio.charset.Charset;
29 cs = Charset.forName("iso-8859-1"); in setUp()
DUTF16CharsetEncoderTest.java22 import java.nio.charset.Charset;
32 private static final Charset CS = Charset.forName("utf-16");
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/lang/
DStringTest.java22 import java.nio.charset.Charset;
574 new String(new byte[8], 0, 4, Charset.defaultCharset()); in test_ConstructorBIIL()
575 new String(new byte[8], 8, 0, Charset.defaultCharset()); in test_ConstructorBIIL()
576 new String(new byte[0], 0, 0, Charset.defaultCharset()); in test_ConstructorBIIL()
579 new String(new byte[8], 0, 9, Charset.defaultCharset()); in test_ConstructorBIIL()
585 new String(new byte[8], 9, 0, Charset.defaultCharset()); in test_ConstructorBIIL()
591 new String(new byte[8], -1, 0, Charset.defaultCharset()); in test_ConstructorBIIL()
597 new String(new byte[8], 9, -1, Charset.defaultCharset()); in test_ConstructorBIIL()
603 new String(null, -1, 0, Charset.defaultCharset()); in test_ConstructorBIIL()
609 new String(null, 0, -1, Charset.defaultCharset()); in test_ConstructorBIIL()
[all …]
/libcore/luni/src/test/java/libcore/java/nio/charset/
DCharsetEncoderTest.java21 import java.nio.charset.Charset;
30 Charset ascii = Charset.forName("US-ASCII"); in test_replaceWith()
41 byte[] result = Charset.forName(charset).newEncoder().replacement(); in assertReplacementBytesForEncoder()
67 Charset cs = Charset.forName("UTF-32BE"); in testSurrogatePairAllAtOnce()
81 Charset cs = Charset.forName("UTF-32BE"); in testMalformedSurrogatePair()
116 Charset cs = Charset.forName("UTF-32BE"); in testCharsetEncoderSplitSurrogates()
142 Charset cs = Charset.forName("UTF-32BE"); in testFlushWithoutEndOfInput()
DCharsetDecoderTest.java22 import java.nio.charset.Charset;
31 CharsetDecoder d = Charset.forName("UTF-16").newDecoder(); in test_replaceWith()
41 CharsetDecoder decoder = Charset.forName("UTF-16").newDecoder(); in test_ByteArray_decode_no_offset()
55 CharsetDecoder decoder = Charset.forName("UTF-16").newDecoder(); in test_ByteArray_decode_with_offset()
71 CharsetDecoder decoder = Charset.forName("UTF-16").newDecoder(); in test_ByteArray_decode_with_offset_using_facade_method()
87 CharsetEncoder encoder = Charset.forName(charsetName).newEncoder(); in encode()
92 CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); in testUtf8BytesSplitAcrossMultipleWrites()
DOldCharsetEncoderDecoderBufferTest.java21 import java.nio.charset.Charset;
38 CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); in testDecoderOutputBuffer()
70 CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder(); in testDecoderInputBuffer()
96 CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder(); in testEncoderOutputBuffer()
128 CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder(); in testEncoderInputBuffer()
DCharset_TestGenerator.java21 import java.nio.charset.Charset;
31 Charset charset;
217 static void genEncoded (Charset charset, CharBuffer cb) { in genEncoded()
234 static void genDecoded (Charset charset, ByteBuffer bb) { in genDecoded()
256 genEncoded(Charset.forName("MacRoman"), CharBuffer.wrap(chars)); in main()
/libcore/luni/src/main/java/java/nio/charset/spi/
DCharsetProvider.java19 import java.nio.charset.Charset;
37 public abstract Iterator<Charset> charsets(); in charsets()
49 public abstract Charset charsetForName(String charsetName); in charsetForName()
/libcore/luni/src/main/java/java/net/
DURLDecoder.java21 import java.nio.charset.Charset;
45 return UriCodec.decode(s, true, Charset.defaultCharset(), true); in decode()
60 return UriCodec.decode(s, true, Charset.forName(charsetName), true); in decode()
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/io/
DInputStreamReaderTest.java29 import java.nio.charset.Charset;
183 Charset cs = Charset.forName("utf-8"); in test_close()
184 assertEquals(cs, Charset.forName(reader.getEncoding())); in test_close()
241 assertEquals(Charset.forName(reader2.getEncoding()), Charset in test_ConstructorLjava_io_InputStreamLjava_lang_String()
245 assertEquals(Charset.forName(reader2.getEncoding()), Charset in test_ConstructorLjava_io_InputStreamLjava_lang_String()
256 Charset cs = Charset.forName("utf-8"); in test_ConstructorLjava_io_InputStreamLjava_nio_charset_Charset()
264 reader = new InputStreamReader(in, (Charset) null); in test_ConstructorLjava_io_InputStreamLjava_nio_charset_Charset()
270 assertEquals(Charset.forName(reader2.getEncoding()), cs); in test_ConstructorLjava_io_InputStreamLjava_nio_charset_Charset()
280 CharsetDecoder decoder = Charset.forName("utf-8").newDecoder(); in test_ConstructorLjava_io_InputStreamLjava_nio_charset_CharsetDecoder()
294 assertEquals(Charset.forName(reader2.getEncoding()), decoder.charset()); in test_ConstructorLjava_io_InputStreamLjava_nio_charset_CharsetDecoder()
[all …]
/libcore/luni/src/test/java/libcore/java/io/
DOldOutputStreamWriterTest.java26 import java.nio.charset.Charset;
74 Charset.defaultCharset(), in test_ConstructorLjava_io_OutputStream()
75 Charset.forName(writer.getEncoding())); in test_ConstructorLjava_io_OutputStream()
118 Charset.forName("8859_1"), in test_ConstructorLjava_io_OutputStreamLjava_lang_String()
119 Charset.forName(osw.getEncoding())); in test_ConstructorLjava_io_OutputStreamLjava_lang_String()
126 Charset cs = Charset.forName("ascii"); in test_ConstructorLjava_io_OutputStreamLjava_nio_charset_Charset()
136 writer = new OutputStreamWriter(out, (Charset) null); in test_ConstructorLjava_io_OutputStreamLjava_nio_charset_Charset()
144 cs, Charset.forName(writer.getEncoding())); in test_ConstructorLjava_io_OutputStreamLjava_nio_charset_Charset()
152 Charset cs = Charset.forName("ascii"); in test_ConstructorLjava_io_OutputStreamLjava_nio_charset_CharsetEncoder()
171 cs, Charset.forName(writer.getEncoding())); in test_ConstructorLjava_io_OutputStreamLjava_nio_charset_CharsetEncoder()
[all …]
/libcore/luni/src/test/java/libcore/java/lang/
DStringTest.java24 import java.nio.charset.Charset;
42 public EvilCharsetDecoder(Charset cs) { in EvilCharsetDecoder()
64 public EvilCharsetEncoder(Charset cs) { in EvilCharsetEncoder()
77 private static final Charset EVIL_CHARSET = new Charset("evil", null) {
78 public boolean contains(Charset charset) { return false; }
107 assertEquals("a\u0666b", new String(bytes, 1, bytes.length - 2, Charset.forName("UTF-8"))); in testString_BIICharset()
112 assertEquals("a\u0666b", new String(bytes, Charset.forName("UTF-8"))); in testString_BCharset()
116 Charset cs = EVIL_CHARSET; in testStringFromCharset_MaliciousCharset()
129 … assertEquals("[97, 63, 98]", Arrays.toString("a\u0666b".getBytes(Charset.forName("US-ASCII")))); in test_getBytes_bad()
134 Charset cs = Charset.forName("UTF-8"); in test_getBytes_UTF_8()
[all …]
/libcore/benchmarks/src/benchmarks/regression/
DDefaultCharsetBenchmark.java19 import java.nio.charset.Charset;
26 Charset.defaultCharset(); in time_defaultCharset()
DCharsetForNameBenchmark.java19 import java.nio.charset.Charset;
42 Charset.forName(charsetName); in timeCharsetForName()

123