Home
last modified time | relevance | path

Searched refs:encoder (Results 1 – 19 of 19) sorted by relevance

/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/charset/
DCharsetEncoderTest.java48 CharsetEncoder encoder; field in CharsetEncoderTest
66 encoder = cs.newEncoder(); in setUp()
68 byte[] replacement = encoder.replacement(); in setUp()
85 assertTrue(encoder.averageBytesPerChar() == AVER_BYTES); in testSpecificDefaultValue()
86 assertTrue(encoder.maxBytesPerChar() == MAX_BYTES); in testSpecificDefaultValue()
90 assertEquals(CodingErrorAction.REPORT, encoder.malformedInputAction()); in testDefaultValue()
91 assertEquals(CodingErrorAction.REPORT, encoder.unmappableCharacterAction()); in testDefaultValue()
92 assertSame(encoder, encoder.onMalformedInput(CodingErrorAction.IGNORE)); in testDefaultValue()
93 assertSame(encoder, encoder.onUnmappableCharacter(CodingErrorAction.IGNORE)); in testDefaultValue()
94 if (encoder instanceof MockCharsetEncoder) { in testDefaultValue()
[all …]
DUTFCharsetEncoderTest.java49 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
50 assertTrue(encoder.canEncode('\uc2a3')); in testCanEncodechar()
53 assertTrue(encoder.canEncode('\uc2c0')); in testCanEncodechar()
58 assertTrue(encoder.canEncode("\u0077")); in testCanEncodeCharSequence()
59 assertTrue(encoder.canEncode("\uc2a3")); in testCanEncodeCharSequence()
62 assertTrue(encoder.canEncode("\uc2c0")); in testCanEncodeCharSequence()
68 assertTrue(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
70 assertFalse(encoder.canEncode("\ud800\udb00")); in testCanEncodeCharSequence()
74 assertEquals(2, encoder.averageBytesPerChar(), 0); in testSpecificDefaultValue()
75 assertEquals(3, encoder.maxBytesPerChar(), 0); in testSpecificDefaultValue()
DUTF16BECharsetEncoderTest.java59 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
60 assertTrue(encoder.canEncode('\uc2a3')); in testCanEncodechar()
63 assertTrue(encoder.canEncode('\uc2c0')); in testCanEncodechar()
69 assertTrue(encoder.canEncode("\u0077")); in testCanEncodeCharSequence()
70 assertTrue(encoder.canEncode("\uc2a3")); in testCanEncodeCharSequence()
73 assertTrue(encoder.canEncode("\uc2c0")); in testCanEncodeCharSequence()
79 assertTrue(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
81 assertFalse(encoder.canEncode("\ud800\udb00")); in testCanEncodeCharSequence()
85 assertEquals(2, encoder.averageBytesPerChar(), 0.001); in testSpecificDefaultValue()
86 assertEquals(2, encoder.maxBytesPerChar(), 0.001); in testSpecificDefaultValue()
DUTF16LECharsetEncoderTest.java60 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
61 assertTrue(encoder.canEncode('\uc2a3')); in testCanEncodechar()
64 assertTrue(encoder.canEncode('\uc2c0')); in testCanEncodechar()
69 assertTrue(encoder.canEncode("\u0077")); in testCanEncodeCharSequence()
70 assertTrue(encoder.canEncode("\uc2a3")); in testCanEncodeCharSequence()
73 assertTrue(encoder.canEncode("\uc2c0")); in testCanEncodeCharSequence()
79 assertTrue(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
81 assertFalse(encoder.canEncode("\ud800\udb00")); in testCanEncodeCharSequence()
85 assertEquals(2, encoder.averageBytesPerChar(), 0.001); in testSpecificDefaultValue()
86 assertEquals(2, encoder.maxBytesPerChar(), 0.001); in testSpecificDefaultValue()
DISOCharsetEncoderTest.java52 assertTrue(encoder.canEncode("\u0077")); in testCanEncodeCharSequence()
53 assertFalse(encoder.canEncode("\uc2a3")); in testCanEncodeCharSequence()
54 assertFalse(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
58 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
59 assertFalse(encoder.canEncode('\uc2a3')); in testCanEncodechar()
63 assertEquals(1, encoder.averageBytesPerChar(), 0.001); in testSpecificDefaultValue()
64 assertEquals(1, encoder.maxBytesPerChar(), 0.001); in testSpecificDefaultValue()
84 encoder.onMalformedInput(CodingErrorAction.REPORT); in testMultiStepEncode()
85 encoder.onUnmappableCharacter(CodingErrorAction.REPORT); in testMultiStepEncode()
87 encoder.encode(CharBuffer.wrap("\ud800\udc00")); in testMultiStepEncode()
[all …]
DUTF16CharsetEncoderTest.java63 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
64 assertTrue(encoder.canEncode('\uc2a3')); in testCanEncodechar()
67 assertTrue(encoder.canEncode('\uc2c0')); in testCanEncodechar()
72 assertTrue(encoder.canEncode("\u0077")); in testCanEncodeCharSequence()
73 assertTrue(encoder.canEncode("\uc2a3")); in testCanEncodeCharSequence()
76 assertTrue(encoder.canEncode("\uc2c0")); in testCanEncodeCharSequence()
82 assertTrue(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
84 assertFalse(encoder.canEncode("\ud800\udb00")); in testCanEncodeCharSequence()
88 assertEquals(encoder.averageBytesPerChar(), 2, 0.001); in testSpecificDefaultValue()
91 assertEquals(encoder.maxBytesPerChar(), 2, 0.001); in testSpecificDefaultValue()
DGBCharsetEncoderTest.java49 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
50 assertTrue(encoder.canEncode('\uc2a3')); in testCanEncodechar()
53 assertTrue(encoder.canEncode('\uc2c0')); in testCanEncodechar()
63 assertTrue(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
65 assertFalse(encoder.canEncode("\ud800\udb00")); in testCanEncodeCharSequence()
69 assertEquals(4.0, encoder.maxBytesPerChar(), 0.0); in testSpecificDefaultValue()
70 assertEquals(2.5, encoder.averageBytesPerChar(), 0.0); in testSpecificDefaultValue()
DASCIICharsetEncoderTest.java34 private final CharsetEncoder encoder = cs.newEncoder(); field in ASCIICharsetEncoderTest
51 assertTrue(encoder.canEncode("\u0077")); in testCanEncodeCharSequence()
52 assertFalse(encoder.canEncode("\uc2a3")); in testCanEncodeCharSequence()
53 assertFalse(encoder.canEncode("\ud800\udc00")); in testCanEncodeCharSequence()
55 encoder.canEncode(null); in testCanEncodeCharSequence()
58 assertTrue(encoder.canEncode("")); in testCanEncodeCharSequence()
62 assertFalse(encoder.canEncode('\ud800')); in testCanEncodeSurrogate()
63 assertFalse(encoder.canEncode("\udc00")); in testCanEncodeSurrogate()
67 assertTrue(encoder.canEncode('\u0077')); in testCanEncodechar()
68 assertFalse(encoder.canEncode('\uc2a3')); in testCanEncodechar()
[all …]
DCharsetEncoder2Test.java159 CharsetEncoder encoder = utf8.newEncoder(); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB() local
163 encoder.reset(); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
166 CoderResult result = encoder.encode(char1, bytes, false); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
171 result = encoder.encode(char2, bytes, true); in test_EncodeLjava_nio_CharBufferLjava_nio_ByteBufferB()
/libcore/luni/src/main/java/java/io/
DOutputStreamWriter.java42 private CharsetEncoder encoder; field in OutputStreamWriter
81 encoder = Charset.forName(charsetName).newEncoder(); in OutputStreamWriter()
85 encoder.onMalformedInput(CodingErrorAction.REPLACE); in OutputStreamWriter()
86 encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); in OutputStreamWriter()
102 encoder = cs.newEncoder(); in OutputStreamWriter()
103 encoder.onMalformedInput(CodingErrorAction.REPLACE); in OutputStreamWriter()
104 encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); in OutputStreamWriter()
121 encoder = charsetEncoder; in OutputStreamWriter()
138 if (encoder != null) { in close()
142 encoder = null; in close()
[all …]
/libcore/luni/src/test/java/libcore/java/nio/charset/
DOldCharset_AbstractTest.java36 static CharsetEncoder encoder; field in OldCharset_AbstractTest
63 encoder = charset.newEncoder(); in setUp()
84 while (!encoder.canEncode((char) code)) code ++; in test_dumpEncodableChars()
91 while (!encoder.canEncode((char) code)) code ++; in test_dumpEncodableChars()
111 encoder.onUnmappableCharacter(CodingErrorAction.REPORT); in test_dumpEncoded()
112 outputBB = encoder.encode(inputCB); in test_dumpEncoded()
138 encoder.onUnmappableCharacter(CodingErrorAction.REPORT); in test_Encode()
139 outputBB = encoder.encode(inputCB); in test_Encode()
148 encoder.onUnmappableCharacter(CodingErrorAction.REPORT); in NNtest_CodecDynamicIndividuals()
152 if (encoder.canEncode((char) code)) { in NNtest_CodecDynamicIndividuals()
[all …]
DOldCharsetEncoderDecoderBufferTest.java96 CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder(); in testEncoderOutputBuffer() local
102 encoder.encode(CharBuffer.wrap("ab"), out, false); in testEncoderOutputBuffer()
114 encoder.encode(CharBuffer.wrap("x"), out, true); in testEncoderOutputBuffer()
128 CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder(); in testEncoderInputBuffer() local
134 encoder.encode(inWithArray, out, false); in testEncoderInputBuffer()
141 encoder.encode(inWithoutArray, out, true); in testEncoderInputBuffer()
DOldCharset_MultiByte_EUC_JP.java35 encoder.onUnmappableCharacter(CodingErrorAction.REPORT); in test_CodecDynamic()
39 if (encoder.canEncode(codePoint)) { in test_CodecDynamic()
44 ByteBuffer intermediateBB = encoder.encode(inputCB); in test_CodecDynamic()
DCharset_TestGenerator.java33 CharsetEncoder encoder; field in Charset_TestGenerator
220 CharsetEncoder encoder = charset.newEncoder(); in genEncoded() local
221 encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); in genEncoded()
223 ByteBuffer bb = encoder.encode(cb); in genEncoded()
DOldCharset_SingleByteAbstractTest.java107 encoder.onUnmappableCharacter(CodingErrorAction.REPLACE); in test_Encode()
108 outputBB = encoder.encode(inputCB); in test_Encode()
DCharsetDecoderTest.java87 CharsetEncoder encoder = Charset.forName(charsetName).newEncoder(); in encode() local
88 return encoder.encode(CharBuffer.wrap(s)).array(); in encode()
/libcore/luni/src/main/java/java/util/jar/
DManifest.java253 CharsetEncoder encoder = StandardCharsets.UTF_8.newEncoder(); in write() local
263 writeEntry(out, versionName, version, encoder, buffer); in write()
268 writeEntry(out, name, manifest.mainAttributes.getValue(name), encoder, buffer); in write()
276 writeEntry(out, Attributes.Name.NAME, key, encoder, buffer); in write()
281 writeEntry(out, name, attributes.getValue(name), encoder, buffer); in write()
288 String value, CharsetEncoder encoder, ByteBuffer bBuf) throws IOException { in writeEntry() argument
293 encoder.reset(); in writeEntry()
299 CoderResult r = encoder.encode(cBuf, bBuf, true); in writeEntry()
301 r = encoder.flush(bBuf); in writeEntry()
/libcore/luni/src/main/java/libcore/icu/
DNativeConverter.java63 public static void setCallbackEncode(long converterHandle, CharsetEncoder encoder) { in setCallbackEncode() argument
65 translateCodingErrorAction(encoder.malformedInputAction()), in setCallbackEncode()
66 translateCodingErrorAction(encoder.unmappableCharacterAction()), in setCallbackEncode()
67 encoder.replacement()); in setCallbackEncode()
/libcore/luni/src/main/java/java/nio/channels/
DChannels.java172 CharsetEncoder encoder, int minBufferCapacity) { in newWriter() argument
177 return new OutputStreamWriter(new ChannelOutputStream(channel), encoder); in newWriter()